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,
223 ALC888_ACER_ASPIRE_7730G,
227 ALC883_LENOVO_101E_2ch,
228 ALC883_LENOVO_NB0763,
229 ALC888_LENOVO_MS7195_DIG,
236 ALC883_FUJITSU_PI2515,
237 ALC888_FUJITSU_XA3530,
238 ALC883_3ST_6ch_INTEL,
251 #define GPIO_MASK 0x03
253 /* extra amp-initialization sequence types */
262 struct alc_mic_route {
264 unsigned char mux_idx;
265 unsigned char amix_idx;
268 #define MUX_IDX_UNDEF ((unsigned char)-1)
271 /* codec parameterization */
272 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
273 unsigned int num_mixers;
274 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
275 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
277 const struct hda_verb *init_verbs[5]; /* initialization verbs
281 unsigned int num_init_verbs;
283 char stream_name_analog[32]; /* analog PCM stream */
284 struct hda_pcm_stream *stream_analog_playback;
285 struct hda_pcm_stream *stream_analog_capture;
286 struct hda_pcm_stream *stream_analog_alt_playback;
287 struct hda_pcm_stream *stream_analog_alt_capture;
289 char stream_name_digital[32]; /* digital PCM stream */
290 struct hda_pcm_stream *stream_digital_playback;
291 struct hda_pcm_stream *stream_digital_capture;
294 struct hda_multi_out multiout; /* playback set-up
295 * max_channels, dacs must be set
296 * dig_out_nid and hp_nid are optional
298 hda_nid_t alt_dac_nid;
299 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
303 unsigned int num_adc_nids;
305 hda_nid_t *capsrc_nids;
306 hda_nid_t dig_in_nid; /* digital-in NID; optional */
309 unsigned int num_mux_defs;
310 const struct hda_input_mux *input_mux;
311 unsigned int cur_mux[3];
312 struct alc_mic_route ext_mic;
313 struct alc_mic_route int_mic;
316 const struct hda_channel_mode *channel_mode;
317 int num_channel_mode;
319 int const_channel_count;
320 int ext_channel_count;
322 /* PCM information */
323 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
325 /* dynamic controls, init_verbs and input_mux */
326 struct auto_pin_cfg autocfg;
327 struct snd_array kctls;
328 struct hda_input_mux private_imux[3];
329 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
330 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
331 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
334 void (*init_hook)(struct hda_codec *codec);
335 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
337 /* for pin sensing */
338 unsigned int sense_updated: 1;
339 unsigned int jack_present: 1;
340 unsigned int master_sw: 1;
341 unsigned int auto_mic:1;
344 unsigned int no_analog :1; /* digital I/O only */
347 /* for virtual master */
348 hda_nid_t vmaster_nid;
349 #ifdef CONFIG_SND_HDA_POWER_SAVE
350 struct hda_loopback_check loopback;
355 unsigned int pll_coef_idx, pll_coef_bit;
359 * configuration template - to be copied to the spec instance
361 struct alc_config_preset {
362 struct snd_kcontrol_new *mixers[5]; /* should be identical size
365 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
366 const struct hda_verb *init_verbs[5];
367 unsigned int num_dacs;
369 hda_nid_t dig_out_nid; /* optional */
370 hda_nid_t hp_nid; /* optional */
371 hda_nid_t *slave_dig_outs;
372 unsigned int num_adc_nids;
374 hda_nid_t *capsrc_nids;
375 hda_nid_t dig_in_nid;
376 unsigned int num_channel_mode;
377 const struct hda_channel_mode *channel_mode;
379 int const_channel_count;
380 unsigned int num_mux_defs;
381 const struct hda_input_mux *input_mux;
382 void (*unsol_event)(struct hda_codec *, unsigned int);
383 void (*setup)(struct hda_codec *);
384 void (*init_hook)(struct hda_codec *);
385 #ifdef CONFIG_SND_HDA_POWER_SAVE
386 struct hda_amp_list *loopbacks;
394 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
395 struct snd_ctl_elem_info *uinfo)
397 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
398 struct alc_spec *spec = codec->spec;
399 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
400 if (mux_idx >= spec->num_mux_defs)
402 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
405 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
406 struct snd_ctl_elem_value *ucontrol)
408 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
409 struct alc_spec *spec = codec->spec;
410 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
412 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
416 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
417 struct snd_ctl_elem_value *ucontrol)
419 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
420 struct alc_spec *spec = codec->spec;
421 const struct hda_input_mux *imux;
422 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
423 unsigned int mux_idx;
424 hda_nid_t nid = spec->capsrc_nids ?
425 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
428 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
429 imux = &spec->input_mux[mux_idx];
431 type = get_wcaps_type(get_wcaps(codec, nid));
432 if (type == AC_WID_AUD_MIX) {
433 /* Matrix-mixer style (e.g. ALC882) */
434 unsigned int *cur_val = &spec->cur_mux[adc_idx];
437 idx = ucontrol->value.enumerated.item[0];
438 if (idx >= imux->num_items)
439 idx = imux->num_items - 1;
442 for (i = 0; i < imux->num_items; i++) {
443 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
444 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
445 imux->items[i].index,
451 /* MUX style (e.g. ALC880) */
452 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
453 &spec->cur_mux[adc_idx]);
458 * channel mode setting
460 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
461 struct snd_ctl_elem_info *uinfo)
463 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
464 struct alc_spec *spec = codec->spec;
465 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
466 spec->num_channel_mode);
469 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
470 struct snd_ctl_elem_value *ucontrol)
472 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
473 struct alc_spec *spec = codec->spec;
474 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
475 spec->num_channel_mode,
476 spec->ext_channel_count);
479 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
480 struct snd_ctl_elem_value *ucontrol)
482 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
483 struct alc_spec *spec = codec->spec;
484 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
485 spec->num_channel_mode,
486 &spec->ext_channel_count);
487 if (err >= 0 && !spec->const_channel_count) {
488 spec->multiout.max_channels = spec->ext_channel_count;
489 if (spec->need_dac_fix)
490 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
496 * Control the mode of pin widget settings via the mixer. "pc" is used
497 * instead of "%" to avoid consequences of accidently treating the % as
498 * being part of a format specifier. Maximum allowed length of a value is
499 * 63 characters plus NULL terminator.
501 * Note: some retasking pin complexes seem to ignore requests for input
502 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
503 * are requested. Therefore order this list so that this behaviour will not
504 * cause problems when mixer clients move through the enum sequentially.
505 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
508 static char *alc_pin_mode_names[] = {
509 "Mic 50pc bias", "Mic 80pc bias",
510 "Line in", "Line out", "Headphone out",
512 static unsigned char alc_pin_mode_values[] = {
513 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
515 /* The control can present all 5 options, or it can limit the options based
516 * in the pin being assumed to be exclusively an input or an output pin. In
517 * addition, "input" pins may or may not process the mic bias option
518 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
519 * accept requests for bias as of chip versions up to March 2006) and/or
520 * wiring in the computer.
522 #define ALC_PIN_DIR_IN 0x00
523 #define ALC_PIN_DIR_OUT 0x01
524 #define ALC_PIN_DIR_INOUT 0x02
525 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
526 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
528 /* Info about the pin modes supported by the different pin direction modes.
529 * For each direction the minimum and maximum values are given.
531 static signed char alc_pin_mode_dir_info[5][2] = {
532 { 0, 2 }, /* ALC_PIN_DIR_IN */
533 { 3, 4 }, /* ALC_PIN_DIR_OUT */
534 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
535 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
536 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
538 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
539 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
540 #define alc_pin_mode_n_items(_dir) \
541 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
543 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_info *uinfo)
546 unsigned int item_num = uinfo->value.enumerated.item;
547 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
549 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
551 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
553 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
554 item_num = alc_pin_mode_min(dir);
555 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
559 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
560 struct snd_ctl_elem_value *ucontrol)
563 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
564 hda_nid_t nid = kcontrol->private_value & 0xffff;
565 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
566 long *valp = ucontrol->value.integer.value;
567 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
568 AC_VERB_GET_PIN_WIDGET_CONTROL,
571 /* Find enumerated value for current pinctl setting */
572 i = alc_pin_mode_min(dir);
573 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
575 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
579 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
580 struct snd_ctl_elem_value *ucontrol)
583 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
584 hda_nid_t nid = kcontrol->private_value & 0xffff;
585 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
586 long val = *ucontrol->value.integer.value;
587 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
588 AC_VERB_GET_PIN_WIDGET_CONTROL,
591 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
592 val = alc_pin_mode_min(dir);
594 change = pinctl != alc_pin_mode_values[val];
596 /* Set pin mode to that requested */
597 snd_hda_codec_write_cache(codec, nid, 0,
598 AC_VERB_SET_PIN_WIDGET_CONTROL,
599 alc_pin_mode_values[val]);
601 /* Also enable the retasking pin's input/output as required
602 * for the requested pin mode. Enum values of 2 or less are
605 * Dynamically switching the input/output buffers probably
606 * reduces noise slightly (particularly on input) so we'll
607 * do it. However, having both input and output buffers
608 * enabled simultaneously doesn't seem to be problematic if
609 * this turns out to be necessary in the future.
612 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
613 HDA_AMP_MUTE, HDA_AMP_MUTE);
614 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
617 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
618 HDA_AMP_MUTE, HDA_AMP_MUTE);
619 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
626 #define ALC_PIN_MODE(xname, nid, dir) \
627 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
628 .info = alc_pin_mode_info, \
629 .get = alc_pin_mode_get, \
630 .put = alc_pin_mode_put, \
631 .private_value = nid | (dir<<16) }
633 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
634 * together using a mask with more than one bit set. This control is
635 * currently used only by the ALC260 test model. At this stage they are not
636 * needed for any "production" models.
638 #ifdef CONFIG_SND_DEBUG
639 #define alc_gpio_data_info snd_ctl_boolean_mono_info
641 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
642 struct snd_ctl_elem_value *ucontrol)
644 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
645 hda_nid_t nid = kcontrol->private_value & 0xffff;
646 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
647 long *valp = ucontrol->value.integer.value;
648 unsigned int val = snd_hda_codec_read(codec, nid, 0,
649 AC_VERB_GET_GPIO_DATA, 0x00);
651 *valp = (val & mask) != 0;
654 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
655 struct snd_ctl_elem_value *ucontrol)
658 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
659 hda_nid_t nid = kcontrol->private_value & 0xffff;
660 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
661 long val = *ucontrol->value.integer.value;
662 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
663 AC_VERB_GET_GPIO_DATA,
666 /* Set/unset the masked GPIO bit(s) as needed */
667 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
672 snd_hda_codec_write_cache(codec, nid, 0,
673 AC_VERB_SET_GPIO_DATA, gpio_data);
677 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
678 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
679 .info = alc_gpio_data_info, \
680 .get = alc_gpio_data_get, \
681 .put = alc_gpio_data_put, \
682 .private_value = nid | (mask<<16) }
683 #endif /* CONFIG_SND_DEBUG */
685 /* A switch control to allow the enabling of the digital IO pins on the
686 * ALC260. This is incredibly simplistic; the intention of this control is
687 * to provide something in the test model allowing digital outputs to be
688 * identified if present. If models are found which can utilise these
689 * outputs a more complete mixer control can be devised for those models if
692 #ifdef CONFIG_SND_DEBUG
693 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
695 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
696 struct snd_ctl_elem_value *ucontrol)
698 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
699 hda_nid_t nid = kcontrol->private_value & 0xffff;
700 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
701 long *valp = ucontrol->value.integer.value;
702 unsigned int val = snd_hda_codec_read(codec, nid, 0,
703 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
705 *valp = (val & mask) != 0;
708 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
709 struct snd_ctl_elem_value *ucontrol)
712 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
713 hda_nid_t nid = kcontrol->private_value & 0xffff;
714 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
715 long val = *ucontrol->value.integer.value;
716 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
717 AC_VERB_GET_DIGI_CONVERT_1,
720 /* Set/unset the masked control bit(s) as needed */
721 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
726 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
731 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
732 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
733 .info = alc_spdif_ctrl_info, \
734 .get = alc_spdif_ctrl_get, \
735 .put = alc_spdif_ctrl_put, \
736 .private_value = nid | (mask<<16) }
737 #endif /* CONFIG_SND_DEBUG */
739 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
740 * Again, this is only used in the ALC26x test models to help identify when
741 * the EAPD line must be asserted for features to work.
743 #ifdef CONFIG_SND_DEBUG
744 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
746 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
747 struct snd_ctl_elem_value *ucontrol)
749 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
750 hda_nid_t nid = kcontrol->private_value & 0xffff;
751 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
752 long *valp = ucontrol->value.integer.value;
753 unsigned int val = snd_hda_codec_read(codec, nid, 0,
754 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
756 *valp = (val & mask) != 0;
760 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
761 struct snd_ctl_elem_value *ucontrol)
764 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
765 hda_nid_t nid = kcontrol->private_value & 0xffff;
766 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
767 long val = *ucontrol->value.integer.value;
768 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
769 AC_VERB_GET_EAPD_BTLENABLE,
772 /* Set/unset the masked control bit(s) as needed */
773 change = (!val ? 0 : mask) != (ctrl_data & mask);
778 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
784 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
785 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
786 .info = alc_eapd_ctrl_info, \
787 .get = alc_eapd_ctrl_get, \
788 .put = alc_eapd_ctrl_put, \
789 .private_value = nid | (mask<<16) }
790 #endif /* CONFIG_SND_DEBUG */
793 * set up the input pin config (depending on the given auto-pin type)
795 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
798 unsigned int val = PIN_IN;
800 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
802 pincap = snd_hda_query_pin_caps(codec, nid);
803 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
804 if (pincap & AC_PINCAP_VREF_80)
806 else if (pincap & AC_PINCAP_VREF_50)
808 else if (pincap & AC_PINCAP_VREF_100)
810 else if (pincap & AC_PINCAP_VREF_GRD)
813 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
818 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
820 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
822 spec->mixers[spec->num_mixers++] = mix;
825 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
827 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
829 spec->init_verbs[spec->num_init_verbs++] = verb;
832 #ifdef CONFIG_PROC_FS
836 static void print_realtek_coef(struct snd_info_buffer *buffer,
837 struct hda_codec *codec, hda_nid_t nid)
843 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
844 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
845 coeff = snd_hda_codec_read(codec, nid, 0,
846 AC_VERB_GET_COEF_INDEX, 0);
847 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
850 #define print_realtek_coef NULL
854 * set up from the preset table
856 static void setup_preset(struct hda_codec *codec,
857 const struct alc_config_preset *preset)
859 struct alc_spec *spec = codec->spec;
862 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
863 add_mixer(spec, preset->mixers[i]);
864 spec->cap_mixer = preset->cap_mixer;
865 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
867 add_verb(spec, preset->init_verbs[i]);
869 spec->channel_mode = preset->channel_mode;
870 spec->num_channel_mode = preset->num_channel_mode;
871 spec->need_dac_fix = preset->need_dac_fix;
872 spec->const_channel_count = preset->const_channel_count;
874 if (preset->const_channel_count)
875 spec->multiout.max_channels = preset->const_channel_count;
877 spec->multiout.max_channels = spec->channel_mode[0].channels;
878 spec->ext_channel_count = spec->channel_mode[0].channels;
880 spec->multiout.num_dacs = preset->num_dacs;
881 spec->multiout.dac_nids = preset->dac_nids;
882 spec->multiout.dig_out_nid = preset->dig_out_nid;
883 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
884 spec->multiout.hp_nid = preset->hp_nid;
886 spec->num_mux_defs = preset->num_mux_defs;
887 if (!spec->num_mux_defs)
888 spec->num_mux_defs = 1;
889 spec->input_mux = preset->input_mux;
891 spec->num_adc_nids = preset->num_adc_nids;
892 spec->adc_nids = preset->adc_nids;
893 spec->capsrc_nids = preset->capsrc_nids;
894 spec->dig_in_nid = preset->dig_in_nid;
896 spec->unsol_event = preset->unsol_event;
897 spec->init_hook = preset->init_hook;
898 #ifdef CONFIG_SND_HDA_POWER_SAVE
899 spec->loopback.amplist = preset->loopbacks;
903 preset->setup(codec);
906 /* Enable GPIO mask and set output */
907 static struct hda_verb alc_gpio1_init_verbs[] = {
908 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
909 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
910 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
914 static struct hda_verb alc_gpio2_init_verbs[] = {
915 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
916 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
917 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
921 static struct hda_verb alc_gpio3_init_verbs[] = {
922 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
923 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
924 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
929 * Fix hardware PLL issue
930 * On some codecs, the analog PLL gating control must be off while
931 * the default value is 1.
933 static void alc_fix_pll(struct hda_codec *codec)
935 struct alc_spec *spec = codec->spec;
940 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
942 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
943 AC_VERB_GET_PROC_COEF, 0);
944 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
946 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
947 val & ~(1 << spec->pll_coef_bit));
950 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
951 unsigned int coef_idx, unsigned int coef_bit)
953 struct alc_spec *spec = codec->spec;
955 spec->pll_coef_idx = coef_idx;
956 spec->pll_coef_bit = coef_bit;
960 static void alc_automute_pin(struct hda_codec *codec)
962 struct alc_spec *spec = codec->spec;
963 unsigned int present, pincap;
964 unsigned int nid = spec->autocfg.hp_pins[0];
967 pincap = snd_hda_query_pin_caps(codec, nid);
968 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
969 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
970 present = snd_hda_codec_read(codec, nid, 0,
971 AC_VERB_GET_PIN_SENSE, 0);
972 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
973 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
974 nid = spec->autocfg.speaker_pins[i];
977 snd_hda_codec_write(codec, nid, 0,
978 AC_VERB_SET_PIN_WIDGET_CONTROL,
979 spec->jack_present ? 0 : PIN_OUT);
983 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
986 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
989 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
990 for (i = 0; i < nums; i++)
996 static void alc_mic_automute(struct hda_codec *codec)
998 struct alc_spec *spec = codec->spec;
999 struct alc_mic_route *dead, *alive;
1000 unsigned int present, type;
1003 if (!spec->auto_mic)
1005 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1007 if (snd_BUG_ON(!spec->adc_nids))
1010 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1012 present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0,
1013 AC_VERB_GET_PIN_SENSE, 0);
1014 present &= AC_PINSENSE_PRESENCE;
1016 alive = &spec->ext_mic;
1017 dead = &spec->int_mic;
1019 alive = &spec->int_mic;
1020 dead = &spec->ext_mic;
1023 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1024 if (type == AC_WID_AUD_MIX) {
1025 /* Matrix-mixer style (e.g. ALC882) */
1026 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1029 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1031 HDA_AMP_MUTE, HDA_AMP_MUTE);
1033 /* MUX style (e.g. ALC880) */
1034 snd_hda_codec_write_cache(codec, cap_nid, 0,
1035 AC_VERB_SET_CONNECT_SEL,
1039 /* FIXME: analog mixer */
1042 /* unsolicited event for HP jack sensing */
1043 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1045 if (codec->vendor_id == 0x10ec0880)
1050 case ALC880_HP_EVENT:
1051 alc_automute_pin(codec);
1053 case ALC880_MIC_EVENT:
1054 alc_mic_automute(codec);
1059 static void alc_inithook(struct hda_codec *codec)
1061 alc_automute_pin(codec);
1062 alc_mic_automute(codec);
1065 /* additional initialization for ALC888 variants */
1066 static void alc888_coef_init(struct hda_codec *codec)
1070 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1071 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1072 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1073 if ((tmp & 0xf0) == 0x20)
1075 snd_hda_codec_read(codec, 0x20, 0,
1076 AC_VERB_SET_PROC_COEF, 0x830);
1079 snd_hda_codec_read(codec, 0x20, 0,
1080 AC_VERB_SET_PROC_COEF, 0x3030);
1083 static void alc889_coef_init(struct hda_codec *codec)
1087 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1088 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1089 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1090 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1093 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1098 case ALC_INIT_GPIO1:
1099 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1101 case ALC_INIT_GPIO2:
1102 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1104 case ALC_INIT_GPIO3:
1105 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1107 case ALC_INIT_DEFAULT:
1108 switch (codec->vendor_id) {
1110 snd_hda_codec_write(codec, 0x0f, 0,
1111 AC_VERB_SET_EAPD_BTLENABLE, 2);
1112 snd_hda_codec_write(codec, 0x10, 0,
1113 AC_VERB_SET_EAPD_BTLENABLE, 2);
1125 snd_hda_codec_write(codec, 0x14, 0,
1126 AC_VERB_SET_EAPD_BTLENABLE, 2);
1127 snd_hda_codec_write(codec, 0x15, 0,
1128 AC_VERB_SET_EAPD_BTLENABLE, 2);
1131 switch (codec->vendor_id) {
1133 snd_hda_codec_write(codec, 0x1a, 0,
1134 AC_VERB_SET_COEF_INDEX, 7);
1135 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1136 AC_VERB_GET_PROC_COEF, 0);
1137 snd_hda_codec_write(codec, 0x1a, 0,
1138 AC_VERB_SET_COEF_INDEX, 7);
1139 snd_hda_codec_write(codec, 0x1a, 0,
1140 AC_VERB_SET_PROC_COEF,
1150 alc889_coef_init(codec);
1153 alc888_coef_init(codec);
1157 snd_hda_codec_write(codec, 0x20, 0,
1158 AC_VERB_SET_COEF_INDEX, 7);
1159 tmp = snd_hda_codec_read(codec, 0x20, 0,
1160 AC_VERB_GET_PROC_COEF, 0);
1161 snd_hda_codec_write(codec, 0x20, 0,
1162 AC_VERB_SET_COEF_INDEX, 7);
1163 snd_hda_codec_write(codec, 0x20, 0,
1164 AC_VERB_SET_PROC_COEF,
1172 static void alc_init_auto_hp(struct hda_codec *codec)
1174 struct alc_spec *spec = codec->spec;
1176 if (!spec->autocfg.hp_pins[0])
1179 if (!spec->autocfg.speaker_pins[0]) {
1180 if (spec->autocfg.line_out_pins[0] &&
1181 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1182 spec->autocfg.speaker_pins[0] =
1183 spec->autocfg.line_out_pins[0];
1188 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1189 spec->autocfg.hp_pins[0]);
1190 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1191 AC_VERB_SET_UNSOLICITED_ENABLE,
1192 AC_USRSP_EN | ALC880_HP_EVENT);
1193 spec->unsol_event = alc_sku_unsol_event;
1196 static void alc_init_auto_mic(struct hda_codec *codec)
1198 struct alc_spec *spec = codec->spec;
1199 struct auto_pin_cfg *cfg = &spec->autocfg;
1200 hda_nid_t fixed, ext;
1203 /* there must be only two mic inputs exclusively */
1204 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1205 if (cfg->input_pins[i])
1209 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1210 hda_nid_t nid = cfg->input_pins[i];
1211 unsigned int defcfg;
1214 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1215 switch (get_defcfg_connect(defcfg)) {
1216 case AC_JACK_PORT_FIXED:
1218 return; /* already occupied */
1221 case AC_JACK_PORT_COMPLEX:
1223 return; /* already occupied */
1227 return; /* invalid entry */
1230 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1231 return; /* no unsol support */
1232 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1234 spec->ext_mic.pin = ext;
1235 spec->int_mic.pin = fixed;
1236 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1237 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1239 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1240 AC_VERB_SET_UNSOLICITED_ENABLE,
1241 AC_USRSP_EN | ALC880_MIC_EVENT);
1242 spec->unsol_event = alc_sku_unsol_event;
1245 /* check subsystem ID and set up device-specific initialization;
1246 * return 1 if initialized, 0 if invalid SSID
1248 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1249 * 31 ~ 16 : Manufacture ID
1251 * 7 ~ 0 : Assembly ID
1252 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1254 static int alc_subsystem_id(struct hda_codec *codec,
1255 hda_nid_t porta, hda_nid_t porte,
1258 unsigned int ass, tmp, i;
1260 struct alc_spec *spec = codec->spec;
1262 ass = codec->subsystem_id & 0xffff;
1263 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1266 /* invalid SSID, check the special NID pin defcfg instead */
1268 * 31~30 : port connectivity
1271 * 19~16 : Check sum (15:1)
1276 if (codec->vendor_id == 0x10ec0260)
1278 ass = snd_hda_codec_get_pincfg(codec, nid);
1279 snd_printd("realtek: No valid SSID, "
1280 "checking pincfg 0x%08x for NID 0x%x\n",
1282 if (!(ass & 1) && !(ass & 0x100000))
1284 if ((ass >> 30) != 1) /* no physical connection */
1289 for (i = 1; i < 16; i++) {
1293 if (((ass >> 16) & 0xf) != tmp)
1296 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1297 ass & 0xffff, codec->vendor_id);
1301 * 2 : 0 --> Desktop, 1 --> Laptop
1302 * 3~5 : External Amplifier control
1305 tmp = (ass & 0x38) >> 3; /* external Amp control */
1308 spec->init_amp = ALC_INIT_GPIO1;
1311 spec->init_amp = ALC_INIT_GPIO2;
1314 spec->init_amp = ALC_INIT_GPIO3;
1317 spec->init_amp = ALC_INIT_DEFAULT;
1321 /* is laptop or Desktop and enable the function "Mute internal speaker
1322 * when the external headphone out jack is plugged"
1324 if (!(ass & 0x8000))
1327 * 10~8 : Jack location
1328 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1330 * 15 : 1 --> enable the function "Mute internal speaker
1331 * when the external headphone out jack is plugged"
1333 if (!spec->autocfg.hp_pins[0]) {
1334 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1336 spec->autocfg.hp_pins[0] = porta;
1338 spec->autocfg.hp_pins[0] = porte;
1340 spec->autocfg.hp_pins[0] = portd;
1345 alc_init_auto_hp(codec);
1346 alc_init_auto_mic(codec);
1350 static void alc_ssid_check(struct hda_codec *codec,
1351 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1353 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1354 struct alc_spec *spec = codec->spec;
1355 snd_printd("realtek: "
1356 "Enable default setup for auto mode as fallback\n");
1357 spec->init_amp = ALC_INIT_DEFAULT;
1358 alc_init_auto_hp(codec);
1359 alc_init_auto_mic(codec);
1364 * Fix-up pin default configurations
1372 static void alc_fix_pincfg(struct hda_codec *codec,
1373 const struct snd_pci_quirk *quirk,
1374 const struct alc_pincfg **pinfix)
1376 const struct alc_pincfg *cfg;
1378 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1382 cfg = pinfix[quirk->value];
1383 for (; cfg->nid; cfg++)
1384 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1394 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1395 /* Mic-in jack as mic in */
1396 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1397 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1398 /* Line-in jack as Line in */
1399 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1400 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1401 /* Line-Out as Front */
1402 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1409 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1410 /* Mic-in jack as mic in */
1411 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1412 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1413 /* Line-in jack as Surround */
1414 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1415 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1416 /* Line-Out as Front */
1417 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1424 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1425 /* Mic-in jack as CLFE */
1426 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1427 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1428 /* Line-in jack as Surround */
1429 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1430 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1431 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1432 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1439 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1440 /* Mic-in jack as CLFE */
1441 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1442 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1443 /* Line-in jack as Surround */
1444 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1445 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1446 /* Line-Out as Side */
1447 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1451 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1452 { 2, alc888_4ST_ch2_intel_init },
1453 { 4, alc888_4ST_ch4_intel_init },
1454 { 6, alc888_4ST_ch6_intel_init },
1455 { 8, alc888_4ST_ch8_intel_init },
1459 * ALC888 Fujitsu Siemens Amillo xa3530
1462 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1463 /* Front Mic: set to PIN_IN (empty by default) */
1464 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1465 /* Connect Internal HP to Front */
1466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1467 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1468 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1469 /* Connect Bass HP to Front */
1470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1472 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1473 /* Connect Line-Out side jack (SPDIF) to Side */
1474 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1475 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1476 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1477 /* Connect Mic jack to CLFE */
1478 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1479 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1480 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1481 /* Connect Line-in jack to Surround */
1482 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1483 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1484 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1485 /* Connect HP out jack to Front */
1486 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1487 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1488 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1489 /* Enable unsolicited event for HP jack and Line-out jack */
1490 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1491 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1495 static void alc_automute_amp(struct hda_codec *codec)
1497 struct alc_spec *spec = codec->spec;
1498 unsigned int val, mute, pincap;
1502 spec->jack_present = 0;
1503 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1504 nid = spec->autocfg.hp_pins[i];
1507 pincap = snd_hda_query_pin_caps(codec, nid);
1508 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1509 snd_hda_codec_read(codec, nid, 0,
1510 AC_VERB_SET_PIN_SENSE, 0);
1511 val = snd_hda_codec_read(codec, nid, 0,
1512 AC_VERB_GET_PIN_SENSE, 0);
1513 if (val & AC_PINSENSE_PRESENCE) {
1514 spec->jack_present = 1;
1519 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1520 /* Toggle internal speakers muting */
1521 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1522 nid = spec->autocfg.speaker_pins[i];
1525 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1526 HDA_AMP_MUTE, mute);
1530 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1533 if (codec->vendor_id == 0x10ec0880)
1537 if (res == ALC880_HP_EVENT)
1538 alc_automute_amp(codec);
1541 static void alc889_automute_setup(struct hda_codec *codec)
1543 struct alc_spec *spec = codec->spec;
1545 spec->autocfg.hp_pins[0] = 0x15;
1546 spec->autocfg.speaker_pins[0] = 0x14;
1547 spec->autocfg.speaker_pins[1] = 0x16;
1548 spec->autocfg.speaker_pins[2] = 0x17;
1549 spec->autocfg.speaker_pins[3] = 0x19;
1550 spec->autocfg.speaker_pins[4] = 0x1a;
1553 static void alc889_intel_init_hook(struct hda_codec *codec)
1555 alc889_coef_init(codec);
1556 alc_automute_amp(codec);
1559 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1561 struct alc_spec *spec = codec->spec;
1563 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1564 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1565 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1566 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1570 * ALC888 Acer Aspire 4930G model
1573 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1574 /* Front Mic: set to PIN_IN (empty by default) */
1575 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1576 /* Unselect Front Mic by default in input mixer 3 */
1577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1578 /* Enable unsolicited event for HP jack */
1579 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1580 /* Connect Internal HP to front */
1581 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1582 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1583 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1584 /* Connect HP out to front */
1585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1586 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1587 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1592 * ALC888 Acer Aspire 6530G model
1595 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1596 /* Bias voltage on for external mic port */
1597 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1598 /* Front Mic: set to PIN_IN (empty by default) */
1599 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1600 /* Unselect Front Mic by default in input mixer 3 */
1601 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1602 /* Enable unsolicited event for HP jack */
1603 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1604 /* Enable speaker output */
1605 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1606 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1607 /* Enable headphone output */
1608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1610 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1615 * ALC889 Acer Aspire 8930G model
1618 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1619 /* Front Mic: set to PIN_IN (empty by default) */
1620 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1621 /* Unselect Front Mic by default in input mixer 3 */
1622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1623 /* Enable unsolicited event for HP jack */
1624 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1625 /* Connect Internal Front to Front */
1626 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1627 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1628 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1629 /* Connect Internal Rear to Rear */
1630 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1631 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1632 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1633 /* Connect Internal CLFE to CLFE */
1634 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1635 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1636 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1637 /* Connect HP out to Front */
1638 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1640 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1641 /* Enable all DACs */
1642 /* DAC DISABLE/MUTE 1? */
1643 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1644 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1645 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1646 /* DAC DISABLE/MUTE 2? */
1647 /* some bit here disables the other DACs. Init=0x4900 */
1648 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1649 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1650 /* Enable amplifiers */
1651 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1652 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1654 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1655 * which makes the stereo useless. However, either the mic or the ALC889
1656 * makes the signal become a difference/sum signal instead of standard
1657 * stereo, which is annoying. So instead we flip this bit which makes the
1658 * codec replicate the sum signal to both channels, turning it into a
1661 /* DMIC_CONTROL? Init value = 0x0001 */
1662 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1663 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1667 static struct hda_input_mux alc888_2_capture_sources[2] = {
1668 /* Front mic only available on one ADC */
1675 { "Front Mic", 0xb },
1688 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1689 /* Interal mic only available on one ADC */
1696 { "Input Mix", 0xa },
1706 { "Input Mix", 0xa },
1711 static struct hda_input_mux alc889_capture_sources[3] = {
1712 /* Digital mic only available on first "ADC" */
1719 { "Front Mic", 0xb },
1720 { "Input Mix", 0xa },
1729 { "Input Mix", 0xa },
1738 { "Input Mix", 0xa },
1743 static struct snd_kcontrol_new alc888_base_mixer[] = {
1744 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1745 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1746 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1747 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1748 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1750 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1751 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1752 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1753 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1754 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1755 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1756 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1757 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1758 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1760 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1765 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1767 struct alc_spec *spec = codec->spec;
1769 spec->autocfg.hp_pins[0] = 0x15;
1770 spec->autocfg.speaker_pins[0] = 0x14;
1773 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1775 struct alc_spec *spec = codec->spec;
1777 spec->autocfg.hp_pins[0] = 0x15;
1778 spec->autocfg.speaker_pins[0] = 0x14;
1779 spec->autocfg.speaker_pins[1] = 0x16;
1780 spec->autocfg.speaker_pins[2] = 0x17;
1783 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1785 struct alc_spec *spec = codec->spec;
1787 spec->autocfg.hp_pins[0] = 0x15;
1788 spec->autocfg.speaker_pins[0] = 0x14;
1789 spec->autocfg.speaker_pins[1] = 0x16;
1790 spec->autocfg.speaker_pins[2] = 0x1b;
1794 * ALC880 3-stack model
1796 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1797 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1798 * F-Mic = 0x1b, HP = 0x19
1801 static hda_nid_t alc880_dac_nids[4] = {
1802 /* front, rear, clfe, rear_surr */
1803 0x02, 0x05, 0x04, 0x03
1806 static hda_nid_t alc880_adc_nids[3] = {
1811 /* The datasheet says the node 0x07 is connected from inputs,
1812 * but it shows zero connection in the real implementation on some devices.
1813 * Note: this is a 915GAV bug, fixed on 915GLV
1815 static hda_nid_t alc880_adc_nids_alt[2] = {
1820 #define ALC880_DIGOUT_NID 0x06
1821 #define ALC880_DIGIN_NID 0x0a
1823 static struct hda_input_mux alc880_capture_source = {
1827 { "Front Mic", 0x3 },
1833 /* channel source setting (2/6 channel selection for 3-stack) */
1835 static struct hda_verb alc880_threestack_ch2_init[] = {
1836 /* set line-in to input, mute it */
1837 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1838 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1839 /* set mic-in to input vref 80%, mute it */
1840 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1841 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1846 static struct hda_verb alc880_threestack_ch6_init[] = {
1847 /* set line-in to output, unmute it */
1848 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1849 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1850 /* set mic-in to output, unmute it */
1851 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1852 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1856 static struct hda_channel_mode alc880_threestack_modes[2] = {
1857 { 2, alc880_threestack_ch2_init },
1858 { 6, alc880_threestack_ch6_init },
1861 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1862 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1863 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1864 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1865 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1866 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1867 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1868 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1869 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1870 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1871 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1872 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1873 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1876 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1877 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1878 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1880 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1881 .name = "Channel Mode",
1882 .info = alc_ch_mode_info,
1883 .get = alc_ch_mode_get,
1884 .put = alc_ch_mode_put,
1889 /* capture mixer elements */
1890 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1891 struct snd_ctl_elem_info *uinfo)
1893 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1894 struct alc_spec *spec = codec->spec;
1897 mutex_lock(&codec->control_mutex);
1898 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1900 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1901 mutex_unlock(&codec->control_mutex);
1905 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1906 unsigned int size, unsigned int __user *tlv)
1908 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1909 struct alc_spec *spec = codec->spec;
1912 mutex_lock(&codec->control_mutex);
1913 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1915 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1916 mutex_unlock(&codec->control_mutex);
1920 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1921 struct snd_ctl_elem_value *ucontrol);
1923 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1924 struct snd_ctl_elem_value *ucontrol,
1927 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1928 struct alc_spec *spec = codec->spec;
1929 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1932 mutex_lock(&codec->control_mutex);
1933 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1935 err = func(kcontrol, ucontrol);
1936 mutex_unlock(&codec->control_mutex);
1940 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1941 struct snd_ctl_elem_value *ucontrol)
1943 return alc_cap_getput_caller(kcontrol, ucontrol,
1944 snd_hda_mixer_amp_volume_get);
1947 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1948 struct snd_ctl_elem_value *ucontrol)
1950 return alc_cap_getput_caller(kcontrol, ucontrol,
1951 snd_hda_mixer_amp_volume_put);
1954 /* capture mixer elements */
1955 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1957 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1958 struct snd_ctl_elem_value *ucontrol)
1960 return alc_cap_getput_caller(kcontrol, ucontrol,
1961 snd_hda_mixer_amp_switch_get);
1964 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1965 struct snd_ctl_elem_value *ucontrol)
1967 return alc_cap_getput_caller(kcontrol, ucontrol,
1968 snd_hda_mixer_amp_switch_put);
1971 #define _DEFINE_CAPMIX(num) \
1973 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1974 .name = "Capture Switch", \
1975 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1977 .info = alc_cap_sw_info, \
1978 .get = alc_cap_sw_get, \
1979 .put = alc_cap_sw_put, \
1982 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1983 .name = "Capture Volume", \
1984 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1985 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1986 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1988 .info = alc_cap_vol_info, \
1989 .get = alc_cap_vol_get, \
1990 .put = alc_cap_vol_put, \
1991 .tlv = { .c = alc_cap_vol_tlv }, \
1994 #define _DEFINE_CAPSRC(num) \
1996 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1997 /* .name = "Capture Source", */ \
1998 .name = "Input Source", \
2000 .info = alc_mux_enum_info, \
2001 .get = alc_mux_enum_get, \
2002 .put = alc_mux_enum_put, \
2005 #define DEFINE_CAPMIX(num) \
2006 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2007 _DEFINE_CAPMIX(num), \
2008 _DEFINE_CAPSRC(num), \
2012 #define DEFINE_CAPMIX_NOSRC(num) \
2013 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2014 _DEFINE_CAPMIX(num), \
2018 /* up to three ADCs */
2022 DEFINE_CAPMIX_NOSRC(1);
2023 DEFINE_CAPMIX_NOSRC(2);
2024 DEFINE_CAPMIX_NOSRC(3);
2027 * ALC880 5-stack model
2029 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2031 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2032 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2035 /* additional mixers to alc880_three_stack_mixer */
2036 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2037 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2038 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2042 /* channel source setting (6/8 channel selection for 5-stack) */
2044 static struct hda_verb alc880_fivestack_ch6_init[] = {
2045 /* set line-in to input, mute it */
2046 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2047 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2052 static struct hda_verb alc880_fivestack_ch8_init[] = {
2053 /* set line-in to output, unmute it */
2054 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2055 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2059 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2060 { 6, alc880_fivestack_ch6_init },
2061 { 8, alc880_fivestack_ch8_init },
2066 * ALC880 6-stack model
2068 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2069 * Side = 0x05 (0x0f)
2070 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2071 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2074 static hda_nid_t alc880_6st_dac_nids[4] = {
2075 /* front, rear, clfe, rear_surr */
2076 0x02, 0x03, 0x04, 0x05
2079 static struct hda_input_mux alc880_6stack_capture_source = {
2083 { "Front Mic", 0x1 },
2089 /* fixed 8-channels */
2090 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2094 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2095 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2096 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2097 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2098 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2099 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2100 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2101 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2102 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2103 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2104 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2105 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2106 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2107 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2108 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2109 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2110 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2111 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2112 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2114 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2115 .name = "Channel Mode",
2116 .info = alc_ch_mode_info,
2117 .get = alc_ch_mode_get,
2118 .put = alc_ch_mode_put,
2127 * W810 has rear IO for:
2130 * Center/LFE (DAC 04)
2133 * The system also has a pair of internal speakers, and a headphone jack.
2134 * These are both connected to Line2 on the codec, hence to DAC 02.
2136 * There is a variable resistor to control the speaker or headphone
2137 * volume. This is a hardware-only device without a software API.
2139 * Plugging headphones in will disable the internal speakers. This is
2140 * implemented in hardware, not via the driver using jack sense. In
2141 * a similar fashion, plugging into the rear socket marked "front" will
2142 * disable both the speakers and headphones.
2144 * For input, there's a microphone jack, and an "audio in" jack.
2145 * These may not do anything useful with this driver yet, because I
2146 * haven't setup any initialization verbs for these yet...
2149 static hda_nid_t alc880_w810_dac_nids[3] = {
2150 /* front, rear/surround, clfe */
2154 /* fixed 6 channels */
2155 static struct hda_channel_mode alc880_w810_modes[1] = {
2159 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2160 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2161 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2162 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2163 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2164 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2165 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2166 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2167 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2168 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2177 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2178 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2182 static hda_nid_t alc880_z71v_dac_nids[1] = {
2185 #define ALC880_Z71V_HP_DAC 0x03
2187 /* fixed 2 channels */
2188 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2192 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2193 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2194 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2195 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2196 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2206 * ALC880 F1734 model
2208 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2209 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2212 static hda_nid_t alc880_f1734_dac_nids[1] = {
2215 #define ALC880_F1734_HP_DAC 0x02
2217 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2218 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2219 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2220 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2221 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2222 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2223 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2224 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2229 static struct hda_input_mux alc880_f1734_capture_source = {
2241 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2242 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2243 * Mic = 0x18, Line = 0x1a
2246 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2247 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2249 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2250 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2251 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2252 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2253 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2254 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2255 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2256 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2257 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2258 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2259 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2260 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2261 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2263 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2265 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2266 .name = "Channel Mode",
2267 .info = alc_ch_mode_info,
2268 .get = alc_ch_mode_get,
2269 .put = alc_ch_mode_put,
2275 * ALC880 ASUS W1V model
2277 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2278 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2279 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2282 /* additional mixers to alc880_asus_mixer */
2283 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2284 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2285 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2290 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2292 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2293 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2294 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2295 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2298 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2299 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2304 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2305 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2306 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2307 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2308 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2309 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2310 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2311 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2312 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2315 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2316 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2319 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2320 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2322 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2323 .name = "Channel Mode",
2324 .info = alc_ch_mode_info,
2325 .get = alc_ch_mode_get,
2326 .put = alc_ch_mode_put,
2331 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2332 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2333 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2334 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2335 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2336 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2337 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2338 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2339 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2340 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2341 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2345 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2346 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2347 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2348 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2349 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2356 * virtual master controls
2360 * slave controls for virtual master
2362 static const char *alc_slave_vols[] = {
2363 "Front Playback Volume",
2364 "Surround Playback Volume",
2365 "Center Playback Volume",
2366 "LFE Playback Volume",
2367 "Side Playback Volume",
2368 "Headphone Playback Volume",
2369 "Speaker Playback Volume",
2370 "Mono Playback Volume",
2371 "Line-Out Playback Volume",
2372 "PCM Playback Volume",
2376 static const char *alc_slave_sws[] = {
2377 "Front Playback Switch",
2378 "Surround Playback Switch",
2379 "Center Playback Switch",
2380 "LFE Playback Switch",
2381 "Side Playback Switch",
2382 "Headphone Playback Switch",
2383 "Speaker Playback Switch",
2384 "Mono Playback Switch",
2385 "IEC958 Playback Switch",
2390 * build control elements
2393 static void alc_free_kctls(struct hda_codec *codec);
2395 /* additional beep mixers; the actual parameters are overwritten at build */
2396 static struct snd_kcontrol_new alc_beep_mixer[] = {
2397 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2398 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2402 static int alc_build_controls(struct hda_codec *codec)
2404 struct alc_spec *spec = codec->spec;
2408 for (i = 0; i < spec->num_mixers; i++) {
2409 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2413 if (spec->cap_mixer) {
2414 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2418 if (spec->multiout.dig_out_nid) {
2419 err = snd_hda_create_spdif_out_ctls(codec,
2420 spec->multiout.dig_out_nid);
2423 if (!spec->no_analog) {
2424 err = snd_hda_create_spdif_share_sw(codec,
2428 spec->multiout.share_spdif = 1;
2431 if (spec->dig_in_nid) {
2432 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2437 /* create beep controls if needed */
2438 if (spec->beep_amp) {
2439 struct snd_kcontrol_new *knew;
2440 for (knew = alc_beep_mixer; knew->name; knew++) {
2441 struct snd_kcontrol *kctl;
2442 kctl = snd_ctl_new1(knew, codec);
2445 kctl->private_value = spec->beep_amp;
2446 err = snd_hda_ctl_add(codec, kctl);
2452 /* if we have no master control, let's create it */
2453 if (!spec->no_analog &&
2454 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2455 unsigned int vmaster_tlv[4];
2456 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2457 HDA_OUTPUT, vmaster_tlv);
2458 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2459 vmaster_tlv, alc_slave_vols);
2463 if (!spec->no_analog &&
2464 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2465 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2466 NULL, alc_slave_sws);
2471 alc_free_kctls(codec); /* no longer needed */
2477 * initialize the codec volumes, etc
2481 * generic initialization of ADC, input mixers and output mixers
2483 static struct hda_verb alc880_volume_init_verbs[] = {
2485 * Unmute ADC0-2 and set the default input to mic-in
2487 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2489 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2491 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2494 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2496 * Note: PASD motherboards uses the Line In 2 as the input for front
2499 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2509 * Set up output mixers (0x0c - 0x0f)
2511 /* set vol=0 to output mixers */
2512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2515 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2516 /* set up input amps for analog loopback */
2517 /* Amp Indices: DAC = 0, mixer = 1 */
2518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2524 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2525 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2531 * 3-stack pin configuration:
2532 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2534 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2536 * preset connection lists of input pins
2537 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2539 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2540 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2541 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2544 * Set pin mode and muting
2546 /* set front pin widgets 0x14 for output */
2547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2549 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2550 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2551 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2552 /* Mic2 (as headphone out) for HP output */
2553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2554 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2555 /* Line In pin widget for input */
2556 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2557 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2558 /* Line2 (as front mic) pin widget for input and vref at 80% */
2559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2560 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2561 /* CD pin widget for input */
2562 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2568 * 5-stack pin configuration:
2569 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2570 * line-in/side = 0x1a, f-mic = 0x1b
2572 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2574 * preset connection lists of input pins
2575 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2577 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2578 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2581 * Set pin mode and muting
2583 /* set pin widgets 0x14-0x17 for output */
2584 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2586 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2587 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2588 /* unmute pins for output (no gain on this amp) */
2589 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2590 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2591 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2592 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2594 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2595 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2596 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2597 /* Mic2 (as headphone out) for HP output */
2598 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2599 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2600 /* Line In pin widget for input */
2601 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2602 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2603 /* Line2 (as front mic) pin widget for input and vref at 80% */
2604 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2605 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2606 /* CD pin widget for input */
2607 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2613 * W810 pin configuration:
2614 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2616 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2617 /* hphone/speaker input selector: front DAC */
2618 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2620 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2621 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2622 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2623 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2624 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2625 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2634 * Z71V pin configuration:
2635 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2637 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2638 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2639 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2640 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2643 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2644 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2645 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2646 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2652 * 6-stack pin configuration:
2653 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2654 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2656 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2657 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2660 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2663 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2664 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2665 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2666 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2668 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2669 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2670 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2671 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2672 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2673 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2674 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2675 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2676 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2682 * Uniwill pin configuration:
2683 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2686 static struct hda_verb alc880_uniwill_init_verbs[] = {
2687 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2690 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2693 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2694 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2695 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2696 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2698 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2699 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2700 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2701 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2702 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2704 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2705 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2706 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2707 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2708 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2709 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2710 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2711 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2712 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2714 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2715 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2722 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2724 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2725 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2727 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2728 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2731 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2732 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2734 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2738 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2741 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2744 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2745 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2747 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2748 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2753 static struct hda_verb alc880_beep_init_verbs[] = {
2754 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2758 /* auto-toggle front mic */
2759 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2761 unsigned int present;
2764 present = snd_hda_codec_read(codec, 0x18, 0,
2765 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2766 bits = present ? HDA_AMP_MUTE : 0;
2767 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2770 static void alc880_uniwill_setup(struct hda_codec *codec)
2772 struct alc_spec *spec = codec->spec;
2774 spec->autocfg.hp_pins[0] = 0x14;
2775 spec->autocfg.speaker_pins[0] = 0x15;
2776 spec->autocfg.speaker_pins[0] = 0x16;
2779 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2781 alc_automute_amp(codec);
2782 alc880_uniwill_mic_automute(codec);
2785 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2788 /* Looks like the unsol event is incompatible with the standard
2789 * definition. 4bit tag is placed at 28 bit!
2791 switch (res >> 28) {
2792 case ALC880_MIC_EVENT:
2793 alc880_uniwill_mic_automute(codec);
2796 alc_automute_amp_unsol_event(codec, res);
2801 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2803 struct alc_spec *spec = codec->spec;
2805 spec->autocfg.hp_pins[0] = 0x14;
2806 spec->autocfg.speaker_pins[0] = 0x15;
2809 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2811 unsigned int present;
2813 present = snd_hda_codec_read(codec, 0x21, 0,
2814 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2815 present &= HDA_AMP_VOLMASK;
2816 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2817 HDA_AMP_VOLMASK, present);
2818 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2819 HDA_AMP_VOLMASK, present);
2822 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2825 /* Looks like the unsol event is incompatible with the standard
2826 * definition. 4bit tag is placed at 28 bit!
2828 if ((res >> 28) == ALC880_DCVOL_EVENT)
2829 alc880_uniwill_p53_dcvol_automute(codec);
2831 alc_automute_amp_unsol_event(codec, res);
2835 * F1734 pin configuration:
2836 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2838 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2839 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2840 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2841 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2842 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2843 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2848 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2850 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2851 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2852 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2853 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2854 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2855 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2856 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2857 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2858 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2860 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2861 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2867 * ASUS pin configuration:
2868 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2870 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2871 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2872 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2873 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2874 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2876 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2877 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2878 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2880 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2881 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2882 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2883 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2885 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2886 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2887 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2888 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2889 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2890 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2891 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2892 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2893 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2898 /* Enable GPIO mask and set output */
2899 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2900 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2901 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2903 /* Clevo m520g init */
2904 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2905 /* headphone output */
2906 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2908 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2909 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2911 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2914 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2915 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2916 /* Mic1 (rear panel) */
2917 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2918 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2919 /* Mic2 (front panel) */
2920 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2921 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2923 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2924 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2925 /* change to EAPD mode */
2926 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2927 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2932 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2933 /* change to EAPD mode */
2934 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2935 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2937 /* Headphone output */
2938 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2940 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2941 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2943 /* Line In pin widget for input */
2944 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2945 /* CD pin widget for input */
2946 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2947 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2948 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2950 /* change to EAPD mode */
2951 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2952 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2958 * LG m1 express dual
2961 * Rear Line-In/Out (blue): 0x14
2962 * Build-in Mic-In: 0x15
2964 * HP-Out (green): 0x1b
2965 * Mic-In/Out (red): 0x19
2969 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2970 static hda_nid_t alc880_lg_dac_nids[3] = {
2974 /* seems analog CD is not working */
2975 static struct hda_input_mux alc880_lg_capture_source = {
2980 { "Internal Mic", 0x6 },
2984 /* 2,4,6 channel modes */
2985 static struct hda_verb alc880_lg_ch2_init[] = {
2986 /* set line-in and mic-in to input */
2987 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2988 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2992 static struct hda_verb alc880_lg_ch4_init[] = {
2993 /* set line-in to out and mic-in to input */
2994 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2995 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2999 static struct hda_verb alc880_lg_ch6_init[] = {
3000 /* set line-in and mic-in to output */
3001 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3002 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3006 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3007 { 2, alc880_lg_ch2_init },
3008 { 4, alc880_lg_ch4_init },
3009 { 6, alc880_lg_ch6_init },
3012 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3013 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3014 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3015 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3016 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3017 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3018 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3019 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3020 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3023 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3024 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3025 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3026 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3029 .name = "Channel Mode",
3030 .info = alc_ch_mode_info,
3031 .get = alc_ch_mode_get,
3032 .put = alc_ch_mode_put,
3037 static struct hda_verb alc880_lg_init_verbs[] = {
3038 /* set capture source to mic-in */
3039 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3040 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3041 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3042 /* mute all amp mixer inputs */
3043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3046 /* line-in to input */
3047 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3050 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3053 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3054 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3055 /* mic-in to input */
3056 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3057 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3058 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3060 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3064 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3068 /* toggle speaker-output according to the hp-jack state */
3069 static void alc880_lg_setup(struct hda_codec *codec)
3071 struct alc_spec *spec = codec->spec;
3073 spec->autocfg.hp_pins[0] = 0x1b;
3074 spec->autocfg.speaker_pins[0] = 0x17;
3083 * Built-in Mic-In: 0x19
3089 static struct hda_input_mux alc880_lg_lw_capture_source = {
3093 { "Internal Mic", 0x1 },
3098 #define alc880_lg_lw_modes alc880_threestack_modes
3100 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3101 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3102 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3103 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3104 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3105 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3106 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3107 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3108 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3109 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3110 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3113 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3114 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3116 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3117 .name = "Channel Mode",
3118 .info = alc_ch_mode_info,
3119 .get = alc_ch_mode_get,
3120 .put = alc_ch_mode_put,
3125 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3126 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3127 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3128 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3130 /* set capture source to mic-in */
3131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3132 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3133 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3136 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3137 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3139 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3140 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3141 /* mic-in to input */
3142 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3143 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3145 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3146 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3148 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3152 /* toggle speaker-output according to the hp-jack state */
3153 static void alc880_lg_lw_setup(struct hda_codec *codec)
3155 struct alc_spec *spec = codec->spec;
3157 spec->autocfg.hp_pins[0] = 0x1b;
3158 spec->autocfg.speaker_pins[0] = 0x14;
3161 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3162 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3163 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3166 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3167 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3171 static struct hda_input_mux alc880_medion_rim_capture_source = {
3175 { "Internal Mic", 0x1 },
3179 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3180 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3182 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3183 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3185 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3186 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3187 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3188 /* Mic2 (as headphone out) for HP output */
3189 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3190 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3191 /* Internal Speaker */
3192 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3193 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3195 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3196 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3198 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3202 /* toggle speaker-output according to the hp-jack state */
3203 static void alc880_medion_rim_automute(struct hda_codec *codec)
3205 struct alc_spec *spec = codec->spec;
3206 alc_automute_amp(codec);
3208 if (spec->jack_present)
3209 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3211 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3214 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3217 /* Looks like the unsol event is incompatible with the standard
3218 * definition. 4bit tag is placed at 28 bit!
3220 if ((res >> 28) == ALC880_HP_EVENT)
3221 alc880_medion_rim_automute(codec);
3224 static void alc880_medion_rim_setup(struct hda_codec *codec)
3226 struct alc_spec *spec = codec->spec;
3228 spec->autocfg.hp_pins[0] = 0x14;
3229 spec->autocfg.speaker_pins[0] = 0x1b;
3232 #ifdef CONFIG_SND_HDA_POWER_SAVE
3233 static struct hda_amp_list alc880_loopbacks[] = {
3234 { 0x0b, HDA_INPUT, 0 },
3235 { 0x0b, HDA_INPUT, 1 },
3236 { 0x0b, HDA_INPUT, 2 },
3237 { 0x0b, HDA_INPUT, 3 },
3238 { 0x0b, HDA_INPUT, 4 },
3242 static struct hda_amp_list alc880_lg_loopbacks[] = {
3243 { 0x0b, HDA_INPUT, 1 },
3244 { 0x0b, HDA_INPUT, 6 },
3245 { 0x0b, HDA_INPUT, 7 },
3254 static int alc_init(struct hda_codec *codec)
3256 struct alc_spec *spec = codec->spec;
3260 alc_auto_init_amp(codec, spec->init_amp);
3262 for (i = 0; i < spec->num_init_verbs; i++)
3263 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3265 if (spec->init_hook)
3266 spec->init_hook(codec);
3271 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3273 struct alc_spec *spec = codec->spec;
3275 if (spec->unsol_event)
3276 spec->unsol_event(codec, res);
3279 #ifdef CONFIG_SND_HDA_POWER_SAVE
3280 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3282 struct alc_spec *spec = codec->spec;
3283 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3288 * Analog playback callbacks
3290 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3291 struct hda_codec *codec,
3292 struct snd_pcm_substream *substream)
3294 struct alc_spec *spec = codec->spec;
3295 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3299 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3300 struct hda_codec *codec,
3301 unsigned int stream_tag,
3302 unsigned int format,
3303 struct snd_pcm_substream *substream)
3305 struct alc_spec *spec = codec->spec;
3306 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3307 stream_tag, format, substream);
3310 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3311 struct hda_codec *codec,
3312 struct snd_pcm_substream *substream)
3314 struct alc_spec *spec = codec->spec;
3315 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3321 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3322 struct hda_codec *codec,
3323 struct snd_pcm_substream *substream)
3325 struct alc_spec *spec = codec->spec;
3326 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3329 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3330 struct hda_codec *codec,
3331 unsigned int stream_tag,
3332 unsigned int format,
3333 struct snd_pcm_substream *substream)
3335 struct alc_spec *spec = codec->spec;
3336 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3337 stream_tag, format, substream);
3340 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3341 struct hda_codec *codec,
3342 struct snd_pcm_substream *substream)
3344 struct alc_spec *spec = codec->spec;
3345 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3348 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3349 struct hda_codec *codec,
3350 struct snd_pcm_substream *substream)
3352 struct alc_spec *spec = codec->spec;
3353 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3359 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3360 struct hda_codec *codec,
3361 unsigned int stream_tag,
3362 unsigned int format,
3363 struct snd_pcm_substream *substream)
3365 struct alc_spec *spec = codec->spec;
3367 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3368 stream_tag, 0, format);
3372 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3373 struct hda_codec *codec,
3374 struct snd_pcm_substream *substream)
3376 struct alc_spec *spec = codec->spec;
3378 snd_hda_codec_cleanup_stream(codec,
3379 spec->adc_nids[substream->number + 1]);
3386 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3390 /* NID is set in alc_build_pcms */
3392 .open = alc880_playback_pcm_open,
3393 .prepare = alc880_playback_pcm_prepare,
3394 .cleanup = alc880_playback_pcm_cleanup
3398 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3402 /* NID is set in alc_build_pcms */
3405 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3409 /* NID is set in alc_build_pcms */
3412 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3413 .substreams = 2, /* can be overridden */
3416 /* NID is set in alc_build_pcms */
3418 .prepare = alc880_alt_capture_pcm_prepare,
3419 .cleanup = alc880_alt_capture_pcm_cleanup
3423 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3427 /* NID is set in alc_build_pcms */
3429 .open = alc880_dig_playback_pcm_open,
3430 .close = alc880_dig_playback_pcm_close,
3431 .prepare = alc880_dig_playback_pcm_prepare,
3432 .cleanup = alc880_dig_playback_pcm_cleanup
3436 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3440 /* NID is set in alc_build_pcms */
3443 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3444 static struct hda_pcm_stream alc_pcm_null_stream = {
3450 static int alc_build_pcms(struct hda_codec *codec)
3452 struct alc_spec *spec = codec->spec;
3453 struct hda_pcm *info = spec->pcm_rec;
3456 codec->num_pcms = 1;
3457 codec->pcm_info = info;
3459 if (spec->no_analog)
3462 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3463 "%s Analog", codec->chip_name);
3464 info->name = spec->stream_name_analog;
3466 if (spec->stream_analog_playback) {
3467 if (snd_BUG_ON(!spec->multiout.dac_nids))
3469 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3470 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3472 if (spec->stream_analog_capture) {
3473 if (snd_BUG_ON(!spec->adc_nids))
3475 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3476 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3479 if (spec->channel_mode) {
3480 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3481 for (i = 0; i < spec->num_channel_mode; i++) {
3482 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3483 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3489 /* SPDIF for stream index #1 */
3490 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3491 snprintf(spec->stream_name_digital,
3492 sizeof(spec->stream_name_digital),
3493 "%s Digital", codec->chip_name);
3494 codec->num_pcms = 2;
3495 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3496 info = spec->pcm_rec + 1;
3497 info->name = spec->stream_name_digital;
3498 if (spec->dig_out_type)
3499 info->pcm_type = spec->dig_out_type;
3501 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3502 if (spec->multiout.dig_out_nid &&
3503 spec->stream_digital_playback) {
3504 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3505 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3507 if (spec->dig_in_nid &&
3508 spec->stream_digital_capture) {
3509 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3510 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3512 /* FIXME: do we need this for all Realtek codec models? */
3513 codec->spdif_status_reset = 1;
3516 if (spec->no_analog)
3519 /* If the use of more than one ADC is requested for the current
3520 * model, configure a second analog capture-only PCM.
3522 /* Additional Analaog capture for index #2 */
3523 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3524 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3525 codec->num_pcms = 3;
3526 info = spec->pcm_rec + 2;
3527 info->name = spec->stream_name_analog;
3528 if (spec->alt_dac_nid) {
3529 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3530 *spec->stream_analog_alt_playback;
3531 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3534 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3535 alc_pcm_null_stream;
3536 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3538 if (spec->num_adc_nids > 1) {
3539 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3540 *spec->stream_analog_alt_capture;
3541 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3543 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3544 spec->num_adc_nids - 1;
3546 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3547 alc_pcm_null_stream;
3548 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3555 static void alc_free_kctls(struct hda_codec *codec)
3557 struct alc_spec *spec = codec->spec;
3559 if (spec->kctls.list) {
3560 struct snd_kcontrol_new *kctl = spec->kctls.list;
3562 for (i = 0; i < spec->kctls.used; i++)
3563 kfree(kctl[i].name);
3565 snd_array_free(&spec->kctls);
3568 static void alc_free(struct hda_codec *codec)
3570 struct alc_spec *spec = codec->spec;
3575 alc_free_kctls(codec);
3577 snd_hda_detach_beep_device(codec);
3580 #ifdef SND_HDA_NEEDS_RESUME
3581 static int alc_resume(struct hda_codec *codec)
3583 codec->patch_ops.init(codec);
3584 snd_hda_codec_resume_amp(codec);
3585 snd_hda_codec_resume_cache(codec);
3592 static struct hda_codec_ops alc_patch_ops = {
3593 .build_controls = alc_build_controls,
3594 .build_pcms = alc_build_pcms,
3597 .unsol_event = alc_unsol_event,
3598 #ifdef SND_HDA_NEEDS_RESUME
3599 .resume = alc_resume,
3601 #ifdef CONFIG_SND_HDA_POWER_SAVE
3602 .check_power_status = alc_check_power_status,
3608 * Test configuration for debugging
3610 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3613 #ifdef CONFIG_SND_DEBUG
3614 static hda_nid_t alc880_test_dac_nids[4] = {
3615 0x02, 0x03, 0x04, 0x05
3618 static struct hda_input_mux alc880_test_capture_source = {
3627 { "Surround", 0x6 },
3631 static struct hda_channel_mode alc880_test_modes[4] = {
3638 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3639 struct snd_ctl_elem_info *uinfo)
3641 static char *texts[] = {
3642 "N/A", "Line Out", "HP Out",
3643 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3645 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3647 uinfo->value.enumerated.items = 8;
3648 if (uinfo->value.enumerated.item >= 8)
3649 uinfo->value.enumerated.item = 7;
3650 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3654 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3655 struct snd_ctl_elem_value *ucontrol)
3657 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3658 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3659 unsigned int pin_ctl, item = 0;
3661 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3662 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3663 if (pin_ctl & AC_PINCTL_OUT_EN) {
3664 if (pin_ctl & AC_PINCTL_HP_EN)
3668 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3669 switch (pin_ctl & AC_PINCTL_VREFEN) {
3670 case AC_PINCTL_VREF_HIZ: item = 3; break;
3671 case AC_PINCTL_VREF_50: item = 4; break;
3672 case AC_PINCTL_VREF_GRD: item = 5; break;
3673 case AC_PINCTL_VREF_80: item = 6; break;
3674 case AC_PINCTL_VREF_100: item = 7; break;
3677 ucontrol->value.enumerated.item[0] = item;
3681 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3682 struct snd_ctl_elem_value *ucontrol)
3684 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3685 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3686 static unsigned int ctls[] = {
3687 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3688 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3689 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3690 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3691 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3692 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3694 unsigned int old_ctl, new_ctl;
3696 old_ctl = snd_hda_codec_read(codec, nid, 0,
3697 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3698 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3699 if (old_ctl != new_ctl) {
3701 snd_hda_codec_write_cache(codec, nid, 0,
3702 AC_VERB_SET_PIN_WIDGET_CONTROL,
3704 val = ucontrol->value.enumerated.item[0] >= 3 ?
3706 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3713 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3714 struct snd_ctl_elem_info *uinfo)
3716 static char *texts[] = {
3717 "Front", "Surround", "CLFE", "Side"
3719 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3721 uinfo->value.enumerated.items = 4;
3722 if (uinfo->value.enumerated.item >= 4)
3723 uinfo->value.enumerated.item = 3;
3724 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3728 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3729 struct snd_ctl_elem_value *ucontrol)
3731 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3732 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3735 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3736 ucontrol->value.enumerated.item[0] = sel & 3;
3740 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3741 struct snd_ctl_elem_value *ucontrol)
3743 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3744 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3747 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3748 if (ucontrol->value.enumerated.item[0] != sel) {
3749 sel = ucontrol->value.enumerated.item[0] & 3;
3750 snd_hda_codec_write_cache(codec, nid, 0,
3751 AC_VERB_SET_CONNECT_SEL, sel);
3757 #define PIN_CTL_TEST(xname,nid) { \
3758 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3760 .info = alc_test_pin_ctl_info, \
3761 .get = alc_test_pin_ctl_get, \
3762 .put = alc_test_pin_ctl_put, \
3763 .private_value = nid \
3766 #define PIN_SRC_TEST(xname,nid) { \
3767 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3769 .info = alc_test_pin_src_info, \
3770 .get = alc_test_pin_src_get, \
3771 .put = alc_test_pin_src_put, \
3772 .private_value = nid \
3775 static struct snd_kcontrol_new alc880_test_mixer[] = {
3776 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3777 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3778 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3779 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3780 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3781 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3782 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3783 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3784 PIN_CTL_TEST("Front Pin Mode", 0x14),
3785 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3786 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3787 PIN_CTL_TEST("Side Pin Mode", 0x17),
3788 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3789 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3790 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3791 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3792 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3793 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3794 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3795 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3796 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3797 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3798 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3799 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3800 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3801 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3802 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3803 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3804 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3805 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3808 .name = "Channel Mode",
3809 .info = alc_ch_mode_info,
3810 .get = alc_ch_mode_get,
3811 .put = alc_ch_mode_put,
3816 static struct hda_verb alc880_test_init_verbs[] = {
3817 /* Unmute inputs of 0x0c - 0x0f */
3818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3820 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3821 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3822 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3823 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3824 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3825 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3826 /* Vol output for 0x0c-0x0f */
3827 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3828 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3829 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3830 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3831 /* Set output pins 0x14-0x17 */
3832 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3834 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3835 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3836 /* Unmute output pins 0x14-0x17 */
3837 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3839 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3840 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3841 /* Set input pins 0x18-0x1c */
3842 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3843 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3844 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3845 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3846 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3847 /* Mute input pins 0x18-0x1b */
3848 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3849 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3850 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3851 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3854 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3856 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3857 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3858 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3859 /* Analog input/passthru */
3860 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3861 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3862 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3863 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3864 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3872 static const char *alc880_models[ALC880_MODEL_LAST] = {
3873 [ALC880_3ST] = "3stack",
3874 [ALC880_TCL_S700] = "tcl",
3875 [ALC880_3ST_DIG] = "3stack-digout",
3876 [ALC880_CLEVO] = "clevo",
3877 [ALC880_5ST] = "5stack",
3878 [ALC880_5ST_DIG] = "5stack-digout",
3879 [ALC880_W810] = "w810",
3880 [ALC880_Z71V] = "z71v",
3881 [ALC880_6ST] = "6stack",
3882 [ALC880_6ST_DIG] = "6stack-digout",
3883 [ALC880_ASUS] = "asus",
3884 [ALC880_ASUS_W1V] = "asus-w1v",
3885 [ALC880_ASUS_DIG] = "asus-dig",
3886 [ALC880_ASUS_DIG2] = "asus-dig2",
3887 [ALC880_UNIWILL_DIG] = "uniwill",
3888 [ALC880_UNIWILL_P53] = "uniwill-p53",
3889 [ALC880_FUJITSU] = "fujitsu",
3890 [ALC880_F1734] = "F1734",
3892 [ALC880_LG_LW] = "lg-lw",
3893 [ALC880_MEDION_RIM] = "medion",
3894 #ifdef CONFIG_SND_DEBUG
3895 [ALC880_TEST] = "test",
3897 [ALC880_AUTO] = "auto",
3900 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3901 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3902 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3903 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3904 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3905 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3906 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3907 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3908 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3909 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3910 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3911 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3912 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3913 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3914 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3915 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3916 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3917 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3918 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3919 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3920 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3921 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3922 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3923 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3924 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3925 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3926 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3927 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3928 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3929 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3930 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3931 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3932 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3933 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3934 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3935 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3936 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3937 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3938 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3939 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3940 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3941 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3942 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3943 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3944 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3945 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3946 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3947 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3948 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3949 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3950 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3951 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3952 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3953 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3954 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3955 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3956 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3957 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3958 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3959 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3960 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3961 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3962 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3963 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3964 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3965 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3966 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3967 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3968 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3970 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3971 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3972 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3977 * ALC880 codec presets
3979 static struct alc_config_preset alc880_presets[] = {
3981 .mixers = { alc880_three_stack_mixer },
3982 .init_verbs = { alc880_volume_init_verbs,
3983 alc880_pin_3stack_init_verbs },
3984 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3985 .dac_nids = alc880_dac_nids,
3986 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3987 .channel_mode = alc880_threestack_modes,
3989 .input_mux = &alc880_capture_source,
3991 [ALC880_3ST_DIG] = {
3992 .mixers = { alc880_three_stack_mixer },
3993 .init_verbs = { alc880_volume_init_verbs,
3994 alc880_pin_3stack_init_verbs },
3995 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3996 .dac_nids = alc880_dac_nids,
3997 .dig_out_nid = ALC880_DIGOUT_NID,
3998 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3999 .channel_mode = alc880_threestack_modes,
4001 .input_mux = &alc880_capture_source,
4003 [ALC880_TCL_S700] = {
4004 .mixers = { alc880_tcl_s700_mixer },
4005 .init_verbs = { alc880_volume_init_verbs,
4006 alc880_pin_tcl_S700_init_verbs,
4007 alc880_gpio2_init_verbs },
4008 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4009 .dac_nids = alc880_dac_nids,
4010 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4011 .num_adc_nids = 1, /* single ADC */
4013 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4014 .channel_mode = alc880_2_jack_modes,
4015 .input_mux = &alc880_capture_source,
4018 .mixers = { alc880_three_stack_mixer,
4019 alc880_five_stack_mixer},
4020 .init_verbs = { alc880_volume_init_verbs,
4021 alc880_pin_5stack_init_verbs },
4022 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4023 .dac_nids = alc880_dac_nids,
4024 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4025 .channel_mode = alc880_fivestack_modes,
4026 .input_mux = &alc880_capture_source,
4028 [ALC880_5ST_DIG] = {
4029 .mixers = { alc880_three_stack_mixer,
4030 alc880_five_stack_mixer },
4031 .init_verbs = { alc880_volume_init_verbs,
4032 alc880_pin_5stack_init_verbs },
4033 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4034 .dac_nids = alc880_dac_nids,
4035 .dig_out_nid = ALC880_DIGOUT_NID,
4036 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4037 .channel_mode = alc880_fivestack_modes,
4038 .input_mux = &alc880_capture_source,
4041 .mixers = { alc880_six_stack_mixer },
4042 .init_verbs = { alc880_volume_init_verbs,
4043 alc880_pin_6stack_init_verbs },
4044 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4045 .dac_nids = alc880_6st_dac_nids,
4046 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4047 .channel_mode = alc880_sixstack_modes,
4048 .input_mux = &alc880_6stack_capture_source,
4050 [ALC880_6ST_DIG] = {
4051 .mixers = { alc880_six_stack_mixer },
4052 .init_verbs = { alc880_volume_init_verbs,
4053 alc880_pin_6stack_init_verbs },
4054 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4055 .dac_nids = alc880_6st_dac_nids,
4056 .dig_out_nid = ALC880_DIGOUT_NID,
4057 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4058 .channel_mode = alc880_sixstack_modes,
4059 .input_mux = &alc880_6stack_capture_source,
4062 .mixers = { alc880_w810_base_mixer },
4063 .init_verbs = { alc880_volume_init_verbs,
4064 alc880_pin_w810_init_verbs,
4065 alc880_gpio2_init_verbs },
4066 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4067 .dac_nids = alc880_w810_dac_nids,
4068 .dig_out_nid = ALC880_DIGOUT_NID,
4069 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4070 .channel_mode = alc880_w810_modes,
4071 .input_mux = &alc880_capture_source,
4074 .mixers = { alc880_z71v_mixer },
4075 .init_verbs = { alc880_volume_init_verbs,
4076 alc880_pin_z71v_init_verbs },
4077 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4078 .dac_nids = alc880_z71v_dac_nids,
4079 .dig_out_nid = ALC880_DIGOUT_NID,
4081 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4082 .channel_mode = alc880_2_jack_modes,
4083 .input_mux = &alc880_capture_source,
4086 .mixers = { alc880_f1734_mixer },
4087 .init_verbs = { alc880_volume_init_verbs,
4088 alc880_pin_f1734_init_verbs },
4089 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4090 .dac_nids = alc880_f1734_dac_nids,
4092 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4093 .channel_mode = alc880_2_jack_modes,
4094 .input_mux = &alc880_f1734_capture_source,
4095 .unsol_event = alc880_uniwill_p53_unsol_event,
4096 .setup = alc880_uniwill_p53_setup,
4097 .init_hook = alc_automute_amp,
4100 .mixers = { alc880_asus_mixer },
4101 .init_verbs = { alc880_volume_init_verbs,
4102 alc880_pin_asus_init_verbs,
4103 alc880_gpio1_init_verbs },
4104 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4105 .dac_nids = alc880_asus_dac_nids,
4106 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4107 .channel_mode = alc880_asus_modes,
4109 .input_mux = &alc880_capture_source,
4111 [ALC880_ASUS_DIG] = {
4112 .mixers = { alc880_asus_mixer },
4113 .init_verbs = { alc880_volume_init_verbs,
4114 alc880_pin_asus_init_verbs,
4115 alc880_gpio1_init_verbs },
4116 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4117 .dac_nids = alc880_asus_dac_nids,
4118 .dig_out_nid = ALC880_DIGOUT_NID,
4119 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4120 .channel_mode = alc880_asus_modes,
4122 .input_mux = &alc880_capture_source,
4124 [ALC880_ASUS_DIG2] = {
4125 .mixers = { alc880_asus_mixer },
4126 .init_verbs = { alc880_volume_init_verbs,
4127 alc880_pin_asus_init_verbs,
4128 alc880_gpio2_init_verbs }, /* use GPIO2 */
4129 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4130 .dac_nids = alc880_asus_dac_nids,
4131 .dig_out_nid = ALC880_DIGOUT_NID,
4132 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4133 .channel_mode = alc880_asus_modes,
4135 .input_mux = &alc880_capture_source,
4137 [ALC880_ASUS_W1V] = {
4138 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4139 .init_verbs = { alc880_volume_init_verbs,
4140 alc880_pin_asus_init_verbs,
4141 alc880_gpio1_init_verbs },
4142 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4143 .dac_nids = alc880_asus_dac_nids,
4144 .dig_out_nid = ALC880_DIGOUT_NID,
4145 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4146 .channel_mode = alc880_asus_modes,
4148 .input_mux = &alc880_capture_source,
4150 [ALC880_UNIWILL_DIG] = {
4151 .mixers = { alc880_asus_mixer },
4152 .init_verbs = { alc880_volume_init_verbs,
4153 alc880_pin_asus_init_verbs },
4154 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4155 .dac_nids = alc880_asus_dac_nids,
4156 .dig_out_nid = ALC880_DIGOUT_NID,
4157 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4158 .channel_mode = alc880_asus_modes,
4160 .input_mux = &alc880_capture_source,
4162 [ALC880_UNIWILL] = {
4163 .mixers = { alc880_uniwill_mixer },
4164 .init_verbs = { alc880_volume_init_verbs,
4165 alc880_uniwill_init_verbs },
4166 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4167 .dac_nids = alc880_asus_dac_nids,
4168 .dig_out_nid = ALC880_DIGOUT_NID,
4169 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4170 .channel_mode = alc880_threestack_modes,
4172 .input_mux = &alc880_capture_source,
4173 .unsol_event = alc880_uniwill_unsol_event,
4174 .setup = alc880_uniwill_setup,
4175 .init_hook = alc880_uniwill_init_hook,
4177 [ALC880_UNIWILL_P53] = {
4178 .mixers = { alc880_uniwill_p53_mixer },
4179 .init_verbs = { alc880_volume_init_verbs,
4180 alc880_uniwill_p53_init_verbs },
4181 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4182 .dac_nids = alc880_asus_dac_nids,
4183 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4184 .channel_mode = alc880_threestack_modes,
4185 .input_mux = &alc880_capture_source,
4186 .unsol_event = alc880_uniwill_p53_unsol_event,
4187 .setup = alc880_uniwill_p53_setup,
4188 .init_hook = alc_automute_amp,
4190 [ALC880_FUJITSU] = {
4191 .mixers = { alc880_fujitsu_mixer },
4192 .init_verbs = { alc880_volume_init_verbs,
4193 alc880_uniwill_p53_init_verbs,
4194 alc880_beep_init_verbs },
4195 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4196 .dac_nids = alc880_dac_nids,
4197 .dig_out_nid = ALC880_DIGOUT_NID,
4198 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4199 .channel_mode = alc880_2_jack_modes,
4200 .input_mux = &alc880_capture_source,
4201 .unsol_event = alc880_uniwill_p53_unsol_event,
4202 .setup = alc880_uniwill_p53_setup,
4203 .init_hook = alc_automute_amp,
4206 .mixers = { alc880_three_stack_mixer },
4207 .init_verbs = { alc880_volume_init_verbs,
4208 alc880_pin_clevo_init_verbs },
4209 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4210 .dac_nids = alc880_dac_nids,
4212 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4213 .channel_mode = alc880_threestack_modes,
4215 .input_mux = &alc880_capture_source,
4218 .mixers = { alc880_lg_mixer },
4219 .init_verbs = { alc880_volume_init_verbs,
4220 alc880_lg_init_verbs },
4221 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4222 .dac_nids = alc880_lg_dac_nids,
4223 .dig_out_nid = ALC880_DIGOUT_NID,
4224 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4225 .channel_mode = alc880_lg_ch_modes,
4227 .input_mux = &alc880_lg_capture_source,
4228 .unsol_event = alc_automute_amp_unsol_event,
4229 .setup = alc880_lg_setup,
4230 .init_hook = alc_automute_amp,
4231 #ifdef CONFIG_SND_HDA_POWER_SAVE
4232 .loopbacks = alc880_lg_loopbacks,
4236 .mixers = { alc880_lg_lw_mixer },
4237 .init_verbs = { alc880_volume_init_verbs,
4238 alc880_lg_lw_init_verbs },
4239 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4240 .dac_nids = alc880_dac_nids,
4241 .dig_out_nid = ALC880_DIGOUT_NID,
4242 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4243 .channel_mode = alc880_lg_lw_modes,
4244 .input_mux = &alc880_lg_lw_capture_source,
4245 .unsol_event = alc_automute_amp_unsol_event,
4246 .setup = alc880_lg_lw_setup,
4247 .init_hook = alc_automute_amp,
4249 [ALC880_MEDION_RIM] = {
4250 .mixers = { alc880_medion_rim_mixer },
4251 .init_verbs = { alc880_volume_init_verbs,
4252 alc880_medion_rim_init_verbs,
4253 alc_gpio2_init_verbs },
4254 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4255 .dac_nids = alc880_dac_nids,
4256 .dig_out_nid = ALC880_DIGOUT_NID,
4257 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4258 .channel_mode = alc880_2_jack_modes,
4259 .input_mux = &alc880_medion_rim_capture_source,
4260 .unsol_event = alc880_medion_rim_unsol_event,
4261 .setup = alc880_medion_rim_setup,
4262 .init_hook = alc880_medion_rim_automute,
4264 #ifdef CONFIG_SND_DEBUG
4266 .mixers = { alc880_test_mixer },
4267 .init_verbs = { alc880_test_init_verbs },
4268 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4269 .dac_nids = alc880_test_dac_nids,
4270 .dig_out_nid = ALC880_DIGOUT_NID,
4271 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4272 .channel_mode = alc880_test_modes,
4273 .input_mux = &alc880_test_capture_source,
4279 * Automatic parse of I/O pins from the BIOS configuration
4284 ALC_CTL_WIDGET_MUTE,
4287 static struct snd_kcontrol_new alc880_control_templates[] = {
4288 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4289 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4290 HDA_BIND_MUTE(NULL, 0, 0, 0),
4293 /* add dynamic controls */
4294 static int add_control(struct alc_spec *spec, int type, const char *name,
4297 struct snd_kcontrol_new *knew;
4299 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4300 knew = snd_array_new(&spec->kctls);
4303 *knew = alc880_control_templates[type];
4304 knew->name = kstrdup(name, GFP_KERNEL);
4307 knew->private_value = val;
4311 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4312 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4313 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4314 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4315 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4316 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4317 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4318 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4319 #define ALC880_PIN_CD_NID 0x1c
4321 /* fill in the dac_nids table from the parsed pin configuration */
4322 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4323 const struct auto_pin_cfg *cfg)
4329 memset(assigned, 0, sizeof(assigned));
4330 spec->multiout.dac_nids = spec->private_dac_nids;
4332 /* check the pins hardwired to audio widget */
4333 for (i = 0; i < cfg->line_outs; i++) {
4334 nid = cfg->line_out_pins[i];
4335 if (alc880_is_fixed_pin(nid)) {
4336 int idx = alc880_fixed_pin_idx(nid);
4337 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4341 /* left pins can be connect to any audio widget */
4342 for (i = 0; i < cfg->line_outs; i++) {
4343 nid = cfg->line_out_pins[i];
4344 if (alc880_is_fixed_pin(nid))
4346 /* search for an empty channel */
4347 for (j = 0; j < cfg->line_outs; j++) {
4349 spec->multiout.dac_nids[i] =
4350 alc880_idx_to_dac(j);
4356 spec->multiout.num_dacs = cfg->line_outs;
4360 /* add playback controls from the parsed DAC table */
4361 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4362 const struct auto_pin_cfg *cfg)
4365 static const char *chname[4] = {
4366 "Front", "Surround", NULL /*CLFE*/, "Side"
4371 for (i = 0; i < cfg->line_outs; i++) {
4372 if (!spec->multiout.dac_nids[i])
4374 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4377 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4378 "Center Playback Volume",
4379 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4383 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4384 "LFE Playback Volume",
4385 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4389 err = add_control(spec, ALC_CTL_BIND_MUTE,
4390 "Center Playback Switch",
4391 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4395 err = add_control(spec, ALC_CTL_BIND_MUTE,
4396 "LFE Playback Switch",
4397 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4403 if (cfg->line_outs == 1 &&
4404 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4408 sprintf(name, "%s Playback Volume", pfx);
4409 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4410 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4414 sprintf(name, "%s Playback Switch", pfx);
4415 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4416 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4425 /* add playback controls for speaker and HP outputs */
4426 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4436 if (alc880_is_fixed_pin(pin)) {
4437 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4438 /* specify the DAC as the extra output */
4439 if (!spec->multiout.hp_nid)
4440 spec->multiout.hp_nid = nid;
4442 spec->multiout.extra_out_nid[0] = nid;
4443 /* control HP volume/switch on the output mixer amp */
4444 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4445 sprintf(name, "%s Playback Volume", pfx);
4446 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4447 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4450 sprintf(name, "%s Playback Switch", pfx);
4451 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4452 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4455 } else if (alc880_is_multi_pin(pin)) {
4456 /* set manual connection */
4457 /* we have only a switch on HP-out PIN */
4458 sprintf(name, "%s Playback Switch", pfx);
4459 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4460 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4467 /* create input playback/capture controls for the given pin */
4468 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4469 const char *ctlname,
4470 int idx, hda_nid_t mix_nid)
4475 sprintf(name, "%s Playback Volume", ctlname);
4476 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4477 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4480 sprintf(name, "%s Playback Switch", ctlname);
4481 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4482 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4488 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4490 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4491 return (pincap & AC_PINCAP_IN) != 0;
4494 /* create playback/capture controls for input pins */
4495 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4496 const struct auto_pin_cfg *cfg,
4498 hda_nid_t cap1, hda_nid_t cap2)
4500 struct alc_spec *spec = codec->spec;
4501 struct hda_input_mux *imux = &spec->private_imux[0];
4504 for (i = 0; i < AUTO_PIN_LAST; i++) {
4507 pin = cfg->input_pins[i];
4508 if (!alc_is_input_pin(codec, pin))
4512 idx = get_connection_index(codec, mixer, pin);
4514 err = new_analog_input(spec, pin,
4515 auto_pin_cfg_labels[i],
4524 idx = get_connection_index(codec, cap1, pin);
4525 if (idx < 0 && cap2)
4526 idx = get_connection_index(codec, cap2, pin);
4528 imux->items[imux->num_items].label =
4529 auto_pin_cfg_labels[i];
4530 imux->items[imux->num_items].index = idx;
4537 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4538 const struct auto_pin_cfg *cfg)
4540 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4543 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4544 unsigned int pin_type)
4546 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4549 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4553 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4554 hda_nid_t nid, int pin_type,
4557 alc_set_pin_output(codec, nid, pin_type);
4558 /* need the manual connection? */
4559 if (alc880_is_multi_pin(nid)) {
4560 struct alc_spec *spec = codec->spec;
4561 int idx = alc880_multi_pin_idx(nid);
4562 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4563 AC_VERB_SET_CONNECT_SEL,
4564 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4568 static int get_pin_type(int line_out_type)
4570 if (line_out_type == AUTO_PIN_HP_OUT)
4576 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4578 struct alc_spec *spec = codec->spec;
4581 for (i = 0; i < spec->autocfg.line_outs; i++) {
4582 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4583 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4584 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4588 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4590 struct alc_spec *spec = codec->spec;
4593 pin = spec->autocfg.speaker_pins[0];
4594 if (pin) /* connect to front */
4595 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4596 pin = spec->autocfg.hp_pins[0];
4597 if (pin) /* connect to front */
4598 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4601 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4603 struct alc_spec *spec = codec->spec;
4606 for (i = 0; i < AUTO_PIN_LAST; i++) {
4607 hda_nid_t nid = spec->autocfg.input_pins[i];
4608 if (alc_is_input_pin(codec, nid)) {
4609 alc_set_input_pin(codec, nid, i);
4610 if (nid != ALC880_PIN_CD_NID &&
4611 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4612 snd_hda_codec_write(codec, nid, 0,
4613 AC_VERB_SET_AMP_GAIN_MUTE,
4619 /* parse the BIOS configuration and set up the alc_spec */
4620 /* return 1 if successful, 0 if the proper config is not found,
4621 * or a negative error code
4623 static int alc880_parse_auto_config(struct hda_codec *codec)
4625 struct alc_spec *spec = codec->spec;
4627 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4629 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4633 if (!spec->autocfg.line_outs)
4634 return 0; /* can't find valid BIOS pin config */
4636 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4639 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4642 err = alc880_auto_create_extra_out(spec,
4643 spec->autocfg.speaker_pins[0],
4647 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4651 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4655 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4657 /* check multiple SPDIF-out (for recent codecs) */
4658 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4660 err = snd_hda_get_connections(codec,
4661 spec->autocfg.dig_out_pins[i],
4666 spec->multiout.dig_out_nid = dig_nid;
4668 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4669 spec->slave_dig_outs[i - 1] = dig_nid;
4670 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4674 if (spec->autocfg.dig_in_pin)
4675 spec->dig_in_nid = ALC880_DIGIN_NID;
4677 if (spec->kctls.list)
4678 add_mixer(spec, spec->kctls.list);
4680 add_verb(spec, alc880_volume_init_verbs);
4682 spec->num_mux_defs = 1;
4683 spec->input_mux = &spec->private_imux[0];
4685 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4690 /* additional initialization for auto-configuration model */
4691 static void alc880_auto_init(struct hda_codec *codec)
4693 struct alc_spec *spec = codec->spec;
4694 alc880_auto_init_multi_out(codec);
4695 alc880_auto_init_extra_out(codec);
4696 alc880_auto_init_analog_input(codec);
4697 if (spec->unsol_event)
4698 alc_inithook(codec);
4701 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4702 * one of two digital mic pins, e.g. on ALC272
4704 static void fixup_automic_adc(struct hda_codec *codec)
4706 struct alc_spec *spec = codec->spec;
4709 for (i = 0; i < spec->num_adc_nids; i++) {
4710 hda_nid_t cap = spec->capsrc_nids ?
4711 spec->capsrc_nids[i] : spec->adc_nids[i];
4714 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4717 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4720 spec->int_mic.mux_idx = iidx;
4721 spec->ext_mic.mux_idx = eidx;
4722 if (spec->capsrc_nids)
4723 spec->capsrc_nids += i;
4724 spec->adc_nids += i;
4725 spec->num_adc_nids = 1;
4728 snd_printd(KERN_INFO "hda_codec: %s: "
4729 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4730 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4731 spec->auto_mic = 0; /* disable auto-mic to be sure */
4734 static void set_capture_mixer(struct hda_codec *codec)
4736 struct alc_spec *spec = codec->spec;
4737 static struct snd_kcontrol_new *caps[2][3] = {
4738 { alc_capture_mixer_nosrc1,
4739 alc_capture_mixer_nosrc2,
4740 alc_capture_mixer_nosrc3 },
4741 { alc_capture_mixer1,
4743 alc_capture_mixer3 },
4745 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4747 if (spec->auto_mic) {
4749 fixup_automic_adc(codec);
4750 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4754 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4758 #define set_beep_amp(spec, nid, idx, dir) \
4759 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4762 * OK, here we have finally the patch for ALC880
4765 static int patch_alc880(struct hda_codec *codec)
4767 struct alc_spec *spec;
4771 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4777 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4780 if (board_config < 0) {
4781 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4783 board_config = ALC880_AUTO;
4786 if (board_config == ALC880_AUTO) {
4787 /* automatic parse from the BIOS config */
4788 err = alc880_parse_auto_config(codec);
4794 "hda_codec: Cannot set up configuration "
4795 "from BIOS. Using 3-stack mode...\n");
4796 board_config = ALC880_3ST;
4800 err = snd_hda_attach_beep_device(codec, 0x1);
4806 if (board_config != ALC880_AUTO)
4807 setup_preset(codec, &alc880_presets[board_config]);
4809 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4810 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4811 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4813 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4814 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4816 if (!spec->adc_nids && spec->input_mux) {
4817 /* check whether NID 0x07 is valid */
4818 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4820 wcap = get_wcaps_type(wcap);
4821 if (wcap != AC_WID_AUD_IN) {
4822 spec->adc_nids = alc880_adc_nids_alt;
4823 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4825 spec->adc_nids = alc880_adc_nids;
4826 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4829 set_capture_mixer(codec);
4830 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4832 spec->vmaster_nid = 0x0c;
4834 codec->patch_ops = alc_patch_ops;
4835 if (board_config == ALC880_AUTO)
4836 spec->init_hook = alc880_auto_init;
4837 #ifdef CONFIG_SND_HDA_POWER_SAVE
4838 if (!spec->loopback.amplist)
4839 spec->loopback.amplist = alc880_loopbacks;
4841 codec->proc_widget_hook = print_realtek_coef;
4851 static hda_nid_t alc260_dac_nids[1] = {
4856 static hda_nid_t alc260_adc_nids[1] = {
4861 static hda_nid_t alc260_adc_nids_alt[1] = {
4866 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4867 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4869 static hda_nid_t alc260_dual_adc_nids[2] = {
4874 #define ALC260_DIGOUT_NID 0x03
4875 #define ALC260_DIGIN_NID 0x06
4877 static struct hda_input_mux alc260_capture_source = {
4881 { "Front Mic", 0x1 },
4887 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4888 * headphone jack and the internal CD lines since these are the only pins at
4889 * which audio can appear. For flexibility, also allow the option of
4890 * recording the mixer output on the second ADC (ADC0 doesn't have a
4891 * connection to the mixer output).
4893 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4897 { "Mic/Line", 0x0 },
4899 { "Headphone", 0x2 },
4905 { "Mic/Line", 0x0 },
4907 { "Headphone", 0x2 },
4914 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4915 * the Fujitsu S702x, but jacks are marked differently.
4917 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4924 { "Headphone", 0x5 },
4933 { "Headphone", 0x6 },
4939 /* Maxdata Favorit 100XS */
4940 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4944 { "Line/Mic", 0x0 },
4951 { "Line/Mic", 0x0 },
4959 * This is just place-holder, so there's something for alc_build_pcms to look
4960 * at when it calculates the maximum number of channels. ALC260 has no mixer
4961 * element which allows changing the channel mode, so the verb list is
4964 static struct hda_channel_mode alc260_modes[1] = {
4969 /* Mixer combinations
4971 * basic: base_output + input + pc_beep + capture
4972 * HP: base_output + input + capture_alt
4973 * HP_3013: hp_3013 + input + capture
4974 * fujitsu: fujitsu + capture
4975 * acer: acer + capture
4978 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4979 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4980 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4981 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4982 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4983 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4984 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4988 static struct snd_kcontrol_new alc260_input_mixer[] = {
4989 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4990 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4991 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4992 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4994 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5000 /* update HP, line and mono out pins according to the master switch */
5001 static void alc260_hp_master_update(struct hda_codec *codec,
5002 hda_nid_t hp, hda_nid_t line,
5005 struct alc_spec *spec = codec->spec;
5006 unsigned int val = spec->master_sw ? PIN_HP : 0;
5007 /* change HP and line-out pins */
5008 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5010 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5012 /* mono (speaker) depending on the HP jack sense */
5013 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5014 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5018 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5019 struct snd_ctl_elem_value *ucontrol)
5021 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5022 struct alc_spec *spec = codec->spec;
5023 *ucontrol->value.integer.value = spec->master_sw;
5027 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5028 struct snd_ctl_elem_value *ucontrol)
5030 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5031 struct alc_spec *spec = codec->spec;
5032 int val = !!*ucontrol->value.integer.value;
5033 hda_nid_t hp, line, mono;
5035 if (val == spec->master_sw)
5037 spec->master_sw = val;
5038 hp = (kcontrol->private_value >> 16) & 0xff;
5039 line = (kcontrol->private_value >> 8) & 0xff;
5040 mono = kcontrol->private_value & 0xff;
5041 alc260_hp_master_update(codec, hp, line, mono);
5045 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5047 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5048 .name = "Master Playback Switch",
5049 .info = snd_ctl_boolean_mono_info,
5050 .get = alc260_hp_master_sw_get,
5051 .put = alc260_hp_master_sw_put,
5052 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5054 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5055 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5056 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5057 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5058 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5060 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5064 static struct hda_verb alc260_hp_unsol_verbs[] = {
5065 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5069 static void alc260_hp_automute(struct hda_codec *codec)
5071 struct alc_spec *spec = codec->spec;
5072 unsigned int present;
5074 present = snd_hda_codec_read(codec, 0x10, 0,
5075 AC_VERB_GET_PIN_SENSE, 0);
5076 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5077 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5080 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5082 if ((res >> 26) == ALC880_HP_EVENT)
5083 alc260_hp_automute(codec);
5086 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5088 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5089 .name = "Master Playback Switch",
5090 .info = snd_ctl_boolean_mono_info,
5091 .get = alc260_hp_master_sw_get,
5092 .put = alc260_hp_master_sw_put,
5093 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5095 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5096 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5097 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5098 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5099 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5100 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5101 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5102 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5106 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5107 .ops = &snd_hda_bind_vol,
5109 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5110 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5111 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5116 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5117 .ops = &snd_hda_bind_sw,
5119 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5120 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5125 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5126 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5127 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5128 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5133 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5134 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5138 static void alc260_hp_3013_automute(struct hda_codec *codec)
5140 struct alc_spec *spec = codec->spec;
5141 unsigned int present;
5143 present = snd_hda_codec_read(codec, 0x15, 0,
5144 AC_VERB_GET_PIN_SENSE, 0);
5145 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5146 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5149 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5152 if ((res >> 26) == ALC880_HP_EVENT)
5153 alc260_hp_3013_automute(codec);
5156 static void alc260_hp_3012_automute(struct hda_codec *codec)
5158 unsigned int present, bits;
5160 present = snd_hda_codec_read(codec, 0x10, 0,
5161 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5163 bits = present ? 0 : PIN_OUT;
5164 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5166 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5168 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5172 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5175 if ((res >> 26) == ALC880_HP_EVENT)
5176 alc260_hp_3012_automute(codec);
5179 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5180 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5182 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5183 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5184 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5185 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5186 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5187 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5188 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5189 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5190 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5191 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5192 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5196 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5197 * versions of the ALC260 don't act on requests to enable mic bias from NID
5198 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5199 * datasheet doesn't mention this restriction. At this stage it's not clear
5200 * whether this behaviour is intentional or is a hardware bug in chip
5201 * revisions available in early 2006. Therefore for now allow the
5202 * "Headphone Jack Mode" control to span all choices, but if it turns out
5203 * that the lack of mic bias for this NID is intentional we could change the
5204 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5206 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5207 * don't appear to make the mic bias available from the "line" jack, even
5208 * though the NID used for this jack (0x14) can supply it. The theory is
5209 * that perhaps Acer have included blocking capacitors between the ALC260
5210 * and the output jack. If this turns out to be the case for all such
5211 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5212 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5214 * The C20x Tablet series have a mono internal speaker which is controlled
5215 * via the chip's Mono sum widget and pin complex, so include the necessary
5216 * controls for such models. On models without a "mono speaker" the control
5217 * won't do anything.
5219 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5220 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5221 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5222 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5223 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5225 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5227 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5228 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5230 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5231 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5232 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5233 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5234 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5238 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5240 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5241 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5242 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5243 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5244 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5245 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5246 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5250 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5251 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5253 static struct snd_kcontrol_new alc260_will_mixer[] = {
5254 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5255 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5257 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5258 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5259 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5260 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5261 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5262 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5263 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5267 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5268 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5270 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5271 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5272 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5273 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5274 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5275 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5276 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5277 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5278 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5279 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5280 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5285 * initialization verbs
5287 static struct hda_verb alc260_init_verbs[] = {
5288 /* Line In pin widget for input */
5289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5290 /* CD pin widget for input */
5291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5292 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5293 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5294 /* Mic2 (front panel) pin widget for input and vref at 80% */
5295 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5296 /* LINE-2 is used for line-out in rear */
5297 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5298 /* select line-out */
5299 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5301 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5303 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5305 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5306 /* mute capture amp left and right */
5307 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5308 /* set connection select to line in (default select for this ADC) */
5309 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5310 /* mute capture amp left and right */
5311 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5312 /* set connection select to line in (default select for this ADC) */
5313 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5314 /* set vol=0 Line-Out mixer amp left and right */
5315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5316 /* unmute pin widget amp left and right (no gain on this amp) */
5317 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5318 /* set vol=0 HP mixer amp left and right */
5319 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5320 /* unmute pin widget amp left and right (no gain on this amp) */
5321 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5322 /* set vol=0 Mono mixer amp left and right */
5323 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5324 /* unmute pin widget amp left and right (no gain on this amp) */
5325 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5326 /* unmute LINE-2 out pin */
5327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5328 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5331 /* mute analog inputs */
5332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5337 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5338 /* mute Front out path */
5339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5340 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5341 /* mute Headphone out path */
5342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5343 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5344 /* mute Mono out path */
5345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5346 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5350 #if 0 /* should be identical with alc260_init_verbs? */
5351 static struct hda_verb alc260_hp_init_verbs[] = {
5352 /* Headphone and output */
5353 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5355 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5356 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5357 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5358 /* Mic2 (front panel) pin widget for input and vref at 80% */
5359 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5360 /* Line In pin widget for input */
5361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5362 /* Line-2 pin widget for output */
5363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5364 /* CD pin widget for input */
5365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5366 /* unmute amp left and right */
5367 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5368 /* set connection select to line in (default select for this ADC) */
5369 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5370 /* unmute Line-Out mixer amp left and right (volume = 0) */
5371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5372 /* mute pin widget amp left and right (no gain on this amp) */
5373 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5374 /* unmute HP mixer amp left and right (volume = 0) */
5375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5376 /* mute pin widget amp left and right (no gain on this amp) */
5377 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5378 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5381 /* mute analog inputs */
5382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5383 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5386 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5387 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5388 /* Unmute Front out path */
5389 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5391 /* Unmute Headphone out path */
5392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5394 /* Unmute Mono out path */
5395 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5396 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5401 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5402 /* Line out and output */
5403 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5405 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5406 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5407 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5408 /* Mic2 (front panel) pin widget for input and vref at 80% */
5409 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5410 /* Line In pin widget for input */
5411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5412 /* Headphone pin widget for output */
5413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5414 /* CD pin widget for input */
5415 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5416 /* unmute amp left and right */
5417 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5418 /* set connection select to line in (default select for this ADC) */
5419 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5420 /* unmute Line-Out mixer amp left and right (volume = 0) */
5421 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5422 /* mute pin widget amp left and right (no gain on this amp) */
5423 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5424 /* unmute HP mixer amp left and right (volume = 0) */
5425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5426 /* mute pin widget amp left and right (no gain on this amp) */
5427 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5428 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5431 /* mute analog inputs */
5432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5437 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5438 /* Unmute Front out path */
5439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5440 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5441 /* Unmute Headphone out path */
5442 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5443 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5444 /* Unmute Mono out path */
5445 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5446 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5450 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5451 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5452 * audio = 0x16, internal speaker = 0x10.
5454 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5455 /* Disable all GPIOs */
5456 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5457 /* Internal speaker is connected to headphone pin */
5458 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5459 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5460 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5461 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5462 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5463 /* Ensure all other unused pins are disabled and muted. */
5464 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5466 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5467 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5468 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5469 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5473 /* Disable digital (SPDIF) pins */
5474 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5475 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5477 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5478 * when acting as an output.
5480 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5482 /* Start with output sum widgets muted and their output gains at min */
5483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5484 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5485 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5488 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5489 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5490 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5491 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5493 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5494 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5495 /* Unmute Line1 pin widget output buffer since it starts as an output.
5496 * If the pin mode is changed by the user the pin mode control will
5497 * take care of enabling the pin's input/output buffers as needed.
5498 * Therefore there's no need to enable the input buffer at this
5501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5502 /* Unmute input buffer of pin widget used for Line-in (no equiv
5505 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5507 /* Mute capture amp left and right */
5508 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5509 /* Set ADC connection select to match default mixer setting - line
5512 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5514 /* Do the same for the second ADC: mute capture input amp and
5515 * set ADC connection to line in (on mic1 pin)
5517 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5518 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5520 /* Mute all inputs to mixer widget (even unconnected ones) */
5521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5522 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5523 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5524 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5533 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5534 * similar laptops (adapted from Fujitsu init verbs).
5536 static struct hda_verb alc260_acer_init_verbs[] = {
5537 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5538 * the headphone jack. Turn this on and rely on the standard mute
5539 * methods whenever the user wants to turn these outputs off.
5541 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5542 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5543 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5544 /* Internal speaker/Headphone jack is connected to Line-out pin */
5545 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5546 /* Internal microphone/Mic jack is connected to Mic1 pin */
5547 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5548 /* Line In jack is connected to Line1 pin */
5549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5550 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5551 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5552 /* Ensure all other unused pins are disabled and muted. */
5553 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5554 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5555 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5556 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5557 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5559 /* Disable digital (SPDIF) pins */
5560 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5561 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5563 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5564 * bus when acting as outputs.
5566 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5567 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5569 /* Start with output sum widgets muted and their output gains at min */
5570 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5572 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5573 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5576 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5577 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5578 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5580 /* Unmute Line-out pin widget amp left and right
5581 * (no equiv mixer ctrl)
5583 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5584 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5585 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5586 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5587 * inputs. If the pin mode is changed by the user the pin mode control
5588 * will take care of enabling the pin's input/output buffers as needed.
5589 * Therefore there's no need to enable the input buffer at this
5592 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5595 /* Mute capture amp left and right */
5596 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 /* Set ADC connection select to match default mixer setting - mic
5600 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5602 /* Do similar with the second ADC: mute capture input amp and
5603 * set ADC connection to mic to match ALSA's default state.
5605 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5606 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5608 /* Mute all inputs to mixer widget (even unconnected ones) */
5609 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5621 /* Initialisation sequence for Maxdata Favorit 100XS
5622 * (adapted from Acer init verbs).
5624 static struct hda_verb alc260_favorit100_init_verbs[] = {
5625 /* GPIO 0 enables the output jack.
5626 * Turn this on and rely on the standard mute
5627 * methods whenever the user wants to turn these outputs off.
5629 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5630 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5631 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5632 /* Line/Mic input jack is connected to Mic1 pin */
5633 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5634 /* Ensure all other unused pins are disabled and muted. */
5635 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5636 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5637 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5638 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5639 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5640 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5641 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5642 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5643 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5645 /* Disable digital (SPDIF) pins */
5646 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5647 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5649 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5650 * bus when acting as outputs.
5652 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5653 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5655 /* Start with output sum widgets muted and their output gains at min */
5656 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5657 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5658 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5659 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5660 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5661 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5662 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5663 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5664 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5666 /* Unmute Line-out pin widget amp left and right
5667 * (no equiv mixer ctrl)
5669 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5670 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5671 * inputs. If the pin mode is changed by the user the pin mode control
5672 * will take care of enabling the pin's input/output buffers as needed.
5673 * Therefore there's no need to enable the input buffer at this
5676 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5678 /* Mute capture amp left and right */
5679 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5680 /* Set ADC connection select to match default mixer setting - mic
5683 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5685 /* Do similar with the second ADC: mute capture input amp and
5686 * set ADC connection to mic to match ALSA's default state.
5688 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5689 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5691 /* Mute all inputs to mixer widget (even unconnected ones) */
5692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5704 static struct hda_verb alc260_will_verbs[] = {
5705 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5706 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5707 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5708 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5709 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5710 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5714 static struct hda_verb alc260_replacer_672v_verbs[] = {
5715 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5716 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5717 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5719 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5720 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5721 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5723 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5727 /* toggle speaker-output according to the hp-jack state */
5728 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5730 unsigned int present;
5732 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5733 present = snd_hda_codec_read(codec, 0x0f, 0,
5734 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5736 snd_hda_codec_write_cache(codec, 0x01, 0,
5737 AC_VERB_SET_GPIO_DATA, 1);
5738 snd_hda_codec_write_cache(codec, 0x0f, 0,
5739 AC_VERB_SET_PIN_WIDGET_CONTROL,
5742 snd_hda_codec_write_cache(codec, 0x01, 0,
5743 AC_VERB_SET_GPIO_DATA, 0);
5744 snd_hda_codec_write_cache(codec, 0x0f, 0,
5745 AC_VERB_SET_PIN_WIDGET_CONTROL,
5750 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5753 if ((res >> 26) == ALC880_HP_EVENT)
5754 alc260_replacer_672v_automute(codec);
5757 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5758 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5759 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5760 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5761 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5762 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5763 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5764 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5765 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5766 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5767 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5771 /* Test configuration for debugging, modelled after the ALC880 test
5774 #ifdef CONFIG_SND_DEBUG
5775 static hda_nid_t alc260_test_dac_nids[1] = {
5778 static hda_nid_t alc260_test_adc_nids[2] = {
5781 /* For testing the ALC260, each input MUX needs its own definition since
5782 * the signal assignments are different. This assumes that the first ADC
5785 static struct hda_input_mux alc260_test_capture_sources[2] = {
5789 { "MIC1 pin", 0x0 },
5790 { "MIC2 pin", 0x1 },
5791 { "LINE1 pin", 0x2 },
5792 { "LINE2 pin", 0x3 },
5794 { "LINE-OUT pin", 0x5 },
5795 { "HP-OUT pin", 0x6 },
5801 { "MIC1 pin", 0x0 },
5802 { "MIC2 pin", 0x1 },
5803 { "LINE1 pin", 0x2 },
5804 { "LINE2 pin", 0x3 },
5807 { "LINE-OUT pin", 0x6 },
5808 { "HP-OUT pin", 0x7 },
5812 static struct snd_kcontrol_new alc260_test_mixer[] = {
5813 /* Output driver widgets */
5814 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5815 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5816 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5817 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5818 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5819 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5821 /* Modes for retasking pin widgets
5822 * Note: the ALC260 doesn't seem to act on requests to enable mic
5823 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5824 * mention this restriction. At this stage it's not clear whether
5825 * this behaviour is intentional or is a hardware bug in chip
5826 * revisions available at least up until early 2006. Therefore for
5827 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5828 * choices, but if it turns out that the lack of mic bias for these
5829 * NIDs is intentional we could change their modes from
5830 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5832 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5833 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5834 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5835 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5836 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5837 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5839 /* Loopback mixer controls */
5840 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5841 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5842 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5843 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5844 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5845 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5846 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5847 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5848 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5849 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5850 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5851 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5852 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5853 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5855 /* Controls for GPIO pins, assuming they are configured as outputs */
5856 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5857 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5858 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5859 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5861 /* Switches to allow the digital IO pins to be enabled. The datasheet
5862 * is ambigious as to which NID is which; testing on laptops which
5863 * make this output available should provide clarification.
5865 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5866 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5868 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5869 * this output to turn on an external amplifier.
5871 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5872 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5876 static struct hda_verb alc260_test_init_verbs[] = {
5877 /* Enable all GPIOs as outputs with an initial value of 0 */
5878 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5879 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5880 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5882 /* Enable retasking pins as output, initially without power amp */
5883 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5884 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5885 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5886 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5887 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5888 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5890 /* Disable digital (SPDIF) pins initially, but users can enable
5891 * them via a mixer switch. In the case of SPDIF-out, this initverb
5892 * payload also sets the generation to 0, output to be in "consumer"
5893 * PCM format, copyright asserted, no pre-emphasis and no validity
5896 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5897 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5899 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5900 * OUT1 sum bus when acting as an output.
5902 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5903 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5904 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5905 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5907 /* Start with output sum widgets muted and their output gains at min */
5908 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5910 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5911 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5912 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5913 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5914 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5915 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5916 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5918 /* Unmute retasking pin widget output buffers since the default
5919 * state appears to be output. As the pin mode is changed by the
5920 * user the pin mode control will take care of enabling the pin's
5921 * input/output buffers as needed.
5923 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5924 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5925 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5926 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5927 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5928 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5929 /* Also unmute the mono-out pin widget */
5930 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5932 /* Mute capture amp left and right */
5933 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5934 /* Set ADC connection select to match default mixer setting (mic1
5937 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5939 /* Do the same for the second ADC: mute capture input amp and
5940 * set ADC connection to mic1 pin
5942 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5943 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5945 /* Mute all inputs to mixer widget (even unconnected ones) */
5946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5948 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5949 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5950 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5951 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5952 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5959 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5960 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5962 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5963 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5966 * for BIOS auto-configuration
5969 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5970 const char *pfx, int *vol_bits)
5973 unsigned long vol_val, sw_val;
5977 if (nid >= 0x0f && nid < 0x11) {
5978 nid_vol = nid - 0x7;
5979 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5980 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5981 } else if (nid == 0x11) {
5982 nid_vol = nid - 0x7;
5983 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5984 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5985 } else if (nid >= 0x12 && nid <= 0x15) {
5987 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5988 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5992 if (!(*vol_bits & (1 << nid_vol))) {
5993 /* first control for the volume widget */
5994 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5995 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5998 *vol_bits |= (1 << nid_vol);
6000 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
6001 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
6007 /* add playback controls from the parsed DAC table */
6008 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6009 const struct auto_pin_cfg *cfg)
6015 spec->multiout.num_dacs = 1;
6016 spec->multiout.dac_nids = spec->private_dac_nids;
6017 spec->multiout.dac_nids[0] = 0x02;
6019 nid = cfg->line_out_pins[0];
6022 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6024 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6028 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6033 nid = cfg->speaker_pins[0];
6035 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6040 nid = cfg->hp_pins[0];
6042 err = alc260_add_playback_controls(spec, nid, "Headphone",
6050 /* create playback/capture controls for input pins */
6051 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6052 const struct auto_pin_cfg *cfg)
6054 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6057 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6058 hda_nid_t nid, int pin_type,
6061 alc_set_pin_output(codec, nid, pin_type);
6062 /* need the manual connection? */
6064 int idx = nid - 0x12;
6065 snd_hda_codec_write(codec, idx + 0x0b, 0,
6066 AC_VERB_SET_CONNECT_SEL, sel_idx);
6070 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6072 struct alc_spec *spec = codec->spec;
6075 nid = spec->autocfg.line_out_pins[0];
6077 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6078 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6081 nid = spec->autocfg.speaker_pins[0];
6083 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6085 nid = spec->autocfg.hp_pins[0];
6087 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6090 #define ALC260_PIN_CD_NID 0x16
6091 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6093 struct alc_spec *spec = codec->spec;
6096 for (i = 0; i < AUTO_PIN_LAST; i++) {
6097 hda_nid_t nid = spec->autocfg.input_pins[i];
6099 alc_set_input_pin(codec, nid, i);
6100 if (nid != ALC260_PIN_CD_NID &&
6101 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6102 snd_hda_codec_write(codec, nid, 0,
6103 AC_VERB_SET_AMP_GAIN_MUTE,
6110 * generic initialization of ADC, input mixers and output mixers
6112 static struct hda_verb alc260_volume_init_verbs[] = {
6114 * Unmute ADC0-1 and set the default input to mic-in
6116 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6117 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6118 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6119 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6121 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6123 * Note: PASD motherboards uses the Line In 2 as the input for
6124 * front panel mic (mic 2)
6126 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6127 /* mute analog inputs */
6128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6132 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6135 * Set up output mixers (0x08 - 0x0a)
6137 /* set vol=0 to output mixers */
6138 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6139 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6140 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6141 /* set up input amps for analog loopback */
6142 /* Amp Indices: DAC = 0, mixer = 1 */
6143 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6144 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6146 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6147 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6148 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6153 static int alc260_parse_auto_config(struct hda_codec *codec)
6155 struct alc_spec *spec = codec->spec;
6157 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6159 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6163 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6166 if (!spec->kctls.list)
6167 return 0; /* can't find valid BIOS pin config */
6168 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6172 spec->multiout.max_channels = 2;
6174 if (spec->autocfg.dig_outs)
6175 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6176 if (spec->kctls.list)
6177 add_mixer(spec, spec->kctls.list);
6179 add_verb(spec, alc260_volume_init_verbs);
6181 spec->num_mux_defs = 1;
6182 spec->input_mux = &spec->private_imux[0];
6184 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6189 /* additional initialization for auto-configuration model */
6190 static void alc260_auto_init(struct hda_codec *codec)
6192 struct alc_spec *spec = codec->spec;
6193 alc260_auto_init_multi_out(codec);
6194 alc260_auto_init_analog_input(codec);
6195 if (spec->unsol_event)
6196 alc_inithook(codec);
6199 #ifdef CONFIG_SND_HDA_POWER_SAVE
6200 static struct hda_amp_list alc260_loopbacks[] = {
6201 { 0x07, HDA_INPUT, 0 },
6202 { 0x07, HDA_INPUT, 1 },
6203 { 0x07, HDA_INPUT, 2 },
6204 { 0x07, HDA_INPUT, 3 },
6205 { 0x07, HDA_INPUT, 4 },
6211 * ALC260 configurations
6213 static const char *alc260_models[ALC260_MODEL_LAST] = {
6214 [ALC260_BASIC] = "basic",
6216 [ALC260_HP_3013] = "hp-3013",
6217 [ALC260_HP_DC7600] = "hp-dc7600",
6218 [ALC260_FUJITSU_S702X] = "fujitsu",
6219 [ALC260_ACER] = "acer",
6220 [ALC260_WILL] = "will",
6221 [ALC260_REPLACER_672V] = "replacer",
6222 [ALC260_FAVORIT100] = "favorit100",
6223 #ifdef CONFIG_SND_DEBUG
6224 [ALC260_TEST] = "test",
6226 [ALC260_AUTO] = "auto",
6229 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6230 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6231 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6232 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6233 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6234 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6235 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6236 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6237 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6238 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6239 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6240 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6241 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6242 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6243 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6244 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6245 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6246 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6247 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6248 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6252 static struct alc_config_preset alc260_presets[] = {
6254 .mixers = { alc260_base_output_mixer,
6255 alc260_input_mixer },
6256 .init_verbs = { alc260_init_verbs },
6257 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6258 .dac_nids = alc260_dac_nids,
6259 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6260 .adc_nids = alc260_adc_nids,
6261 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6262 .channel_mode = alc260_modes,
6263 .input_mux = &alc260_capture_source,
6266 .mixers = { alc260_hp_output_mixer,
6267 alc260_input_mixer },
6268 .init_verbs = { alc260_init_verbs,
6269 alc260_hp_unsol_verbs },
6270 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6271 .dac_nids = alc260_dac_nids,
6272 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6273 .adc_nids = alc260_adc_nids_alt,
6274 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6275 .channel_mode = alc260_modes,
6276 .input_mux = &alc260_capture_source,
6277 .unsol_event = alc260_hp_unsol_event,
6278 .init_hook = alc260_hp_automute,
6280 [ALC260_HP_DC7600] = {
6281 .mixers = { alc260_hp_dc7600_mixer,
6282 alc260_input_mixer },
6283 .init_verbs = { alc260_init_verbs,
6284 alc260_hp_dc7600_verbs },
6285 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6286 .dac_nids = alc260_dac_nids,
6287 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6288 .adc_nids = alc260_adc_nids_alt,
6289 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6290 .channel_mode = alc260_modes,
6291 .input_mux = &alc260_capture_source,
6292 .unsol_event = alc260_hp_3012_unsol_event,
6293 .init_hook = alc260_hp_3012_automute,
6295 [ALC260_HP_3013] = {
6296 .mixers = { alc260_hp_3013_mixer,
6297 alc260_input_mixer },
6298 .init_verbs = { alc260_hp_3013_init_verbs,
6299 alc260_hp_3013_unsol_verbs },
6300 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6301 .dac_nids = alc260_dac_nids,
6302 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6303 .adc_nids = alc260_adc_nids_alt,
6304 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6305 .channel_mode = alc260_modes,
6306 .input_mux = &alc260_capture_source,
6307 .unsol_event = alc260_hp_3013_unsol_event,
6308 .init_hook = alc260_hp_3013_automute,
6310 [ALC260_FUJITSU_S702X] = {
6311 .mixers = { alc260_fujitsu_mixer },
6312 .init_verbs = { alc260_fujitsu_init_verbs },
6313 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6314 .dac_nids = alc260_dac_nids,
6315 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6316 .adc_nids = alc260_dual_adc_nids,
6317 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6318 .channel_mode = alc260_modes,
6319 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6320 .input_mux = alc260_fujitsu_capture_sources,
6323 .mixers = { alc260_acer_mixer },
6324 .init_verbs = { alc260_acer_init_verbs },
6325 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6326 .dac_nids = alc260_dac_nids,
6327 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6328 .adc_nids = alc260_dual_adc_nids,
6329 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6330 .channel_mode = alc260_modes,
6331 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6332 .input_mux = alc260_acer_capture_sources,
6334 [ALC260_FAVORIT100] = {
6335 .mixers = { alc260_favorit100_mixer },
6336 .init_verbs = { alc260_favorit100_init_verbs },
6337 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6338 .dac_nids = alc260_dac_nids,
6339 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6340 .adc_nids = alc260_dual_adc_nids,
6341 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6342 .channel_mode = alc260_modes,
6343 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6344 .input_mux = alc260_favorit100_capture_sources,
6347 .mixers = { alc260_will_mixer },
6348 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6349 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6350 .dac_nids = alc260_dac_nids,
6351 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6352 .adc_nids = alc260_adc_nids,
6353 .dig_out_nid = ALC260_DIGOUT_NID,
6354 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6355 .channel_mode = alc260_modes,
6356 .input_mux = &alc260_capture_source,
6358 [ALC260_REPLACER_672V] = {
6359 .mixers = { alc260_replacer_672v_mixer },
6360 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6361 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6362 .dac_nids = alc260_dac_nids,
6363 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6364 .adc_nids = alc260_adc_nids,
6365 .dig_out_nid = ALC260_DIGOUT_NID,
6366 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6367 .channel_mode = alc260_modes,
6368 .input_mux = &alc260_capture_source,
6369 .unsol_event = alc260_replacer_672v_unsol_event,
6370 .init_hook = alc260_replacer_672v_automute,
6372 #ifdef CONFIG_SND_DEBUG
6374 .mixers = { alc260_test_mixer },
6375 .init_verbs = { alc260_test_init_verbs },
6376 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6377 .dac_nids = alc260_test_dac_nids,
6378 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6379 .adc_nids = alc260_test_adc_nids,
6380 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6381 .channel_mode = alc260_modes,
6382 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6383 .input_mux = alc260_test_capture_sources,
6388 static int patch_alc260(struct hda_codec *codec)
6390 struct alc_spec *spec;
6391 int err, board_config;
6393 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6399 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6402 if (board_config < 0) {
6403 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6405 board_config = ALC260_AUTO;
6408 if (board_config == ALC260_AUTO) {
6409 /* automatic parse from the BIOS config */
6410 err = alc260_parse_auto_config(codec);
6416 "hda_codec: Cannot set up configuration "
6417 "from BIOS. Using base mode...\n");
6418 board_config = ALC260_BASIC;
6422 err = snd_hda_attach_beep_device(codec, 0x1);
6428 if (board_config != ALC260_AUTO)
6429 setup_preset(codec, &alc260_presets[board_config]);
6431 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6432 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6434 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6435 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6437 if (!spec->adc_nids && spec->input_mux) {
6438 /* check whether NID 0x04 is valid */
6439 unsigned int wcap = get_wcaps(codec, 0x04);
6440 wcap = get_wcaps_type(wcap);
6442 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6443 spec->adc_nids = alc260_adc_nids_alt;
6444 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6446 spec->adc_nids = alc260_adc_nids;
6447 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6450 set_capture_mixer(codec);
6451 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6453 spec->vmaster_nid = 0x08;
6455 codec->patch_ops = alc_patch_ops;
6456 if (board_config == ALC260_AUTO)
6457 spec->init_hook = alc260_auto_init;
6458 #ifdef CONFIG_SND_HDA_POWER_SAVE
6459 if (!spec->loopback.amplist)
6460 spec->loopback.amplist = alc260_loopbacks;
6462 codec->proc_widget_hook = print_realtek_coef;
6469 * ALC882/883/885/888/889 support
6471 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6472 * configuration. Each pin widget can choose any input DACs and a mixer.
6473 * Each ADC is connected from a mixer of all inputs. This makes possible
6474 * 6-channel independent captures.
6476 * In addition, an independent DAC for the multi-playback (not used in this
6479 #define ALC882_DIGOUT_NID 0x06
6480 #define ALC882_DIGIN_NID 0x0a
6481 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6482 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6483 #define ALC1200_DIGOUT_NID 0x10
6486 static struct hda_channel_mode alc882_ch_modes[1] = {
6491 static hda_nid_t alc882_dac_nids[4] = {
6492 /* front, rear, clfe, rear_surr */
6493 0x02, 0x03, 0x04, 0x05
6495 #define alc883_dac_nids alc882_dac_nids
6498 #define alc882_adc_nids alc880_adc_nids
6499 #define alc882_adc_nids_alt alc880_adc_nids_alt
6500 #define alc883_adc_nids alc882_adc_nids_alt
6501 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6502 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6503 #define alc889_adc_nids alc880_adc_nids
6505 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6506 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6507 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6508 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6509 #define alc889_capsrc_nids alc882_capsrc_nids
6512 /* FIXME: should be a matrix-type input source selection */
6514 static struct hda_input_mux alc882_capture_source = {
6518 { "Front Mic", 0x1 },
6524 #define alc883_capture_source alc882_capture_source
6526 static struct hda_input_mux alc889_capture_source = {
6529 { "Front Mic", 0x0 },
6535 static struct hda_input_mux mb5_capture_source = {
6544 static struct hda_input_mux alc883_3stack_6ch_intel = {
6548 { "Front Mic", 0x0 },
6554 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6562 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6572 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6580 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6584 { "Front Mic", 0x1 },
6589 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6597 static struct hda_input_mux alc889A_mb31_capture_source = {
6601 /* Front Mic (0x01) unused */
6603 /* Line 2 (0x03) unused */
6604 /* CD (0x04) unsused? */
6611 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6618 static struct hda_verb alc882_3ST_ch2_init[] = {
6619 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6620 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6621 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6622 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6629 static struct hda_verb alc882_3ST_ch4_init[] = {
6630 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6631 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6632 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6633 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6634 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6641 static struct hda_verb alc882_3ST_ch6_init[] = {
6642 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6643 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6644 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6645 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6646 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6647 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6651 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6652 { 2, alc882_3ST_ch2_init },
6653 { 4, alc882_3ST_ch4_init },
6654 { 6, alc882_3ST_ch6_init },
6657 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6662 static struct hda_verb alc882_sixstack_ch6_init[] = {
6663 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6664 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6665 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6666 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6673 static struct hda_verb alc882_sixstack_ch8_init[] = {
6674 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6675 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6676 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6677 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6681 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6682 { 6, alc882_sixstack_ch6_init },
6683 { 8, alc882_sixstack_ch8_init },
6687 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6693 static struct hda_verb alc885_mbp_ch2_init[] = {
6694 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6695 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6696 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6703 static struct hda_verb alc885_mbp_ch6_init[] = {
6704 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6705 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6706 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6707 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6708 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6712 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6713 { 2, alc885_mbp_ch2_init },
6714 { 6, alc885_mbp_ch6_init },
6719 * Speakers/Woofer/HP = Front
6722 static struct hda_verb alc885_mb5_ch2_init[] = {
6723 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6724 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6730 * Speakers/HP = Front
6734 static struct hda_verb alc885_mb5_ch6_init[] = {
6735 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6737 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6741 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6742 { 2, alc885_mb5_ch2_init },
6743 { 6, alc885_mb5_ch6_init },
6750 static struct hda_verb alc883_4ST_ch2_init[] = {
6751 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6752 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6753 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6754 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6755 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6756 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6763 static struct hda_verb alc883_4ST_ch4_init[] = {
6764 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6765 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6766 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6767 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6770 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6777 static struct hda_verb alc883_4ST_ch6_init[] = {
6778 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6779 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6780 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6781 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6782 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6783 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6784 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6785 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6792 static struct hda_verb alc883_4ST_ch8_init[] = {
6793 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6794 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6795 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6796 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6797 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6798 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6799 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6800 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6801 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6805 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6806 { 2, alc883_4ST_ch2_init },
6807 { 4, alc883_4ST_ch4_init },
6808 { 6, alc883_4ST_ch6_init },
6809 { 8, alc883_4ST_ch8_init },
6816 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6817 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6818 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6819 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6820 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6827 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6828 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6829 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6830 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6831 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6832 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6839 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6840 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6841 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6842 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6843 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6844 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6845 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6849 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6850 { 2, alc883_3ST_ch2_intel_init },
6851 { 4, alc883_3ST_ch4_intel_init },
6852 { 6, alc883_3ST_ch6_intel_init },
6858 static struct hda_verb alc889_ch2_intel_init[] = {
6859 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6860 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6861 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6862 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6863 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6864 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6871 static struct hda_verb alc889_ch6_intel_init[] = {
6872 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6873 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6874 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6875 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6876 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6877 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6884 static struct hda_verb alc889_ch8_intel_init[] = {
6885 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6886 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6887 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6888 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6889 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6890 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6891 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6895 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6896 { 2, alc889_ch2_intel_init },
6897 { 6, alc889_ch6_intel_init },
6898 { 8, alc889_ch8_intel_init },
6904 static struct hda_verb alc883_sixstack_ch6_init[] = {
6905 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6906 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6907 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6908 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6915 static struct hda_verb alc883_sixstack_ch8_init[] = {
6916 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6917 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6918 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6919 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6923 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6924 { 6, alc883_sixstack_ch6_init },
6925 { 8, alc883_sixstack_ch8_init },
6929 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6930 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6932 static struct snd_kcontrol_new alc882_base_mixer[] = {
6933 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6934 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6935 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6936 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6937 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6938 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6939 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6940 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6941 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6942 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6943 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6944 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6945 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6946 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6947 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6948 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6949 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6950 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6951 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6952 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6953 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6957 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6958 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6959 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6960 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6961 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6962 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6963 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6965 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6966 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6967 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6971 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6973 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6974 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6975 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6976 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6977 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6978 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6979 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6981 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6983 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6984 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6985 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6989 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6990 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6991 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6992 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6993 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6994 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6995 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6997 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7002 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7003 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7004 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7005 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7006 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7007 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7008 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7009 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7011 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7012 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7013 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7014 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7015 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7019 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7020 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7022 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7023 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7024 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7025 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7026 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7027 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7028 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7029 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7030 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7032 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7035 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7039 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7040 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7041 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7042 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7043 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7044 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7045 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7046 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7048 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7053 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7055 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7056 .name = "Channel Mode",
7057 .info = alc_ch_mode_info,
7058 .get = alc_ch_mode_get,
7059 .put = alc_ch_mode_put,
7064 static struct hda_verb alc882_base_init_verbs[] = {
7065 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7066 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7068 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7070 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7071 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7072 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7076 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7078 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7079 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7080 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7082 /* mute analog input loopbacks */
7083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7089 /* Front Pin: output 0 (0x0c) */
7090 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7091 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7092 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7093 /* Rear Pin: output 1 (0x0d) */
7094 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7095 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7096 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7097 /* CLFE Pin: output 2 (0x0e) */
7098 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7099 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7100 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7101 /* Side Pin: output 3 (0x0f) */
7102 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7103 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7104 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7105 /* Mic (rear) pin: input vref at 80% */
7106 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7107 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7108 /* Front Mic pin: input vref at 80% */
7109 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7110 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7111 /* Line In pin: input */
7112 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7113 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7114 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7115 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7116 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7117 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7118 /* CD pin widget for input */
7119 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7121 /* FIXME: use matrix-type input source selection */
7122 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7124 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7125 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7126 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7127 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7129 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7131 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7133 /* ADC2: mute amp left and right */
7134 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7135 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7136 /* ADC3: mute amp left and right */
7137 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7138 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7143 static struct hda_verb alc882_adc1_init_verbs[] = {
7144 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7145 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7146 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7147 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7148 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7149 /* ADC1: mute amp left and right */
7150 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7151 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7155 static struct hda_verb alc882_eapd_verbs[] = {
7156 /* change to EAPD mode */
7157 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7158 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7162 static struct hda_verb alc889_eapd_verbs[] = {
7163 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7164 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7168 static struct hda_verb alc_hp15_unsol_verbs[] = {
7169 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7170 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7174 static struct hda_verb alc885_init_verbs[] = {
7175 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7177 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7178 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7180 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7181 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7182 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7184 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7185 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7186 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7188 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7189 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7190 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7192 /* mute analog input loopbacks */
7193 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7194 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7195 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7197 /* Front HP Pin: output 0 (0x0c) */
7198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7199 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7200 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7201 /* Front Pin: output 0 (0x0c) */
7202 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7203 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7204 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7205 /* Rear Pin: output 1 (0x0d) */
7206 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7207 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7208 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7209 /* CLFE Pin: output 2 (0x0e) */
7210 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7211 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7212 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7213 /* Side Pin: output 3 (0x0f) */
7214 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7215 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7216 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7217 /* Mic (rear) pin: input vref at 80% */
7218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7219 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7220 /* Front Mic pin: input vref at 80% */
7221 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7222 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7223 /* Line In pin: input */
7224 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7225 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7227 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7233 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7235 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7237 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7238 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7239 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7240 /* ADC2: mute amp left and right */
7241 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7242 /* ADC3: mute amp left and right */
7243 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7248 static struct hda_verb alc885_init_input_verbs[] = {
7249 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7250 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7251 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7256 /* Unmute Selector 24h and set the default input to front mic */
7257 static struct hda_verb alc889_init_input_verbs[] = {
7258 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7259 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7264 #define alc883_init_verbs alc882_base_init_verbs
7267 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7268 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7269 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7270 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7271 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7272 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7273 /* FIXME: this looks suspicious...
7274 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7275 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7280 static struct hda_verb alc882_macpro_init_verbs[] = {
7281 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7285 /* Front Pin: output 0 (0x0c) */
7286 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7287 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7288 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7289 /* Front Mic pin: input vref at 80% */
7290 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7291 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7292 /* Speaker: output */
7293 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7294 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7295 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7296 /* Headphone output (output 0 - 0x0c) */
7297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7298 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7299 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7301 /* FIXME: use matrix-type input source selection */
7302 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7303 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7307 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7312 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7318 /* ADC1: mute amp left and right */
7319 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7320 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7321 /* ADC2: mute amp left and right */
7322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7323 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7324 /* ADC3: mute amp left and right */
7325 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7326 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7332 static struct hda_verb alc885_mb5_init_verbs[] = {
7334 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7335 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7336 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7337 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7341 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7342 /* Surround mixer */
7343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7344 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7345 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7349 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7351 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7352 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7353 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7354 /* Front Pin (0x0c) */
7355 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7356 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7357 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7358 /* LFE Pin (0x0e) */
7359 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7360 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7361 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7363 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7364 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7365 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7366 /* Front Mic pin: input vref at 80% */
7367 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7368 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7370 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7371 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7376 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7380 /* Macbook Pro rev3 */
7381 static struct hda_verb alc885_mbp3_init_verbs[] = {
7382 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7385 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7387 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7388 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7389 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7390 /* Front Pin: output 0 (0x0c) */
7391 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7392 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7393 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7394 /* HP Pin: output 0 (0x0d) */
7395 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7396 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7397 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7398 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7399 /* Mic (rear) pin: input vref at 80% */
7400 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7401 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7402 /* Front Mic pin: input vref at 80% */
7403 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7404 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7405 /* Line In pin: use output 1 when in LineOut mode */
7406 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7407 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7408 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7410 /* FIXME: use matrix-type input source selection */
7411 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7412 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7413 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7420 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7421 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7426 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7427 /* ADC1: mute amp left and right */
7428 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7429 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7430 /* ADC2: mute amp left and right */
7431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7432 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7433 /* ADC3: mute amp left and right */
7434 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7435 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7440 /* iMac 24 mixer. */
7441 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7442 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7443 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7447 /* iMac 24 init verbs. */
7448 static struct hda_verb alc885_imac24_init_verbs[] = {
7449 /* Internal speakers: output 0 (0x0c) */
7450 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7451 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7452 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7453 /* Internal speakers: output 0 (0x0c) */
7454 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7455 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7456 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7457 /* Headphone: output 0 (0x0c) */
7458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7459 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7460 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7461 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7462 /* Front Mic: input vref at 80% */
7463 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7464 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7468 /* Toggle speaker-output according to the hp-jack state */
7469 static void alc885_imac24_setup(struct hda_codec *codec)
7471 struct alc_spec *spec = codec->spec;
7473 spec->autocfg.hp_pins[0] = 0x14;
7474 spec->autocfg.speaker_pins[0] = 0x18;
7475 spec->autocfg.speaker_pins[1] = 0x1a;
7478 static void alc885_mbp3_setup(struct hda_codec *codec)
7480 struct alc_spec *spec = codec->spec;
7482 spec->autocfg.hp_pins[0] = 0x15;
7483 spec->autocfg.speaker_pins[0] = 0x14;
7487 static struct hda_verb alc882_targa_verbs[] = {
7488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7491 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7492 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7494 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7495 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7496 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7498 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7502 /* toggle speaker-output according to the hp-jack state */
7503 static void alc882_targa_automute(struct hda_codec *codec)
7505 struct alc_spec *spec = codec->spec;
7506 alc_automute_amp(codec);
7507 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7508 spec->jack_present ? 1 : 3);
7511 static void alc882_targa_setup(struct hda_codec *codec)
7513 struct alc_spec *spec = codec->spec;
7515 spec->autocfg.hp_pins[0] = 0x14;
7516 spec->autocfg.speaker_pins[0] = 0x1b;
7519 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7521 if ((res >> 26) == ALC880_HP_EVENT)
7522 alc882_targa_automute(codec);
7525 static struct hda_verb alc882_asus_a7j_verbs[] = {
7526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7530 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7531 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7533 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7534 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7535 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7537 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7538 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7539 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7543 static struct hda_verb alc882_asus_a7m_verbs[] = {
7544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7547 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7549 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7551 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7552 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7553 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7555 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7556 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7557 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7561 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7563 unsigned int gpiostate, gpiomask, gpiodir;
7565 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7566 AC_VERB_GET_GPIO_DATA, 0);
7569 gpiostate |= (1 << pin);
7571 gpiostate &= ~(1 << pin);
7573 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7574 AC_VERB_GET_GPIO_MASK, 0);
7575 gpiomask |= (1 << pin);
7577 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7578 AC_VERB_GET_GPIO_DIRECTION, 0);
7579 gpiodir |= (1 << pin);
7582 snd_hda_codec_write(codec, codec->afg, 0,
7583 AC_VERB_SET_GPIO_MASK, gpiomask);
7584 snd_hda_codec_write(codec, codec->afg, 0,
7585 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7589 snd_hda_codec_write(codec, codec->afg, 0,
7590 AC_VERB_SET_GPIO_DATA, gpiostate);
7593 /* set up GPIO at initialization */
7594 static void alc885_macpro_init_hook(struct hda_codec *codec)
7596 alc882_gpio_mute(codec, 0, 0);
7597 alc882_gpio_mute(codec, 1, 0);
7600 /* set up GPIO and update auto-muting at initialization */
7601 static void alc885_imac24_init_hook(struct hda_codec *codec)
7603 alc885_macpro_init_hook(codec);
7604 alc_automute_amp(codec);
7608 * generic initialization of ADC, input mixers and output mixers
7610 static struct hda_verb alc883_auto_init_verbs[] = {
7612 * Unmute ADC0-2 and set the default input to mic-in
7614 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7615 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7616 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7617 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7619 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7621 * Note: PASD motherboards uses the Line In 2 as the input for
7622 * front panel mic (mic 2)
7624 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7632 * Set up output mixers (0x0c - 0x0f)
7634 /* set vol=0 to output mixers */
7635 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7636 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7638 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7639 /* set up input amps for analog loopback */
7640 /* Amp Indices: DAC = 0, mixer = 1 */
7641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7644 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7648 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7649 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7650 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7652 /* FIXME: use matrix-type input source selection */
7653 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7658 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7661 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7663 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7668 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7669 static struct hda_verb alc889A_mb31_ch2_init[] = {
7670 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7672 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7673 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7677 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7678 static struct hda_verb alc889A_mb31_ch4_init[] = {
7679 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7680 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7681 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7682 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7686 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7687 static struct hda_verb alc889A_mb31_ch5_init[] = {
7688 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7689 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7690 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7695 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7696 static struct hda_verb alc889A_mb31_ch6_init[] = {
7697 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7698 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7699 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7700 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7704 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7705 { 2, alc889A_mb31_ch2_init },
7706 { 4, alc889A_mb31_ch4_init },
7707 { 5, alc889A_mb31_ch5_init },
7708 { 6, alc889A_mb31_ch6_init },
7711 static struct hda_verb alc883_medion_eapd_verbs[] = {
7712 /* eanable EAPD on medion laptop */
7713 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7714 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7718 #define alc883_base_mixer alc882_base_mixer
7720 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7721 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7722 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7723 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7724 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7725 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7726 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7727 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7728 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7729 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7730 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7731 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7732 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7733 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7737 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7738 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7739 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7740 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7741 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7743 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7744 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7745 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7746 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7747 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7751 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7752 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7753 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7754 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7755 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7757 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7758 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7759 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7761 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7765 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7766 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7767 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7771 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7772 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7777 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7778 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7782 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7783 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7784 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7785 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7786 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7787 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7788 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7789 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7790 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7791 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7794 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7795 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7797 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7800 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7801 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7805 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7806 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7807 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7808 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7809 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7810 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7812 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7813 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7814 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7815 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7816 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7817 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7818 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7819 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7821 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7822 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7823 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7824 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7825 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7829 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7830 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7831 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7832 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7833 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7834 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7836 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7837 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7838 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7839 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7840 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7842 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7843 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7844 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7845 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7847 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7848 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7849 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7853 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7854 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7855 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7856 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7857 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7858 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7859 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7860 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7861 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7862 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7863 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7864 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7865 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7866 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7868 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7869 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7870 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7871 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7872 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7876 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7878 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7879 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7880 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7881 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7882 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7883 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7884 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7885 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7886 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7887 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7888 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7889 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7891 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7896 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7897 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7898 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7899 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7900 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7901 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7903 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7904 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7905 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7906 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7907 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7911 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7912 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7913 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7914 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7915 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7916 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7918 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7923 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7924 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7925 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7926 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7927 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7928 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7931 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7932 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7936 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7937 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7938 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7939 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7940 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7941 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7944 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7945 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7949 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7950 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7951 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7952 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7953 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7954 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7956 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7957 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7961 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7962 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7963 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7964 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7965 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7966 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7967 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7968 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7969 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7970 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7971 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7976 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7977 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7978 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7980 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7981 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7982 0x0d, 1, 0x0, HDA_OUTPUT),
7983 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7984 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7985 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7986 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7987 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7996 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7997 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8001 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8003 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8004 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8006 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8007 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8009 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8010 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8011 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8012 /* Output switches */
8013 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8014 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8015 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8017 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8018 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8027 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8028 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8029 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8032 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8037 static struct hda_bind_ctls alc883_bind_cap_vol = {
8038 .ops = &snd_hda_bind_vol,
8040 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8041 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8046 static struct hda_bind_ctls alc883_bind_cap_switch = {
8047 .ops = &snd_hda_bind_sw,
8049 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8050 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8055 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8056 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8057 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8059 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8060 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8062 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8063 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8067 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8068 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8069 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8071 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8072 /* .name = "Capture Source", */
8073 .name = "Input Source",
8075 .info = alc_mux_enum_info,
8076 .get = alc_mux_enum_get,
8077 .put = alc_mux_enum_put,
8082 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8084 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8085 .name = "Channel Mode",
8086 .info = alc_ch_mode_info,
8087 .get = alc_ch_mode_get,
8088 .put = alc_ch_mode_put,
8093 /* toggle speaker-output according to the hp-jack state */
8094 static void alc883_mitac_setup(struct hda_codec *codec)
8096 struct alc_spec *spec = codec->spec;
8098 spec->autocfg.hp_pins[0] = 0x15;
8099 spec->autocfg.speaker_pins[0] = 0x14;
8100 spec->autocfg.speaker_pins[1] = 0x17;
8103 /* auto-toggle front mic */
8105 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8107 unsigned int present;
8110 present = snd_hda_codec_read(codec, 0x18, 0,
8111 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8112 bits = present ? HDA_AMP_MUTE : 0;
8113 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8117 static struct hda_verb alc883_mitac_verbs[] = {
8119 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8120 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8122 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8123 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8125 /* enable unsolicited event */
8126 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8127 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8132 static struct hda_verb alc883_clevo_m720_verbs[] = {
8134 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8135 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8137 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8140 /* enable unsolicited event */
8141 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8142 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8147 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8149 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8152 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8153 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8155 /* enable unsolicited event */
8156 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8161 static struct hda_verb alc883_targa_verbs[] = {
8162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8165 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8166 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8168 /* Connect Line-Out side jack (SPDIF) to Side */
8169 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8170 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8171 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8172 /* Connect Mic jack to CLFE */
8173 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8174 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8175 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8176 /* Connect Line-in jack to Surround */
8177 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8178 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8179 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8180 /* Connect HP out jack to Front */
8181 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8182 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8183 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8185 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8190 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8191 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8192 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8193 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8197 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8198 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8200 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8201 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8205 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8206 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8208 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8209 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8210 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8214 static struct hda_verb alc883_haier_w66_verbs[] = {
8215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8216 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8220 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8221 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8222 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8223 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8227 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8231 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8232 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8233 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8234 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8235 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8239 static struct hda_verb alc888_6st_dell_verbs[] = {
8240 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8244 static struct hda_verb alc883_vaiott_verbs[] = {
8246 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8247 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8249 /* enable unsolicited event */
8250 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8255 static void alc888_3st_hp_setup(struct hda_codec *codec)
8257 struct alc_spec *spec = codec->spec;
8259 spec->autocfg.hp_pins[0] = 0x1b;
8260 spec->autocfg.speaker_pins[0] = 0x14;
8261 spec->autocfg.speaker_pins[1] = 0x16;
8262 spec->autocfg.speaker_pins[2] = 0x18;
8265 static struct hda_verb alc888_3st_hp_verbs[] = {
8266 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8267 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8268 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8269 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8276 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8277 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8278 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8279 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8280 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8287 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8288 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8289 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8290 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8291 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8292 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8299 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8300 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8301 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8302 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8303 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8304 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8305 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8309 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8310 { 2, alc888_3st_hp_2ch_init },
8311 { 4, alc888_3st_hp_4ch_init },
8312 { 6, alc888_3st_hp_6ch_init },
8315 /* toggle front-jack and RCA according to the hp-jack state */
8316 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8318 unsigned int present;
8320 present = snd_hda_codec_read(codec, 0x1b, 0,
8321 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8322 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8323 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8324 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8325 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8328 /* toggle RCA according to the front-jack state */
8329 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8331 unsigned int present;
8333 present = snd_hda_codec_read(codec, 0x14, 0,
8334 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8335 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8336 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8339 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8342 if ((res >> 26) == ALC880_HP_EVENT)
8343 alc888_lenovo_ms7195_front_automute(codec);
8344 if ((res >> 26) == ALC880_FRONT_EVENT)
8345 alc888_lenovo_ms7195_rca_automute(codec);
8348 static struct hda_verb alc883_medion_md2_verbs[] = {
8349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8352 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8354 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8358 /* toggle speaker-output according to the hp-jack state */
8359 static void alc883_medion_md2_setup(struct hda_codec *codec)
8361 struct alc_spec *spec = codec->spec;
8363 spec->autocfg.hp_pins[0] = 0x14;
8364 spec->autocfg.speaker_pins[0] = 0x15;
8367 /* toggle speaker-output according to the hp-jack state */
8368 #define alc883_targa_init_hook alc882_targa_init_hook
8369 #define alc883_targa_unsol_event alc882_targa_unsol_event
8371 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8373 unsigned int present;
8375 present = snd_hda_codec_read(codec, 0x18, 0,
8376 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8377 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8378 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8381 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8383 struct alc_spec *spec = codec->spec;
8385 spec->autocfg.hp_pins[0] = 0x15;
8386 spec->autocfg.speaker_pins[0] = 0x14;
8389 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8391 alc_automute_amp(codec);
8392 alc883_clevo_m720_mic_automute(codec);
8395 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8398 switch (res >> 26) {
8399 case ALC880_MIC_EVENT:
8400 alc883_clevo_m720_mic_automute(codec);
8403 alc_automute_amp_unsol_event(codec, res);
8408 /* toggle speaker-output according to the hp-jack state */
8409 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8411 struct alc_spec *spec = codec->spec;
8413 spec->autocfg.hp_pins[0] = 0x14;
8414 spec->autocfg.speaker_pins[0] = 0x15;
8417 static void alc883_haier_w66_setup(struct hda_codec *codec)
8419 struct alc_spec *spec = codec->spec;
8421 spec->autocfg.hp_pins[0] = 0x1b;
8422 spec->autocfg.speaker_pins[0] = 0x14;
8425 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8427 unsigned int present;
8430 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8431 & AC_PINSENSE_PRESENCE;
8432 bits = present ? HDA_AMP_MUTE : 0;
8433 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8434 HDA_AMP_MUTE, bits);
8437 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8439 unsigned int present;
8442 present = snd_hda_codec_read(codec, 0x1b, 0,
8443 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8444 bits = present ? HDA_AMP_MUTE : 0;
8445 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8446 HDA_AMP_MUTE, bits);
8447 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8448 HDA_AMP_MUTE, bits);
8451 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8454 if ((res >> 26) == ALC880_HP_EVENT)
8455 alc883_lenovo_101e_all_automute(codec);
8456 if ((res >> 26) == ALC880_FRONT_EVENT)
8457 alc883_lenovo_101e_ispeaker_automute(codec);
8460 /* toggle speaker-output according to the hp-jack state */
8461 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8463 struct alc_spec *spec = codec->spec;
8465 spec->autocfg.hp_pins[0] = 0x14;
8466 spec->autocfg.speaker_pins[0] = 0x15;
8467 spec->autocfg.speaker_pins[1] = 0x16;
8470 static struct hda_verb alc883_acer_eapd_verbs[] = {
8471 /* HP Pin: output 0 (0x0c) */
8472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8474 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8475 /* Front Pin: output 0 (0x0c) */
8476 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8477 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8478 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8479 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8480 /* eanable EAPD on medion laptop */
8481 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8482 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8483 /* enable unsolicited event */
8484 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8488 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8489 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8490 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8491 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8495 static void alc888_6st_dell_setup(struct hda_codec *codec)
8497 struct alc_spec *spec = codec->spec;
8499 spec->autocfg.hp_pins[0] = 0x1b;
8500 spec->autocfg.speaker_pins[0] = 0x14;
8501 spec->autocfg.speaker_pins[1] = 0x15;
8502 spec->autocfg.speaker_pins[2] = 0x16;
8503 spec->autocfg.speaker_pins[3] = 0x17;
8506 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8508 struct alc_spec *spec = codec->spec;
8510 spec->autocfg.hp_pins[0] = 0x1b;
8511 spec->autocfg.speaker_pins[0] = 0x14;
8512 spec->autocfg.speaker_pins[1] = 0x15;
8513 spec->autocfg.speaker_pins[2] = 0x16;
8514 spec->autocfg.speaker_pins[3] = 0x17;
8515 spec->autocfg.speaker_pins[4] = 0x1a;
8518 static void alc883_vaiott_setup(struct hda_codec *codec)
8520 struct alc_spec *spec = codec->spec;
8522 spec->autocfg.hp_pins[0] = 0x15;
8523 spec->autocfg.speaker_pins[0] = 0x14;
8524 spec->autocfg.speaker_pins[1] = 0x17;
8527 static struct hda_verb alc888_asus_m90v_verbs[] = {
8528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8530 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8531 /* enable unsolicited event */
8532 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8533 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8537 static void alc883_mode2_setup(struct hda_codec *codec)
8539 struct alc_spec *spec = codec->spec;
8541 spec->autocfg.hp_pins[0] = 0x1b;
8542 spec->autocfg.speaker_pins[0] = 0x14;
8543 spec->autocfg.speaker_pins[1] = 0x15;
8544 spec->autocfg.speaker_pins[2] = 0x16;
8545 spec->ext_mic.pin = 0x18;
8546 spec->int_mic.pin = 0x19;
8547 spec->ext_mic.mux_idx = 0;
8548 spec->int_mic.mux_idx = 1;
8552 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8554 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8556 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8558 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8559 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8560 /* enable unsolicited event */
8561 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8565 static void alc883_eee1601_inithook(struct hda_codec *codec)
8567 struct alc_spec *spec = codec->spec;
8569 spec->autocfg.hp_pins[0] = 0x14;
8570 spec->autocfg.speaker_pins[0] = 0x1b;
8571 alc_automute_pin(codec);
8574 static struct hda_verb alc889A_mb31_verbs[] = {
8575 /* Init rear pin (used as headphone output) */
8576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8577 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8578 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8579 /* Init line pin (used as output in 4ch and 6ch mode) */
8580 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8581 /* Init line 2 pin (used as headphone out by default) */
8582 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8583 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8587 /* Mute speakers according to the headphone jack state */
8588 static void alc889A_mb31_automute(struct hda_codec *codec)
8590 unsigned int present;
8592 /* Mute only in 2ch or 4ch mode */
8593 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8595 present = snd_hda_codec_read(codec, 0x15, 0,
8596 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8597 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8598 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8599 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8600 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8604 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8606 if ((res >> 26) == ALC880_HP_EVENT)
8607 alc889A_mb31_automute(codec);
8611 #ifdef CONFIG_SND_HDA_POWER_SAVE
8612 #define alc882_loopbacks alc880_loopbacks
8615 /* pcm configuration: identical with ALC880 */
8616 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8617 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8618 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8619 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8621 static hda_nid_t alc883_slave_dig_outs[] = {
8622 ALC1200_DIGOUT_NID, 0,
8625 static hda_nid_t alc1200_slave_dig_outs[] = {
8626 ALC883_DIGOUT_NID, 0,
8630 * configuration and preset
8632 static const char *alc882_models[ALC882_MODEL_LAST] = {
8633 [ALC882_3ST_DIG] = "3stack-dig",
8634 [ALC882_6ST_DIG] = "6stack-dig",
8635 [ALC882_ARIMA] = "arima",
8636 [ALC882_W2JC] = "w2jc",
8637 [ALC882_TARGA] = "targa",
8638 [ALC882_ASUS_A7J] = "asus-a7j",
8639 [ALC882_ASUS_A7M] = "asus-a7m",
8640 [ALC885_MACPRO] = "macpro",
8641 [ALC885_MB5] = "mb5",
8642 [ALC885_MBP3] = "mbp3",
8643 [ALC885_IMAC24] = "imac24",
8644 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8645 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8646 [ALC883_3ST_6ch] = "3stack-6ch",
8647 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8648 [ALC883_TARGA_DIG] = "targa-dig",
8649 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8650 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8651 [ALC883_ACER] = "acer",
8652 [ALC883_ACER_ASPIRE] = "acer-aspire",
8653 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8654 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8655 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8656 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8657 [ALC883_MEDION] = "medion",
8658 [ALC883_MEDION_MD2] = "medion-md2",
8659 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8660 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8661 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8662 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8663 [ALC888_LENOVO_SKY] = "lenovo-sky",
8664 [ALC883_HAIER_W66] = "haier-w66",
8665 [ALC888_3ST_HP] = "3stack-hp",
8666 [ALC888_6ST_DELL] = "6stack-dell",
8667 [ALC883_MITAC] = "mitac",
8668 [ALC883_CLEVO_M720] = "clevo-m720",
8669 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8670 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8671 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8672 [ALC889A_INTEL] = "intel-alc889a",
8673 [ALC889_INTEL] = "intel-x58",
8674 [ALC1200_ASUS_P5Q] = "asus-p5q",
8675 [ALC889A_MB31] = "mb31",
8676 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8677 [ALC882_AUTO] = "auto",
8680 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8681 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8683 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8684 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8685 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8686 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8687 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8688 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8689 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8690 ALC888_ACER_ASPIRE_4930G),
8691 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8692 ALC888_ACER_ASPIRE_4930G),
8693 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8694 ALC888_ACER_ASPIRE_8930G),
8695 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8696 ALC888_ACER_ASPIRE_8930G),
8697 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8698 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8699 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8700 ALC888_ACER_ASPIRE_6530G),
8701 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8702 ALC888_ACER_ASPIRE_6530G),
8703 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8704 ALC888_ACER_ASPIRE_7730G),
8705 /* default Acer -- disabled as it causes more problems.
8706 * model=auto should work fine now
8708 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8710 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8712 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8713 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8714 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8715 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8716 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8717 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8719 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8720 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8721 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8722 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8723 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8724 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8725 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8726 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8727 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8728 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8729 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8731 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8732 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8733 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8734 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8735 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8736 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8737 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8738 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8739 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8741 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8742 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8743 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8744 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8745 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8746 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8747 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8748 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8749 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8750 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8751 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8752 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8753 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8754 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8755 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8756 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8757 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8758 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8759 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8760 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8761 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8762 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8763 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8764 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8765 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8766 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8767 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8768 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8769 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8771 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8772 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8773 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8774 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8775 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8776 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8777 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8778 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8779 ALC883_FUJITSU_PI2515),
8780 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8781 ALC888_FUJITSU_XA3530),
8782 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8783 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8784 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8785 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8786 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8787 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8788 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8789 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8790 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8792 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8793 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8794 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8795 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8796 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8797 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8798 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8803 /* codec SSID table for Intel Mac */
8804 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8805 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8806 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8807 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8808 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8809 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8810 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8811 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8812 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8813 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8814 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8815 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8816 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8817 * no perfect solution yet
8819 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8823 static struct alc_config_preset alc882_presets[] = {
8824 [ALC882_3ST_DIG] = {
8825 .mixers = { alc882_base_mixer },
8826 .init_verbs = { alc882_base_init_verbs,
8827 alc882_adc1_init_verbs },
8828 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8829 .dac_nids = alc882_dac_nids,
8830 .dig_out_nid = ALC882_DIGOUT_NID,
8831 .dig_in_nid = ALC882_DIGIN_NID,
8832 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8833 .channel_mode = alc882_ch_modes,
8835 .input_mux = &alc882_capture_source,
8837 [ALC882_6ST_DIG] = {
8838 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8839 .init_verbs = { alc882_base_init_verbs,
8840 alc882_adc1_init_verbs },
8841 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8842 .dac_nids = alc882_dac_nids,
8843 .dig_out_nid = ALC882_DIGOUT_NID,
8844 .dig_in_nid = ALC882_DIGIN_NID,
8845 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8846 .channel_mode = alc882_sixstack_modes,
8847 .input_mux = &alc882_capture_source,
8850 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8851 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8852 alc882_eapd_verbs },
8853 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8854 .dac_nids = alc882_dac_nids,
8855 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8856 .channel_mode = alc882_sixstack_modes,
8857 .input_mux = &alc882_capture_source,
8860 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8861 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8862 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8863 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8864 .dac_nids = alc882_dac_nids,
8865 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8866 .channel_mode = alc880_threestack_modes,
8868 .input_mux = &alc882_capture_source,
8869 .dig_out_nid = ALC882_DIGOUT_NID,
8872 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8873 .init_verbs = { alc885_mbp3_init_verbs,
8874 alc880_gpio1_init_verbs },
8875 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8876 .dac_nids = alc882_dac_nids,
8877 .channel_mode = alc885_mbp_6ch_modes,
8878 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8879 .input_mux = &alc882_capture_source,
8880 .dig_out_nid = ALC882_DIGOUT_NID,
8881 .dig_in_nid = ALC882_DIGIN_NID,
8882 .unsol_event = alc_automute_amp_unsol_event,
8883 .setup = alc885_mbp3_setup,
8884 .init_hook = alc_automute_amp,
8887 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8888 .init_verbs = { alc885_mb5_init_verbs,
8889 alc880_gpio1_init_verbs },
8890 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8891 .dac_nids = alc882_dac_nids,
8892 .channel_mode = alc885_mb5_6ch_modes,
8893 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8894 .input_mux = &mb5_capture_source,
8895 .dig_out_nid = ALC882_DIGOUT_NID,
8896 .dig_in_nid = ALC882_DIGIN_NID,
8899 .mixers = { alc882_macpro_mixer },
8900 .init_verbs = { alc882_macpro_init_verbs },
8901 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8902 .dac_nids = alc882_dac_nids,
8903 .dig_out_nid = ALC882_DIGOUT_NID,
8904 .dig_in_nid = ALC882_DIGIN_NID,
8905 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8906 .channel_mode = alc882_ch_modes,
8907 .input_mux = &alc882_capture_source,
8908 .init_hook = alc885_macpro_init_hook,
8911 .mixers = { alc885_imac24_mixer },
8912 .init_verbs = { alc885_imac24_init_verbs },
8913 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8914 .dac_nids = alc882_dac_nids,
8915 .dig_out_nid = ALC882_DIGOUT_NID,
8916 .dig_in_nid = ALC882_DIGIN_NID,
8917 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8918 .channel_mode = alc882_ch_modes,
8919 .input_mux = &alc882_capture_source,
8920 .unsol_event = alc_automute_amp_unsol_event,
8921 .setup = alc885_imac24_setup,
8922 .init_hook = alc885_imac24_init_hook,
8925 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8926 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8927 alc880_gpio3_init_verbs, alc882_targa_verbs},
8928 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8929 .dac_nids = alc882_dac_nids,
8930 .dig_out_nid = ALC882_DIGOUT_NID,
8931 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8932 .adc_nids = alc882_adc_nids,
8933 .capsrc_nids = alc882_capsrc_nids,
8934 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8935 .channel_mode = alc882_3ST_6ch_modes,
8937 .input_mux = &alc882_capture_source,
8938 .unsol_event = alc882_targa_unsol_event,
8939 .setup = alc882_targa_setup,
8940 .init_hook = alc882_targa_automute,
8942 [ALC882_ASUS_A7J] = {
8943 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8944 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8945 alc882_asus_a7j_verbs},
8946 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8947 .dac_nids = alc882_dac_nids,
8948 .dig_out_nid = ALC882_DIGOUT_NID,
8949 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8950 .adc_nids = alc882_adc_nids,
8951 .capsrc_nids = alc882_capsrc_nids,
8952 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8953 .channel_mode = alc882_3ST_6ch_modes,
8955 .input_mux = &alc882_capture_source,
8957 [ALC882_ASUS_A7M] = {
8958 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8959 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8960 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8961 alc882_asus_a7m_verbs },
8962 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8963 .dac_nids = alc882_dac_nids,
8964 .dig_out_nid = ALC882_DIGOUT_NID,
8965 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8966 .channel_mode = alc880_threestack_modes,
8968 .input_mux = &alc882_capture_source,
8970 [ALC883_3ST_2ch_DIG] = {
8971 .mixers = { alc883_3ST_2ch_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_2ch_modes),
8978 .channel_mode = alc883_3ST_2ch_modes,
8979 .input_mux = &alc883_capture_source,
8981 [ALC883_3ST_6ch_DIG] = {
8982 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8983 .init_verbs = { alc883_init_verbs },
8984 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8985 .dac_nids = alc883_dac_nids,
8986 .dig_out_nid = ALC883_DIGOUT_NID,
8987 .dig_in_nid = ALC883_DIGIN_NID,
8988 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8989 .channel_mode = alc883_3ST_6ch_modes,
8991 .input_mux = &alc883_capture_source,
8993 [ALC883_3ST_6ch] = {
8994 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8995 .init_verbs = { alc883_init_verbs },
8996 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8997 .dac_nids = alc883_dac_nids,
8998 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8999 .channel_mode = alc883_3ST_6ch_modes,
9001 .input_mux = &alc883_capture_source,
9003 [ALC883_3ST_6ch_INTEL] = {
9004 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9005 .init_verbs = { alc883_init_verbs },
9006 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9007 .dac_nids = alc883_dac_nids,
9008 .dig_out_nid = ALC883_DIGOUT_NID,
9009 .dig_in_nid = ALC883_DIGIN_NID,
9010 .slave_dig_outs = alc883_slave_dig_outs,
9011 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9012 .channel_mode = alc883_3ST_6ch_intel_modes,
9014 .input_mux = &alc883_3stack_6ch_intel,
9017 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9018 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9019 alc_hp15_unsol_verbs },
9020 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9021 .dac_nids = alc883_dac_nids,
9022 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9023 .adc_nids = alc889_adc_nids,
9024 .dig_out_nid = ALC883_DIGOUT_NID,
9025 .dig_in_nid = ALC883_DIGIN_NID,
9026 .slave_dig_outs = alc883_slave_dig_outs,
9027 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9028 .channel_mode = alc889_8ch_intel_modes,
9029 .capsrc_nids = alc889_capsrc_nids,
9030 .input_mux = &alc889_capture_source,
9031 .setup = alc889_automute_setup,
9032 .init_hook = alc_automute_amp,
9033 .unsol_event = alc_automute_amp_unsol_event,
9037 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9038 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9039 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9040 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9041 .dac_nids = alc883_dac_nids,
9042 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9043 .adc_nids = alc889_adc_nids,
9044 .dig_out_nid = ALC883_DIGOUT_NID,
9045 .dig_in_nid = ALC883_DIGIN_NID,
9046 .slave_dig_outs = alc883_slave_dig_outs,
9047 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9048 .channel_mode = alc889_8ch_intel_modes,
9049 .capsrc_nids = alc889_capsrc_nids,
9050 .input_mux = &alc889_capture_source,
9051 .setup = alc889_automute_setup,
9052 .init_hook = alc889_intel_init_hook,
9053 .unsol_event = alc_automute_amp_unsol_event,
9056 [ALC883_6ST_DIG] = {
9057 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9058 .init_verbs = { alc883_init_verbs },
9059 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9060 .dac_nids = alc883_dac_nids,
9061 .dig_out_nid = ALC883_DIGOUT_NID,
9062 .dig_in_nid = ALC883_DIGIN_NID,
9063 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9064 .channel_mode = alc883_sixstack_modes,
9065 .input_mux = &alc883_capture_source,
9067 [ALC883_TARGA_DIG] = {
9068 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9069 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9070 alc883_targa_verbs},
9071 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9072 .dac_nids = alc883_dac_nids,
9073 .dig_out_nid = ALC883_DIGOUT_NID,
9074 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9075 .channel_mode = alc883_3ST_6ch_modes,
9077 .input_mux = &alc883_capture_source,
9078 .unsol_event = alc883_targa_unsol_event,
9079 .setup = alc882_targa_setup,
9080 .init_hook = alc882_targa_automute,
9082 [ALC883_TARGA_2ch_DIG] = {
9083 .mixers = { alc883_targa_2ch_mixer},
9084 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9085 alc883_targa_verbs},
9086 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9087 .dac_nids = alc883_dac_nids,
9088 .adc_nids = alc883_adc_nids_alt,
9089 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9090 .dig_out_nid = ALC883_DIGOUT_NID,
9091 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9092 .channel_mode = alc883_3ST_2ch_modes,
9093 .input_mux = &alc883_capture_source,
9094 .unsol_event = alc883_targa_unsol_event,
9095 .setup = alc882_targa_setup,
9096 .init_hook = alc882_targa_automute,
9098 [ALC883_TARGA_8ch_DIG] = {
9099 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9100 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9101 alc883_targa_verbs },
9102 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9103 .dac_nids = alc883_dac_nids,
9104 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9105 .adc_nids = alc883_adc_nids_rev,
9106 .capsrc_nids = alc883_capsrc_nids_rev,
9107 .dig_out_nid = ALC883_DIGOUT_NID,
9108 .dig_in_nid = ALC883_DIGIN_NID,
9109 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9110 .channel_mode = alc883_4ST_8ch_modes,
9112 .input_mux = &alc883_capture_source,
9113 .unsol_event = alc883_targa_unsol_event,
9114 .setup = alc882_targa_setup,
9115 .init_hook = alc882_targa_automute,
9118 .mixers = { alc883_base_mixer },
9119 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9120 * and the headphone jack. Turn this on and rely on the
9121 * standard mute methods whenever the user wants to turn
9122 * these outputs off.
9124 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9125 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9126 .dac_nids = alc883_dac_nids,
9127 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9128 .channel_mode = alc883_3ST_2ch_modes,
9129 .input_mux = &alc883_capture_source,
9131 [ALC883_ACER_ASPIRE] = {
9132 .mixers = { alc883_acer_aspire_mixer },
9133 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9134 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9135 .dac_nids = alc883_dac_nids,
9136 .dig_out_nid = ALC883_DIGOUT_NID,
9137 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9138 .channel_mode = alc883_3ST_2ch_modes,
9139 .input_mux = &alc883_capture_source,
9140 .unsol_event = alc_automute_amp_unsol_event,
9141 .setup = alc883_acer_aspire_setup,
9142 .init_hook = alc_automute_amp,
9144 [ALC888_ACER_ASPIRE_4930G] = {
9145 .mixers = { alc888_base_mixer,
9146 alc883_chmode_mixer },
9147 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9148 alc888_acer_aspire_4930g_verbs },
9149 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9150 .dac_nids = alc883_dac_nids,
9151 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9152 .adc_nids = alc883_adc_nids_rev,
9153 .capsrc_nids = alc883_capsrc_nids_rev,
9154 .dig_out_nid = ALC883_DIGOUT_NID,
9155 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9156 .channel_mode = alc883_3ST_6ch_modes,
9159 ARRAY_SIZE(alc888_2_capture_sources),
9160 .input_mux = alc888_2_capture_sources,
9161 .unsol_event = alc_automute_amp_unsol_event,
9162 .setup = alc888_acer_aspire_4930g_setup,
9163 .init_hook = alc_automute_amp,
9165 [ALC888_ACER_ASPIRE_6530G] = {
9166 .mixers = { alc888_acer_aspire_6530_mixer },
9167 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9168 alc888_acer_aspire_6530g_verbs },
9169 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9170 .dac_nids = alc883_dac_nids,
9171 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9172 .adc_nids = alc883_adc_nids_rev,
9173 .capsrc_nids = alc883_capsrc_nids_rev,
9174 .dig_out_nid = ALC883_DIGOUT_NID,
9175 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9176 .channel_mode = alc883_3ST_2ch_modes,
9178 ARRAY_SIZE(alc888_2_capture_sources),
9179 .input_mux = alc888_acer_aspire_6530_sources,
9180 .unsol_event = alc_automute_amp_unsol_event,
9181 .setup = alc888_acer_aspire_6530g_setup,
9182 .init_hook = alc_automute_amp,
9184 [ALC888_ACER_ASPIRE_8930G] = {
9185 .mixers = { alc888_base_mixer,
9186 alc883_chmode_mixer },
9187 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9188 alc889_acer_aspire_8930g_verbs },
9189 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9190 .dac_nids = alc883_dac_nids,
9191 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9192 .adc_nids = alc889_adc_nids,
9193 .capsrc_nids = alc889_capsrc_nids,
9194 .dig_out_nid = ALC883_DIGOUT_NID,
9195 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9196 .channel_mode = alc883_3ST_6ch_modes,
9198 .const_channel_count = 6,
9200 ARRAY_SIZE(alc889_capture_sources),
9201 .input_mux = alc889_capture_sources,
9202 .unsol_event = alc_automute_amp_unsol_event,
9203 .setup = alc889_acer_aspire_8930g_setup,
9204 .init_hook = alc_automute_amp,
9206 [ALC888_ACER_ASPIRE_7730G] = {
9207 .mixers = { alc883_3ST_6ch_mixer,
9208 alc883_chmode_mixer },
9209 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9210 alc888_acer_aspire_7730G_verbs },
9211 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9212 .dac_nids = alc883_dac_nids,
9213 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9214 .adc_nids = alc883_adc_nids_rev,
9215 .capsrc_nids = alc883_capsrc_nids_rev,
9216 .dig_out_nid = ALC883_DIGOUT_NID,
9217 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9218 .channel_mode = alc883_3ST_6ch_modes,
9220 .const_channel_count = 6,
9221 .input_mux = &alc883_capture_source,
9222 .unsol_event = alc_automute_amp_unsol_event,
9223 .setup = alc888_acer_aspire_6530g_setup,
9224 .init_hook = alc_automute_amp,
9227 .mixers = { alc883_fivestack_mixer,
9228 alc883_chmode_mixer },
9229 .init_verbs = { alc883_init_verbs,
9230 alc883_medion_eapd_verbs },
9231 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9232 .dac_nids = alc883_dac_nids,
9233 .adc_nids = alc883_adc_nids_alt,
9234 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9235 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9236 .channel_mode = alc883_sixstack_modes,
9237 .input_mux = &alc883_capture_source,
9239 [ALC883_MEDION_MD2] = {
9240 .mixers = { alc883_medion_md2_mixer},
9241 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9242 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9243 .dac_nids = alc883_dac_nids,
9244 .dig_out_nid = ALC883_DIGOUT_NID,
9245 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9246 .channel_mode = alc883_3ST_2ch_modes,
9247 .input_mux = &alc883_capture_source,
9248 .unsol_event = alc_automute_amp_unsol_event,
9249 .setup = alc883_medion_md2_setup,
9250 .init_hook = alc_automute_amp,
9252 [ALC883_LAPTOP_EAPD] = {
9253 .mixers = { alc883_base_mixer },
9254 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9255 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9256 .dac_nids = alc883_dac_nids,
9257 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9258 .channel_mode = alc883_3ST_2ch_modes,
9259 .input_mux = &alc883_capture_source,
9261 [ALC883_CLEVO_M720] = {
9262 .mixers = { alc883_clevo_m720_mixer },
9263 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9264 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9265 .dac_nids = alc883_dac_nids,
9266 .dig_out_nid = ALC883_DIGOUT_NID,
9267 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9268 .channel_mode = alc883_3ST_2ch_modes,
9269 .input_mux = &alc883_capture_source,
9270 .unsol_event = alc883_clevo_m720_unsol_event,
9271 .setup = alc883_clevo_m720_setup,
9272 .init_hook = alc883_clevo_m720_init_hook,
9274 [ALC883_LENOVO_101E_2ch] = {
9275 .mixers = { alc883_lenovo_101e_2ch_mixer},
9276 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9277 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9278 .dac_nids = alc883_dac_nids,
9279 .adc_nids = alc883_adc_nids_alt,
9280 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9281 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9282 .channel_mode = alc883_3ST_2ch_modes,
9283 .input_mux = &alc883_lenovo_101e_capture_source,
9284 .unsol_event = alc883_lenovo_101e_unsol_event,
9285 .init_hook = alc883_lenovo_101e_all_automute,
9287 [ALC883_LENOVO_NB0763] = {
9288 .mixers = { alc883_lenovo_nb0763_mixer },
9289 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9290 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9291 .dac_nids = alc883_dac_nids,
9292 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9293 .channel_mode = alc883_3ST_2ch_modes,
9295 .input_mux = &alc883_lenovo_nb0763_capture_source,
9296 .unsol_event = alc_automute_amp_unsol_event,
9297 .setup = alc883_medion_md2_setup,
9298 .init_hook = alc_automute_amp,
9300 [ALC888_LENOVO_MS7195_DIG] = {
9301 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9302 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9303 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9304 .dac_nids = alc883_dac_nids,
9305 .dig_out_nid = ALC883_DIGOUT_NID,
9306 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9307 .channel_mode = alc883_3ST_6ch_modes,
9309 .input_mux = &alc883_capture_source,
9310 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9311 .init_hook = alc888_lenovo_ms7195_front_automute,
9313 [ALC883_HAIER_W66] = {
9314 .mixers = { alc883_targa_2ch_mixer},
9315 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9316 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9317 .dac_nids = alc883_dac_nids,
9318 .dig_out_nid = ALC883_DIGOUT_NID,
9319 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9320 .channel_mode = alc883_3ST_2ch_modes,
9321 .input_mux = &alc883_capture_source,
9322 .unsol_event = alc_automute_amp_unsol_event,
9323 .setup = alc883_haier_w66_setup,
9324 .init_hook = alc_automute_amp,
9327 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9328 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9329 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9330 .dac_nids = alc883_dac_nids,
9331 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9332 .channel_mode = alc888_3st_hp_modes,
9334 .input_mux = &alc883_capture_source,
9335 .unsol_event = alc_automute_amp_unsol_event,
9336 .setup = alc888_3st_hp_setup,
9337 .init_hook = alc_automute_amp,
9339 [ALC888_6ST_DELL] = {
9340 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9341 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9342 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9343 .dac_nids = alc883_dac_nids,
9344 .dig_out_nid = ALC883_DIGOUT_NID,
9345 .dig_in_nid = ALC883_DIGIN_NID,
9346 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9347 .channel_mode = alc883_sixstack_modes,
9348 .input_mux = &alc883_capture_source,
9349 .unsol_event = alc_automute_amp_unsol_event,
9350 .setup = alc888_6st_dell_setup,
9351 .init_hook = alc_automute_amp,
9354 .mixers = { alc883_mitac_mixer },
9355 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9356 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9357 .dac_nids = alc883_dac_nids,
9358 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9359 .channel_mode = alc883_3ST_2ch_modes,
9360 .input_mux = &alc883_capture_source,
9361 .unsol_event = alc_automute_amp_unsol_event,
9362 .setup = alc883_mitac_setup,
9363 .init_hook = alc_automute_amp,
9365 [ALC883_FUJITSU_PI2515] = {
9366 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9367 .init_verbs = { alc883_init_verbs,
9368 alc883_2ch_fujitsu_pi2515_verbs},
9369 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9370 .dac_nids = alc883_dac_nids,
9371 .dig_out_nid = ALC883_DIGOUT_NID,
9372 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9373 .channel_mode = alc883_3ST_2ch_modes,
9374 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9375 .unsol_event = alc_automute_amp_unsol_event,
9376 .setup = alc883_2ch_fujitsu_pi2515_setup,
9377 .init_hook = alc_automute_amp,
9379 [ALC888_FUJITSU_XA3530] = {
9380 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9381 .init_verbs = { alc883_init_verbs,
9382 alc888_fujitsu_xa3530_verbs },
9383 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9384 .dac_nids = alc883_dac_nids,
9385 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9386 .adc_nids = alc883_adc_nids_rev,
9387 .capsrc_nids = alc883_capsrc_nids_rev,
9388 .dig_out_nid = ALC883_DIGOUT_NID,
9389 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9390 .channel_mode = alc888_4ST_8ch_intel_modes,
9392 ARRAY_SIZE(alc888_2_capture_sources),
9393 .input_mux = alc888_2_capture_sources,
9394 .unsol_event = alc_automute_amp_unsol_event,
9395 .setup = alc888_fujitsu_xa3530_setup,
9396 .init_hook = alc_automute_amp,
9398 [ALC888_LENOVO_SKY] = {
9399 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9400 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9401 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9402 .dac_nids = alc883_dac_nids,
9403 .dig_out_nid = ALC883_DIGOUT_NID,
9404 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9405 .channel_mode = alc883_sixstack_modes,
9407 .input_mux = &alc883_lenovo_sky_capture_source,
9408 .unsol_event = alc_automute_amp_unsol_event,
9409 .setup = alc888_lenovo_sky_setup,
9410 .init_hook = alc_automute_amp,
9412 [ALC888_ASUS_M90V] = {
9413 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9414 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9415 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9416 .dac_nids = alc883_dac_nids,
9417 .dig_out_nid = ALC883_DIGOUT_NID,
9418 .dig_in_nid = ALC883_DIGIN_NID,
9419 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9420 .channel_mode = alc883_3ST_6ch_modes,
9422 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9423 .unsol_event = alc_sku_unsol_event,
9424 .setup = alc883_mode2_setup,
9425 .init_hook = alc_inithook,
9427 [ALC888_ASUS_EEE1601] = {
9428 .mixers = { alc883_asus_eee1601_mixer },
9429 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9430 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9431 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9432 .dac_nids = alc883_dac_nids,
9433 .dig_out_nid = ALC883_DIGOUT_NID,
9434 .dig_in_nid = ALC883_DIGIN_NID,
9435 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9436 .channel_mode = alc883_3ST_2ch_modes,
9438 .input_mux = &alc883_asus_eee1601_capture_source,
9439 .unsol_event = alc_sku_unsol_event,
9440 .init_hook = alc883_eee1601_inithook,
9442 [ALC1200_ASUS_P5Q] = {
9443 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9444 .init_verbs = { alc883_init_verbs },
9445 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9446 .dac_nids = alc883_dac_nids,
9447 .dig_out_nid = ALC1200_DIGOUT_NID,
9448 .dig_in_nid = ALC883_DIGIN_NID,
9449 .slave_dig_outs = alc1200_slave_dig_outs,
9450 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9451 .channel_mode = alc883_sixstack_modes,
9452 .input_mux = &alc883_capture_source,
9455 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9456 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9457 alc880_gpio1_init_verbs },
9458 .adc_nids = alc883_adc_nids,
9459 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9460 .dac_nids = alc883_dac_nids,
9461 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9462 .channel_mode = alc889A_mb31_6ch_modes,
9463 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9464 .input_mux = &alc889A_mb31_capture_source,
9465 .dig_out_nid = ALC883_DIGOUT_NID,
9466 .unsol_event = alc889A_mb31_unsol_event,
9467 .init_hook = alc889A_mb31_automute,
9469 [ALC883_SONY_VAIO_TT] = {
9470 .mixers = { alc883_vaiott_mixer },
9471 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9472 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9473 .dac_nids = alc883_dac_nids,
9474 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9475 .channel_mode = alc883_3ST_2ch_modes,
9476 .input_mux = &alc883_capture_source,
9477 .unsol_event = alc_automute_amp_unsol_event,
9478 .setup = alc883_vaiott_setup,
9479 .init_hook = alc_automute_amp,
9488 PINFIX_ABIT_AW9D_MAX
9491 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9492 { 0x15, 0x01080104 }, /* side */
9493 { 0x16, 0x01011012 }, /* rear */
9494 { 0x17, 0x01016011 }, /* clfe */
9498 static const struct alc_pincfg *alc882_pin_fixes[] = {
9499 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9502 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9503 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9508 * BIOS auto configuration
9510 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9511 const struct auto_pin_cfg *cfg)
9513 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9516 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9517 hda_nid_t nid, int pin_type,
9521 struct alc_spec *spec = codec->spec;
9524 alc_set_pin_output(codec, nid, pin_type);
9525 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9528 idx = spec->multiout.dac_nids[dac_idx] - 2;
9529 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9533 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9535 struct alc_spec *spec = codec->spec;
9538 for (i = 0; i <= HDA_SIDE; i++) {
9539 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9540 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9542 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9547 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9549 struct alc_spec *spec = codec->spec;
9552 pin = spec->autocfg.hp_pins[0];
9553 if (pin) /* connect to front */
9555 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9556 pin = spec->autocfg.speaker_pins[0];
9558 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9561 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9563 struct alc_spec *spec = codec->spec;
9566 for (i = 0; i < AUTO_PIN_LAST; i++) {
9567 hda_nid_t nid = spec->autocfg.input_pins[i];
9570 alc_set_input_pin(codec, nid, i);
9571 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9572 snd_hda_codec_write(codec, nid, 0,
9573 AC_VERB_SET_AMP_GAIN_MUTE,
9578 static void alc882_auto_init_input_src(struct hda_codec *codec)
9580 struct alc_spec *spec = codec->spec;
9583 for (c = 0; c < spec->num_adc_nids; c++) {
9584 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9585 hda_nid_t nid = spec->capsrc_nids[c];
9586 unsigned int mux_idx;
9587 const struct hda_input_mux *imux;
9588 int conns, mute, idx, item;
9590 conns = snd_hda_get_connections(codec, nid, conn_list,
9591 ARRAY_SIZE(conn_list));
9594 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9595 imux = &spec->input_mux[mux_idx];
9596 for (idx = 0; idx < conns; idx++) {
9597 /* if the current connection is the selected one,
9598 * unmute it as default - otherwise mute it
9600 mute = AMP_IN_MUTE(idx);
9601 for (item = 0; item < imux->num_items; item++) {
9602 if (imux->items[item].index == idx) {
9603 if (spec->cur_mux[c] == item)
9604 mute = AMP_IN_UNMUTE(idx);
9608 /* check if we have a selector or mixer
9609 * we could check for the widget type instead, but
9610 * just check for Amp-In presence (in case of mixer
9611 * without amp-in there is something wrong, this
9612 * function shouldn't be used or capsrc nid is wrong)
9614 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9615 snd_hda_codec_write(codec, nid, 0,
9616 AC_VERB_SET_AMP_GAIN_MUTE,
9618 else if (mute != AMP_IN_MUTE(idx))
9619 snd_hda_codec_write(codec, nid, 0,
9620 AC_VERB_SET_CONNECT_SEL,
9626 /* add mic boosts if needed */
9627 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9629 struct alc_spec *spec = codec->spec;
9633 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9634 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9635 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9637 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9641 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9642 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9643 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9645 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9652 /* almost identical with ALC880 parser... */
9653 static int alc882_parse_auto_config(struct hda_codec *codec)
9655 struct alc_spec *spec = codec->spec;
9656 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9659 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9663 if (!spec->autocfg.line_outs)
9664 return 0; /* can't find valid BIOS pin config */
9666 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9669 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9672 err = alc880_auto_create_extra_out(spec,
9673 spec->autocfg.speaker_pins[0],
9677 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9681 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9685 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9687 /* check multiple SPDIF-out (for recent codecs) */
9688 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9690 err = snd_hda_get_connections(codec,
9691 spec->autocfg.dig_out_pins[i],
9696 spec->multiout.dig_out_nid = dig_nid;
9698 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9699 spec->slave_dig_outs[i - 1] = dig_nid;
9700 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
9704 if (spec->autocfg.dig_in_pin)
9705 spec->dig_in_nid = ALC880_DIGIN_NID;
9707 if (spec->kctls.list)
9708 add_mixer(spec, spec->kctls.list);
9710 add_verb(spec, alc883_auto_init_verbs);
9711 /* if ADC 0x07 is available, initialize it, too */
9712 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9713 add_verb(spec, alc882_adc1_init_verbs);
9715 spec->num_mux_defs = 1;
9716 spec->input_mux = &spec->private_imux[0];
9718 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9720 err = alc_auto_add_mic_boost(codec);
9724 return 1; /* config found */
9727 /* additional initialization for auto-configuration model */
9728 static void alc882_auto_init(struct hda_codec *codec)
9730 struct alc_spec *spec = codec->spec;
9731 alc882_auto_init_multi_out(codec);
9732 alc882_auto_init_hp_out(codec);
9733 alc882_auto_init_analog_input(codec);
9734 alc882_auto_init_input_src(codec);
9735 if (spec->unsol_event)
9736 alc_inithook(codec);
9739 static int patch_alc882(struct hda_codec *codec)
9741 struct alc_spec *spec;
9742 int err, board_config;
9744 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9750 switch (codec->vendor_id) {
9755 /* ALC883 and variants */
9756 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9760 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9764 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9765 board_config = snd_hda_check_board_codec_sid_config(codec,
9766 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9768 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9769 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9771 board_config = ALC882_AUTO;
9774 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9776 if (board_config == ALC882_AUTO) {
9777 /* automatic parse from the BIOS config */
9778 err = alc882_parse_auto_config(codec);
9784 "hda_codec: Cannot set up configuration "
9785 "from BIOS. Using base mode...\n");
9786 board_config = ALC882_3ST_DIG;
9790 err = snd_hda_attach_beep_device(codec, 0x1);
9796 if (board_config != ALC882_AUTO)
9797 setup_preset(codec, &alc882_presets[board_config]);
9799 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9800 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9801 /* FIXME: setup DAC5 */
9802 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9803 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9805 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9806 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9808 if (codec->vendor_id == 0x10ec0888)
9809 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9811 if (!spec->adc_nids && spec->input_mux) {
9813 spec->num_adc_nids = 0;
9814 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9816 hda_nid_t nid = alc882_adc_nids[i];
9817 unsigned int wcap = get_wcaps(codec, nid);
9819 wcap = get_wcaps_type(wcap);
9820 if (wcap != AC_WID_AUD_IN)
9822 spec->private_adc_nids[spec->num_adc_nids] = nid;
9823 err = snd_hda_get_connections(codec, nid, &cap, 1);
9826 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9827 spec->num_adc_nids++;
9829 spec->adc_nids = spec->private_adc_nids;
9830 spec->capsrc_nids = spec->private_capsrc_nids;
9833 set_capture_mixer(codec);
9834 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9836 spec->vmaster_nid = 0x0c;
9838 codec->patch_ops = alc_patch_ops;
9839 if (board_config == ALC882_AUTO)
9840 spec->init_hook = alc882_auto_init;
9841 #ifdef CONFIG_SND_HDA_POWER_SAVE
9842 if (!spec->loopback.amplist)
9843 spec->loopback.amplist = alc882_loopbacks;
9845 codec->proc_widget_hook = print_realtek_coef;
9855 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9856 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9858 #define alc262_dac_nids alc260_dac_nids
9859 #define alc262_adc_nids alc882_adc_nids
9860 #define alc262_adc_nids_alt alc882_adc_nids_alt
9861 #define alc262_capsrc_nids alc882_capsrc_nids
9862 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9864 #define alc262_modes alc260_modes
9865 #define alc262_capture_source alc882_capture_source
9867 static hda_nid_t alc262_dmic_adc_nids[1] = {
9872 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9874 static struct snd_kcontrol_new alc262_base_mixer[] = {
9875 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9876 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9877 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9878 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9879 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9880 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9881 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9882 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9883 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9884 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9885 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9886 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9887 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9888 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9889 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9890 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9894 /* update HP, line and mono-out pins according to the master switch */
9895 static void alc262_hp_master_update(struct hda_codec *codec)
9897 struct alc_spec *spec = codec->spec;
9898 int val = spec->master_sw;
9901 snd_hda_codec_write_cache(codec, 0x1b, 0,
9902 AC_VERB_SET_PIN_WIDGET_CONTROL,
9904 snd_hda_codec_write_cache(codec, 0x15, 0,
9905 AC_VERB_SET_PIN_WIDGET_CONTROL,
9907 /* mono (speaker) depending on the HP jack sense */
9908 val = val && !spec->jack_present;
9909 snd_hda_codec_write_cache(codec, 0x16, 0,
9910 AC_VERB_SET_PIN_WIDGET_CONTROL,
9914 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9916 struct alc_spec *spec = codec->spec;
9917 unsigned int presence;
9918 presence = snd_hda_codec_read(codec, 0x1b, 0,
9919 AC_VERB_GET_PIN_SENSE, 0);
9920 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9921 alc262_hp_master_update(codec);
9924 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9926 if ((res >> 26) != ALC880_HP_EVENT)
9928 alc262_hp_bpc_automute(codec);
9931 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9933 struct alc_spec *spec = codec->spec;
9934 unsigned int presence;
9935 presence = snd_hda_codec_read(codec, 0x15, 0,
9936 AC_VERB_GET_PIN_SENSE, 0);
9937 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9938 alc262_hp_master_update(codec);
9941 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9944 if ((res >> 26) != ALC880_HP_EVENT)
9946 alc262_hp_wildwest_automute(codec);
9949 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9951 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9952 struct snd_ctl_elem_value *ucontrol)
9954 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9955 struct alc_spec *spec = codec->spec;
9956 int val = !!*ucontrol->value.integer.value;
9958 if (val == spec->master_sw)
9960 spec->master_sw = val;
9961 alc262_hp_master_update(codec);
9965 #define ALC262_HP_MASTER_SWITCH \
9967 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9968 .name = "Master Playback Switch", \
9969 .info = snd_ctl_boolean_mono_info, \
9970 .get = alc262_hp_master_sw_get, \
9971 .put = alc262_hp_master_sw_put, \
9974 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9975 ALC262_HP_MASTER_SWITCH,
9976 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9977 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9978 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9979 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9981 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9985 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9986 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9987 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9988 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9989 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9990 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9993 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9994 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9998 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9999 ALC262_HP_MASTER_SWITCH,
10000 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10001 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10002 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10003 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10004 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10006 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10008 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10009 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10010 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10011 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10012 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10013 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10014 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10018 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10019 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10020 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10021 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10025 /* mute/unmute internal speaker according to the hp jack and mute state */
10026 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10028 struct alc_spec *spec = codec->spec;
10030 spec->autocfg.hp_pins[0] = 0x15;
10031 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10034 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10035 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10036 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10037 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10038 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10039 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10040 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10041 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10045 static struct hda_verb alc262_hp_t5735_verbs[] = {
10046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10047 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10049 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10053 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10054 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10055 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10056 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10057 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10058 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10059 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10063 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10064 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10065 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10066 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10067 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10068 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10069 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10070 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10072 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10077 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10084 /* bind hp and internal speaker mute (with plug check) as master switch */
10085 static void alc262_hippo_master_update(struct hda_codec *codec)
10087 struct alc_spec *spec = codec->spec;
10088 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10089 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10090 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10094 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10095 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10096 HDA_AMP_MUTE, mute);
10097 /* mute internal speaker per jack sense */
10098 if (spec->jack_present)
10099 mute = HDA_AMP_MUTE;
10101 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10102 HDA_AMP_MUTE, mute);
10103 if (speaker_nid && speaker_nid != line_nid)
10104 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10105 HDA_AMP_MUTE, mute);
10108 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10110 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10111 struct snd_ctl_elem_value *ucontrol)
10113 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10114 struct alc_spec *spec = codec->spec;
10115 int val = !!*ucontrol->value.integer.value;
10117 if (val == spec->master_sw)
10119 spec->master_sw = val;
10120 alc262_hippo_master_update(codec);
10124 #define ALC262_HIPPO_MASTER_SWITCH \
10126 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10127 .name = "Master Playback Switch", \
10128 .info = snd_ctl_boolean_mono_info, \
10129 .get = alc262_hippo_master_sw_get, \
10130 .put = alc262_hippo_master_sw_put, \
10133 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10134 ALC262_HIPPO_MASTER_SWITCH,
10135 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10138 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10139 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10141 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10142 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10143 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10144 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10145 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10146 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10150 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10151 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10152 ALC262_HIPPO_MASTER_SWITCH,
10153 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10154 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10155 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10156 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10157 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10158 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10159 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10160 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10161 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10162 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10166 /* mute/unmute internal speaker according to the hp jack and mute state */
10167 static void alc262_hippo_automute(struct hda_codec *codec)
10169 struct alc_spec *spec = codec->spec;
10170 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10171 unsigned int present;
10173 /* need to execute and sync at first */
10174 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10175 present = snd_hda_codec_read(codec, hp_nid, 0,
10176 AC_VERB_GET_PIN_SENSE, 0);
10177 spec->jack_present = (present & 0x80000000) != 0;
10178 alc262_hippo_master_update(codec);
10181 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10183 if ((res >> 26) != ALC880_HP_EVENT)
10185 alc262_hippo_automute(codec);
10188 static void alc262_hippo_setup(struct hda_codec *codec)
10190 struct alc_spec *spec = codec->spec;
10192 spec->autocfg.hp_pins[0] = 0x15;
10193 spec->autocfg.speaker_pins[0] = 0x14;
10196 static void alc262_hippo1_setup(struct hda_codec *codec)
10198 struct alc_spec *spec = codec->spec;
10200 spec->autocfg.hp_pins[0] = 0x1b;
10201 spec->autocfg.speaker_pins[0] = 0x14;
10205 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10206 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10207 ALC262_HIPPO_MASTER_SWITCH,
10208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10210 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10211 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10215 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10216 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10217 ALC262_HIPPO_MASTER_SWITCH,
10218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10221 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10222 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10226 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10227 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10228 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10229 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10230 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10231 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10232 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10235 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10237 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10238 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10242 static struct hda_verb alc262_tyan_verbs[] = {
10243 /* Headphone automute */
10244 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10245 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10246 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10248 /* P11 AUX_IN, white 4-pin connector */
10249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10250 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10251 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10252 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10257 /* unsolicited event for HP jack sensing */
10258 static void alc262_tyan_setup(struct hda_codec *codec)
10260 struct alc_spec *spec = codec->spec;
10262 spec->autocfg.hp_pins[0] = 0x1b;
10263 spec->autocfg.speaker_pins[0] = 0x15;
10267 #define alc262_capture_mixer alc882_capture_mixer
10268 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10271 * generic initialization of ADC, input mixers and output mixers
10273 static struct hda_verb alc262_init_verbs[] = {
10275 * Unmute ADC0-2 and set the default input to mic-in
10277 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10279 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10280 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10281 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10282 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10284 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10286 * Note: PASD motherboards uses the Line In 2 as the input for
10287 * front panel mic (mic 2)
10289 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10297 * Set up output mixers (0x0c - 0x0e)
10299 /* set vol=0 to output mixers */
10300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10301 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10302 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10303 /* set up input amps for analog loopback */
10304 /* Amp Indices: DAC = 0, mixer = 1 */
10305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10307 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10308 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10309 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10310 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10313 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10314 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10315 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10316 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10317 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10319 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10320 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10321 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10322 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10323 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10325 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10326 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10328 /* FIXME: use matrix-type input source selection */
10329 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10330 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10336 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10337 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10338 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10341 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10349 static struct hda_verb alc262_eapd_verbs[] = {
10350 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10351 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10355 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10356 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10357 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10358 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10360 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10361 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10365 static struct hda_verb alc262_sony_unsol_verbs[] = {
10366 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10367 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10368 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10370 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10371 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10375 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10376 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10377 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10378 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10379 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10380 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10384 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10385 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10388 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10389 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10390 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10391 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10392 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10396 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10398 struct alc_spec *spec = codec->spec;
10400 spec->autocfg.hp_pins[0] = 0x15;
10401 spec->autocfg.speaker_pins[0] = 0x14;
10402 spec->ext_mic.pin = 0x18;
10403 spec->ext_mic.mux_idx = 0;
10404 spec->int_mic.pin = 0x12;
10405 spec->int_mic.mux_idx = 9;
10406 spec->auto_mic = 1;
10412 * 0x16 = internal speaker
10413 * 0x18 = external mic
10416 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10417 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10418 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10422 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10424 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10429 static struct hda_verb alc262_nec_verbs[] = {
10430 /* Unmute Speaker */
10431 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10434 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10437 /* External mic to headphone */
10438 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10439 /* External mic to speaker */
10440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10446 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10447 * 0x1b = port replicator headphone out
10450 #define ALC_HP_EVENT 0x37
10452 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10453 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10454 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10455 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10456 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10460 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10461 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10462 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10466 static struct hda_input_mux alc262_fujitsu_capture_source = {
10470 { "Int Mic", 0x1 },
10475 static struct hda_input_mux alc262_HP_capture_source = {
10479 { "Front Mic", 0x1 },
10486 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10490 { "Front Mic", 0x2 },
10496 /* mute/unmute internal speaker according to the hp jacks and mute state */
10497 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10499 struct alc_spec *spec = codec->spec;
10502 if (force || !spec->sense_updated) {
10503 unsigned int present;
10504 /* need to execute and sync at first */
10505 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10506 /* check laptop HP jack */
10507 present = snd_hda_codec_read(codec, 0x14, 0,
10508 AC_VERB_GET_PIN_SENSE, 0);
10509 /* need to execute and sync at first */
10510 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10511 /* check docking HP jack */
10512 present |= snd_hda_codec_read(codec, 0x1b, 0,
10513 AC_VERB_GET_PIN_SENSE, 0);
10514 if (present & AC_PINSENSE_PRESENCE)
10515 spec->jack_present = 1;
10517 spec->jack_present = 0;
10518 spec->sense_updated = 1;
10520 /* unmute internal speaker only if both HPs are unplugged and
10521 * master switch is on
10523 if (spec->jack_present)
10524 mute = HDA_AMP_MUTE;
10526 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10527 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10528 HDA_AMP_MUTE, mute);
10531 /* unsolicited event for HP jack sensing */
10532 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10535 if ((res >> 26) != ALC_HP_EVENT)
10537 alc262_fujitsu_automute(codec, 1);
10540 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10542 alc262_fujitsu_automute(codec, 1);
10545 /* bind volumes of both NID 0x0c and 0x0d */
10546 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10547 .ops = &snd_hda_bind_vol,
10549 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10550 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10555 /* mute/unmute internal speaker according to the hp jack and mute state */
10556 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10558 struct alc_spec *spec = codec->spec;
10561 if (force || !spec->sense_updated) {
10562 unsigned int present_int_hp;
10563 /* need to execute and sync at first */
10564 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10565 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10566 AC_VERB_GET_PIN_SENSE, 0);
10567 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10568 spec->sense_updated = 1;
10570 if (spec->jack_present) {
10571 /* mute internal speaker */
10572 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10573 HDA_AMP_MUTE, HDA_AMP_MUTE);
10574 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10575 HDA_AMP_MUTE, HDA_AMP_MUTE);
10577 /* unmute internal speaker if necessary */
10578 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10579 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10580 HDA_AMP_MUTE, mute);
10581 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10582 HDA_AMP_MUTE, mute);
10586 /* unsolicited event for HP jack sensing */
10587 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10590 if ((res >> 26) != ALC_HP_EVENT)
10592 alc262_lenovo_3000_automute(codec, 1);
10595 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10596 int dir, int idx, long *valp)
10600 for (i = 0; i < 2; i++, valp++)
10601 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10603 *valp ? 0 : HDA_AMP_MUTE);
10607 /* bind hp and internal speaker mute (with plug check) */
10608 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10609 struct snd_ctl_elem_value *ucontrol)
10611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10612 long *valp = ucontrol->value.integer.value;
10615 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10616 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10618 alc262_fujitsu_automute(codec, 0);
10622 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10623 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10625 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10626 .name = "Master Playback Switch",
10627 .info = snd_hda_mixer_amp_switch_info,
10628 .get = snd_hda_mixer_amp_switch_get,
10629 .put = alc262_fujitsu_master_sw_put,
10630 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10632 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10633 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10634 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10637 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10638 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10639 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10643 /* bind hp and internal speaker mute (with plug check) */
10644 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10645 struct snd_ctl_elem_value *ucontrol)
10647 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10648 long *valp = ucontrol->value.integer.value;
10651 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10653 alc262_lenovo_3000_automute(codec, 0);
10657 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10658 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10660 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10661 .name = "Master Playback Switch",
10662 .info = snd_hda_mixer_amp_switch_info,
10663 .get = snd_hda_mixer_amp_switch_get,
10664 .put = alc262_lenovo_3000_master_sw_put,
10665 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10667 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10668 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10669 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10672 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10673 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10674 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10678 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10679 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10680 ALC262_HIPPO_MASTER_SWITCH,
10681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10684 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10685 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10686 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10690 /* additional init verbs for Benq laptops */
10691 static struct hda_verb alc262_EAPD_verbs[] = {
10692 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10693 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10697 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10698 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10699 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10701 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10702 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10706 /* Samsung Q1 Ultra Vista model setup */
10707 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10708 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10709 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10710 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10711 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10712 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10713 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10717 static struct hda_verb alc262_ultra_verbs[] = {
10719 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10720 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10724 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10725 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10726 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10731 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10732 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10734 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10736 /* ADC, choose mic */
10737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10738 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10739 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10741 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10742 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10743 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10744 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10745 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10746 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10750 /* mute/unmute internal speaker according to the hp jack and mute state */
10751 static void alc262_ultra_automute(struct hda_codec *codec)
10753 struct alc_spec *spec = codec->spec;
10757 /* auto-mute only when HP is used as HP */
10758 if (!spec->cur_mux[0]) {
10759 unsigned int present;
10760 /* need to execute and sync at first */
10761 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10762 present = snd_hda_codec_read(codec, 0x15, 0,
10763 AC_VERB_GET_PIN_SENSE, 0);
10764 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10765 if (spec->jack_present)
10766 mute = HDA_AMP_MUTE;
10768 /* mute/unmute internal speaker */
10769 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10770 HDA_AMP_MUTE, mute);
10771 /* mute/unmute HP */
10772 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10773 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10776 /* unsolicited event for HP jack sensing */
10777 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10780 if ((res >> 26) != ALC880_HP_EVENT)
10782 alc262_ultra_automute(codec);
10785 static struct hda_input_mux alc262_ultra_capture_source = {
10789 { "Headphone", 0x7 },
10793 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10794 struct snd_ctl_elem_value *ucontrol)
10796 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10797 struct alc_spec *spec = codec->spec;
10800 ret = alc_mux_enum_put(kcontrol, ucontrol);
10803 /* reprogram the HP pin as mic or HP according to the input source */
10804 snd_hda_codec_write_cache(codec, 0x15, 0,
10805 AC_VERB_SET_PIN_WIDGET_CONTROL,
10806 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10807 alc262_ultra_automute(codec); /* mute/unmute HP */
10811 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10812 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10813 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10815 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10816 .name = "Capture Source",
10817 .info = alc_mux_enum_info,
10818 .get = alc_mux_enum_get,
10819 .put = alc262_ultra_mux_enum_put,
10824 /* We use two mixers depending on the output pin; 0x16 is a mono output
10825 * and thus it's bound with a different mixer.
10826 * This function returns which mixer amp should be used.
10828 static int alc262_check_volbit(hda_nid_t nid)
10832 else if (nid == 0x16)
10838 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
10839 const char *pfx, int *vbits)
10845 vbit = alc262_check_volbit(nid);
10848 if (*vbits & vbit) /* a volume control for this mixer already there */
10851 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
10853 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
10855 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
10856 return add_control(spec, ALC_CTL_WIDGET_VOL, name, val);
10859 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
10867 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
10869 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
10871 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
10872 return add_control(spec, ALC_CTL_WIDGET_MUTE, name, val);
10875 /* add playback controls from the parsed DAC table */
10876 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10877 const struct auto_pin_cfg *cfg)
10883 spec->multiout.num_dacs = 1; /* only use one dac */
10884 spec->multiout.dac_nids = spec->private_dac_nids;
10885 spec->multiout.dac_nids[0] = 2;
10887 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
10889 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
10893 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
10896 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
10899 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
10903 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
10904 alc262_check_volbit(cfg->speaker_pins[0]) |
10905 alc262_check_volbit(cfg->hp_pins[0]);
10906 if (vbits == 1 || vbits == 2)
10907 pfx = "Master"; /* only one mixer is used */
10908 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
10913 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
10916 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
10920 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
10927 #define alc262_auto_create_input_ctls \
10928 alc880_auto_create_input_ctls
10931 * generic initialization of ADC, input mixers and output mixers
10933 static struct hda_verb alc262_volume_init_verbs[] = {
10935 * Unmute ADC0-2 and set the default input to mic-in
10937 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10939 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10940 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10941 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10942 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10944 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10946 * Note: PASD motherboards uses the Line In 2 as the input for
10947 * front panel mic (mic 2)
10949 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10950 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10951 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10952 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10953 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10954 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10957 * Set up output mixers (0x0c - 0x0f)
10959 /* set vol=0 to output mixers */
10960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10961 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10962 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10964 /* set up input amps for analog loopback */
10965 /* Amp Indices: DAC = 0, mixer = 1 */
10966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10967 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10968 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10969 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10970 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10971 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10973 /* FIXME: use matrix-type input source selection */
10974 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10975 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10976 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10977 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10978 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10981 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10982 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10983 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10984 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10986 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10989 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10994 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10996 * Unmute ADC0-2 and set the default input to mic-in
10998 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10999 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11000 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11001 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11002 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11003 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11005 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11007 * Note: PASD motherboards uses the Line In 2 as the input for
11008 * front panel mic (mic 2)
11010 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11017 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11020 * Set up output mixers (0x0c - 0x0e)
11022 /* set vol=0 to output mixers */
11023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11024 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11025 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11027 /* set up input amps for analog loopback */
11028 /* Amp Indices: DAC = 0, mixer = 1 */
11029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11030 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11031 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11032 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11034 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11036 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11037 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11038 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11040 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11043 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11044 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11047 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11048 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11049 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11050 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11052 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11053 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11054 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11056 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11057 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11060 /* FIXME: use matrix-type input source selection */
11061 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11062 /* Input mixer1: only unmute Mic */
11063 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11074 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11076 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11077 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11078 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11079 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11080 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11081 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11093 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11098 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11100 * Unmute ADC0-2 and set the default input to mic-in
11102 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11104 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11105 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11106 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11107 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11109 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11111 * Note: PASD motherboards uses the Line In 2 as the input for front
11112 * panel mic (mic 2)
11114 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11124 * Set up output mixers (0x0c - 0x0e)
11126 /* set vol=0 to output mixers */
11127 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11128 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11129 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11131 /* set up input amps for analog loopback */
11132 /* Amp Indices: DAC = 0, mixer = 1 */
11133 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11135 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11137 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11142 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11143 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11144 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11145 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11146 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11147 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11149 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11150 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11152 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11153 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11155 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11156 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11157 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11158 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11159 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11160 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11162 /* FIXME: use matrix-type input source selection */
11163 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11164 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11165 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11166 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11167 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11168 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11169 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11170 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11171 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11176 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11177 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11178 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11179 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11181 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11182 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11183 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11184 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11186 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11187 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11189 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11194 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11196 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11197 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11198 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11200 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11201 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11202 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11203 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11205 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11206 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11207 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11212 #ifdef CONFIG_SND_HDA_POWER_SAVE
11213 #define alc262_loopbacks alc880_loopbacks
11216 /* pcm configuration: identical with ALC880 */
11217 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11218 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11219 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11220 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11223 * BIOS auto configuration
11225 static int alc262_parse_auto_config(struct hda_codec *codec)
11227 struct alc_spec *spec = codec->spec;
11229 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11231 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11235 if (!spec->autocfg.line_outs) {
11236 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11237 spec->multiout.max_channels = 2;
11238 spec->no_analog = 1;
11241 return 0; /* can't find valid BIOS pin config */
11243 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11246 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11250 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11253 if (spec->autocfg.dig_outs) {
11254 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11255 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11257 if (spec->autocfg.dig_in_pin)
11258 spec->dig_in_nid = ALC262_DIGIN_NID;
11260 if (spec->kctls.list)
11261 add_mixer(spec, spec->kctls.list);
11263 add_verb(spec, alc262_volume_init_verbs);
11264 spec->num_mux_defs = 1;
11265 spec->input_mux = &spec->private_imux[0];
11267 err = alc_auto_add_mic_boost(codec);
11271 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11276 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11277 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11278 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11279 #define alc262_auto_init_input_src alc882_auto_init_input_src
11282 /* init callback for auto-configuration model -- overriding the default init */
11283 static void alc262_auto_init(struct hda_codec *codec)
11285 struct alc_spec *spec = codec->spec;
11286 alc262_auto_init_multi_out(codec);
11287 alc262_auto_init_hp_out(codec);
11288 alc262_auto_init_analog_input(codec);
11289 alc262_auto_init_input_src(codec);
11290 if (spec->unsol_event)
11291 alc_inithook(codec);
11295 * configuration and preset
11297 static const char *alc262_models[ALC262_MODEL_LAST] = {
11298 [ALC262_BASIC] = "basic",
11299 [ALC262_HIPPO] = "hippo",
11300 [ALC262_HIPPO_1] = "hippo_1",
11301 [ALC262_FUJITSU] = "fujitsu",
11302 [ALC262_HP_BPC] = "hp-bpc",
11303 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11304 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11305 [ALC262_HP_RP5700] = "hp-rp5700",
11306 [ALC262_BENQ_ED8] = "benq",
11307 [ALC262_BENQ_T31] = "benq-t31",
11308 [ALC262_SONY_ASSAMD] = "sony-assamd",
11309 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11310 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11311 [ALC262_ULTRA] = "ultra",
11312 [ALC262_LENOVO_3000] = "lenovo-3000",
11313 [ALC262_NEC] = "nec",
11314 [ALC262_TYAN] = "tyan",
11315 [ALC262_AUTO] = "auto",
11318 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11319 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11320 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11321 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11323 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11325 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11327 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11328 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11329 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11330 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11331 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11332 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11333 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11334 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11335 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11336 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11337 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11338 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11339 ALC262_HP_TC_T5735),
11340 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11341 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11342 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11343 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11344 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11345 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11346 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11347 ALC262_SONY_ASSAMD),
11348 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11349 ALC262_TOSHIBA_RX1),
11350 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11351 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11352 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11353 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11354 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11356 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11357 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11358 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11359 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11360 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11364 static struct alc_config_preset alc262_presets[] = {
11366 .mixers = { alc262_base_mixer },
11367 .init_verbs = { alc262_init_verbs },
11368 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11369 .dac_nids = alc262_dac_nids,
11371 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11372 .channel_mode = alc262_modes,
11373 .input_mux = &alc262_capture_source,
11376 .mixers = { alc262_hippo_mixer },
11377 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11378 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11379 .dac_nids = alc262_dac_nids,
11381 .dig_out_nid = ALC262_DIGOUT_NID,
11382 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11383 .channel_mode = alc262_modes,
11384 .input_mux = &alc262_capture_source,
11385 .unsol_event = alc262_hippo_unsol_event,
11386 .setup = alc262_hippo_setup,
11387 .init_hook = alc262_hippo_automute,
11389 [ALC262_HIPPO_1] = {
11390 .mixers = { alc262_hippo1_mixer },
11391 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11392 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11393 .dac_nids = alc262_dac_nids,
11395 .dig_out_nid = ALC262_DIGOUT_NID,
11396 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11397 .channel_mode = alc262_modes,
11398 .input_mux = &alc262_capture_source,
11399 .unsol_event = alc262_hippo_unsol_event,
11400 .setup = alc262_hippo1_setup,
11401 .init_hook = alc262_hippo_automute,
11403 [ALC262_FUJITSU] = {
11404 .mixers = { alc262_fujitsu_mixer },
11405 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11406 alc262_fujitsu_unsol_verbs },
11407 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11408 .dac_nids = alc262_dac_nids,
11410 .dig_out_nid = ALC262_DIGOUT_NID,
11411 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11412 .channel_mode = alc262_modes,
11413 .input_mux = &alc262_fujitsu_capture_source,
11414 .unsol_event = alc262_fujitsu_unsol_event,
11415 .init_hook = alc262_fujitsu_init_hook,
11417 [ALC262_HP_BPC] = {
11418 .mixers = { alc262_HP_BPC_mixer },
11419 .init_verbs = { alc262_HP_BPC_init_verbs },
11420 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11421 .dac_nids = alc262_dac_nids,
11423 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11424 .channel_mode = alc262_modes,
11425 .input_mux = &alc262_HP_capture_source,
11426 .unsol_event = alc262_hp_bpc_unsol_event,
11427 .init_hook = alc262_hp_bpc_automute,
11429 [ALC262_HP_BPC_D7000_WF] = {
11430 .mixers = { alc262_HP_BPC_WildWest_mixer },
11431 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11432 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11433 .dac_nids = alc262_dac_nids,
11435 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11436 .channel_mode = alc262_modes,
11437 .input_mux = &alc262_HP_D7000_capture_source,
11438 .unsol_event = alc262_hp_wildwest_unsol_event,
11439 .init_hook = alc262_hp_wildwest_automute,
11441 [ALC262_HP_BPC_D7000_WL] = {
11442 .mixers = { alc262_HP_BPC_WildWest_mixer,
11443 alc262_HP_BPC_WildWest_option_mixer },
11444 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11445 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11446 .dac_nids = alc262_dac_nids,
11448 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11449 .channel_mode = alc262_modes,
11450 .input_mux = &alc262_HP_D7000_capture_source,
11451 .unsol_event = alc262_hp_wildwest_unsol_event,
11452 .init_hook = alc262_hp_wildwest_automute,
11454 [ALC262_HP_TC_T5735] = {
11455 .mixers = { alc262_hp_t5735_mixer },
11456 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11457 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11458 .dac_nids = alc262_dac_nids,
11460 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11461 .channel_mode = alc262_modes,
11462 .input_mux = &alc262_capture_source,
11463 .unsol_event = alc_automute_amp_unsol_event,
11464 .setup = alc262_hp_t5735_setup,
11465 .init_hook = alc_automute_amp,
11467 [ALC262_HP_RP5700] = {
11468 .mixers = { alc262_hp_rp5700_mixer },
11469 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11470 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11471 .dac_nids = alc262_dac_nids,
11472 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11473 .channel_mode = alc262_modes,
11474 .input_mux = &alc262_hp_rp5700_capture_source,
11476 [ALC262_BENQ_ED8] = {
11477 .mixers = { alc262_base_mixer },
11478 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11479 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11480 .dac_nids = alc262_dac_nids,
11482 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11483 .channel_mode = alc262_modes,
11484 .input_mux = &alc262_capture_source,
11486 [ALC262_SONY_ASSAMD] = {
11487 .mixers = { alc262_sony_mixer },
11488 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11489 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11490 .dac_nids = alc262_dac_nids,
11492 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11493 .channel_mode = alc262_modes,
11494 .input_mux = &alc262_capture_source,
11495 .unsol_event = alc262_hippo_unsol_event,
11496 .setup = alc262_hippo_setup,
11497 .init_hook = alc262_hippo_automute,
11499 [ALC262_BENQ_T31] = {
11500 .mixers = { alc262_benq_t31_mixer },
11501 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11502 alc_hp15_unsol_verbs },
11503 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11504 .dac_nids = alc262_dac_nids,
11506 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11507 .channel_mode = alc262_modes,
11508 .input_mux = &alc262_capture_source,
11509 .unsol_event = alc262_hippo_unsol_event,
11510 .setup = alc262_hippo_setup,
11511 .init_hook = alc262_hippo_automute,
11514 .mixers = { alc262_ultra_mixer },
11515 .cap_mixer = alc262_ultra_capture_mixer,
11516 .init_verbs = { alc262_ultra_verbs },
11517 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11518 .dac_nids = alc262_dac_nids,
11519 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11520 .channel_mode = alc262_modes,
11521 .input_mux = &alc262_ultra_capture_source,
11522 .adc_nids = alc262_adc_nids, /* ADC0 */
11523 .capsrc_nids = alc262_capsrc_nids,
11524 .num_adc_nids = 1, /* single ADC */
11525 .unsol_event = alc262_ultra_unsol_event,
11526 .init_hook = alc262_ultra_automute,
11528 [ALC262_LENOVO_3000] = {
11529 .mixers = { alc262_lenovo_3000_mixer },
11530 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11531 alc262_lenovo_3000_unsol_verbs },
11532 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11533 .dac_nids = alc262_dac_nids,
11535 .dig_out_nid = ALC262_DIGOUT_NID,
11536 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11537 .channel_mode = alc262_modes,
11538 .input_mux = &alc262_fujitsu_capture_source,
11539 .unsol_event = alc262_lenovo_3000_unsol_event,
11542 .mixers = { alc262_nec_mixer },
11543 .init_verbs = { alc262_nec_verbs },
11544 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11545 .dac_nids = alc262_dac_nids,
11547 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11548 .channel_mode = alc262_modes,
11549 .input_mux = &alc262_capture_source,
11551 [ALC262_TOSHIBA_S06] = {
11552 .mixers = { alc262_toshiba_s06_mixer },
11553 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11554 alc262_eapd_verbs },
11555 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11556 .capsrc_nids = alc262_dmic_capsrc_nids,
11557 .dac_nids = alc262_dac_nids,
11558 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11559 .num_adc_nids = 1, /* single ADC */
11560 .dig_out_nid = ALC262_DIGOUT_NID,
11561 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11562 .channel_mode = alc262_modes,
11563 .unsol_event = alc_sku_unsol_event,
11564 .setup = alc262_toshiba_s06_setup,
11565 .init_hook = alc_inithook,
11567 [ALC262_TOSHIBA_RX1] = {
11568 .mixers = { alc262_toshiba_rx1_mixer },
11569 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11570 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11571 .dac_nids = alc262_dac_nids,
11573 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11574 .channel_mode = alc262_modes,
11575 .input_mux = &alc262_capture_source,
11576 .unsol_event = alc262_hippo_unsol_event,
11577 .setup = alc262_hippo_setup,
11578 .init_hook = alc262_hippo_automute,
11581 .mixers = { alc262_tyan_mixer },
11582 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11583 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11584 .dac_nids = alc262_dac_nids,
11586 .dig_out_nid = ALC262_DIGOUT_NID,
11587 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11588 .channel_mode = alc262_modes,
11589 .input_mux = &alc262_capture_source,
11590 .unsol_event = alc_automute_amp_unsol_event,
11591 .setup = alc262_tyan_setup,
11592 .init_hook = alc_automute_amp,
11596 static int patch_alc262(struct hda_codec *codec)
11598 struct alc_spec *spec;
11602 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11606 codec->spec = spec;
11608 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11613 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11614 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11615 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11616 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11620 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11622 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11626 if (board_config < 0) {
11627 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11629 board_config = ALC262_AUTO;
11632 if (board_config == ALC262_AUTO) {
11633 /* automatic parse from the BIOS config */
11634 err = alc262_parse_auto_config(codec);
11640 "hda_codec: Cannot set up configuration "
11641 "from BIOS. Using base mode...\n");
11642 board_config = ALC262_BASIC;
11646 if (!spec->no_analog) {
11647 err = snd_hda_attach_beep_device(codec, 0x1);
11654 if (board_config != ALC262_AUTO)
11655 setup_preset(codec, &alc262_presets[board_config]);
11657 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11658 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11660 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11661 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11663 if (!spec->adc_nids && spec->input_mux) {
11665 /* check whether the digital-mic has to be supported */
11666 for (i = 0; i < spec->input_mux->num_items; i++) {
11667 if (spec->input_mux->items[i].index >= 9)
11670 if (i < spec->input_mux->num_items) {
11671 /* use only ADC0 */
11672 spec->adc_nids = alc262_dmic_adc_nids;
11673 spec->num_adc_nids = 1;
11674 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11676 /* all analog inputs */
11677 /* check whether NID 0x07 is valid */
11678 unsigned int wcap = get_wcaps(codec, 0x07);
11681 wcap = get_wcaps_type(wcap);
11682 if (wcap != AC_WID_AUD_IN) {
11683 spec->adc_nids = alc262_adc_nids_alt;
11684 spec->num_adc_nids =
11685 ARRAY_SIZE(alc262_adc_nids_alt);
11686 spec->capsrc_nids = alc262_capsrc_nids_alt;
11688 spec->adc_nids = alc262_adc_nids;
11689 spec->num_adc_nids =
11690 ARRAY_SIZE(alc262_adc_nids);
11691 spec->capsrc_nids = alc262_capsrc_nids;
11695 if (!spec->cap_mixer && !spec->no_analog)
11696 set_capture_mixer(codec);
11697 if (!spec->no_analog)
11698 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11700 spec->vmaster_nid = 0x0c;
11702 codec->patch_ops = alc_patch_ops;
11703 if (board_config == ALC262_AUTO)
11704 spec->init_hook = alc262_auto_init;
11705 #ifdef CONFIG_SND_HDA_POWER_SAVE
11706 if (!spec->loopback.amplist)
11707 spec->loopback.amplist = alc262_loopbacks;
11709 codec->proc_widget_hook = print_realtek_coef;
11715 * ALC268 channel source setting (2 channel)
11717 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11718 #define alc268_modes alc260_modes
11720 static hda_nid_t alc268_dac_nids[2] = {
11725 static hda_nid_t alc268_adc_nids[2] = {
11730 static hda_nid_t alc268_adc_nids_alt[1] = {
11735 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11737 static struct snd_kcontrol_new alc268_base_mixer[] = {
11738 /* output mixer control */
11739 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11740 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11741 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11743 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11744 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11745 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11749 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11750 /* output mixer control */
11751 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11752 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11753 ALC262_HIPPO_MASTER_SWITCH,
11754 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11755 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11756 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11760 /* bind Beep switches of both NID 0x0f and 0x10 */
11761 static struct hda_bind_ctls alc268_bind_beep_sw = {
11762 .ops = &snd_hda_bind_sw,
11764 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11765 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11770 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11771 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11772 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11776 static struct hda_verb alc268_eapd_verbs[] = {
11777 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11778 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11782 /* Toshiba specific */
11783 static struct hda_verb alc268_toshiba_verbs[] = {
11784 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11788 /* Acer specific */
11789 /* bind volumes of both NID 0x02 and 0x03 */
11790 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11791 .ops = &snd_hda_bind_vol,
11793 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11794 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11799 /* mute/unmute internal speaker according to the hp jack and mute state */
11800 static void alc268_acer_automute(struct hda_codec *codec, int force)
11802 struct alc_spec *spec = codec->spec;
11805 if (force || !spec->sense_updated) {
11806 unsigned int present;
11807 present = snd_hda_codec_read(codec, 0x14, 0,
11808 AC_VERB_GET_PIN_SENSE, 0);
11809 spec->jack_present = (present & 0x80000000) != 0;
11810 spec->sense_updated = 1;
11812 if (spec->jack_present)
11813 mute = HDA_AMP_MUTE; /* mute internal speaker */
11814 else /* unmute internal speaker if necessary */
11815 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11816 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11817 HDA_AMP_MUTE, mute);
11821 /* bind hp and internal speaker mute (with plug check) */
11822 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11823 struct snd_ctl_elem_value *ucontrol)
11825 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11826 long *valp = ucontrol->value.integer.value;
11829 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11831 alc268_acer_automute(codec, 0);
11835 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11836 /* output mixer control */
11837 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11839 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11840 .name = "Master Playback Switch",
11841 .info = snd_hda_mixer_amp_switch_info,
11842 .get = snd_hda_mixer_amp_switch_get,
11843 .put = alc268_acer_master_sw_put,
11844 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11846 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11850 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11851 /* output mixer control */
11852 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11854 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11855 .name = "Master Playback Switch",
11856 .info = snd_hda_mixer_amp_switch_info,
11857 .get = snd_hda_mixer_amp_switch_get,
11858 .put = alc268_acer_master_sw_put,
11859 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11861 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11862 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11863 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11867 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11868 /* output mixer control */
11869 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11871 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11872 .name = "Master Playback Switch",
11873 .info = snd_hda_mixer_amp_switch_info,
11874 .get = snd_hda_mixer_amp_switch_get,
11875 .put = alc268_acer_master_sw_put,
11876 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11878 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11879 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11883 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11884 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11885 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11886 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11887 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11888 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11889 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11893 static struct hda_verb alc268_acer_verbs[] = {
11894 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11895 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11896 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11897 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11898 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11899 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11900 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11904 /* unsolicited event for HP jack sensing */
11905 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11906 #define alc268_toshiba_setup alc262_hippo_setup
11907 #define alc268_toshiba_automute alc262_hippo_automute
11909 static void alc268_acer_unsol_event(struct hda_codec *codec,
11912 if ((res >> 26) != ALC880_HP_EVENT)
11914 alc268_acer_automute(codec, 1);
11917 static void alc268_acer_init_hook(struct hda_codec *codec)
11919 alc268_acer_automute(codec, 1);
11922 /* toggle speaker-output according to the hp-jack state */
11923 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11925 unsigned int present;
11926 unsigned char bits;
11928 present = snd_hda_codec_read(codec, 0x15, 0,
11929 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11930 bits = present ? AMP_IN_MUTE(0) : 0;
11931 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11932 AMP_IN_MUTE(0), bits);
11933 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11934 AMP_IN_MUTE(0), bits);
11937 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11940 switch (res >> 26) {
11941 case ALC880_HP_EVENT:
11942 alc268_aspire_one_speaker_automute(codec);
11944 case ALC880_MIC_EVENT:
11945 alc_mic_automute(codec);
11950 static void alc268_acer_lc_setup(struct hda_codec *codec)
11952 struct alc_spec *spec = codec->spec;
11953 spec->ext_mic.pin = 0x18;
11954 spec->ext_mic.mux_idx = 0;
11955 spec->int_mic.pin = 0x12;
11956 spec->int_mic.mux_idx = 6;
11957 spec->auto_mic = 1;
11960 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11962 alc268_aspire_one_speaker_automute(codec);
11963 alc_mic_automute(codec);
11966 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11967 /* output mixer control */
11968 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11969 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11970 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11971 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11972 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11973 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11977 static struct hda_verb alc268_dell_verbs[] = {
11978 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11979 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11980 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11981 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11985 /* mute/unmute internal speaker according to the hp jack and mute state */
11986 static void alc268_dell_setup(struct hda_codec *codec)
11988 struct alc_spec *spec = codec->spec;
11990 spec->autocfg.hp_pins[0] = 0x15;
11991 spec->autocfg.speaker_pins[0] = 0x14;
11992 spec->ext_mic.pin = 0x18;
11993 spec->ext_mic.mux_idx = 0;
11994 spec->int_mic.pin = 0x19;
11995 spec->int_mic.mux_idx = 1;
11996 spec->auto_mic = 1;
11999 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12000 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12001 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12002 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12003 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12004 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12005 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12006 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12007 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12011 static struct hda_verb alc267_quanta_il1_verbs[] = {
12012 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12013 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12017 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12019 struct alc_spec *spec = codec->spec;
12020 spec->autocfg.hp_pins[0] = 0x15;
12021 spec->autocfg.speaker_pins[0] = 0x14;
12022 spec->ext_mic.pin = 0x18;
12023 spec->ext_mic.mux_idx = 0;
12024 spec->int_mic.pin = 0x19;
12025 spec->int_mic.mux_idx = 1;
12026 spec->auto_mic = 1;
12030 * generic initialization of ADC, input mixers and output mixers
12032 static struct hda_verb alc268_base_init_verbs[] = {
12033 /* Unmute DAC0-1 and set vol = 0 */
12034 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12035 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12038 * Set up output mixers (0x0c - 0x0e)
12040 /* set vol=0 to output mixers */
12041 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12042 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12044 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12045 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12047 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12048 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12049 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12050 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12051 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12052 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12053 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12054 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12056 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12058 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12059 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12060 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12062 /* set PCBEEP vol = 0, mute connections */
12063 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12064 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12065 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12067 /* Unmute Selector 23h,24h and set the default input to mic-in */
12069 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12070 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12071 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12072 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12078 * generic initialization of ADC, input mixers and output mixers
12080 static struct hda_verb alc268_volume_init_verbs[] = {
12081 /* set output DAC */
12082 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12083 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12085 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12086 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12087 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12088 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12089 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12091 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12092 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12093 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12095 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12096 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12098 /* set PCBEEP vol = 0, mute connections */
12099 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12100 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12101 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12106 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12107 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12108 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12112 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12113 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12114 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12119 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12120 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12121 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12122 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12123 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12128 static struct hda_input_mux alc268_capture_source = {
12132 { "Front Mic", 0x1 },
12138 static struct hda_input_mux alc268_acer_capture_source = {
12142 { "Internal Mic", 0x1 },
12147 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12151 { "Internal Mic", 0x6 },
12156 #ifdef CONFIG_SND_DEBUG
12157 static struct snd_kcontrol_new alc268_test_mixer[] = {
12158 /* Volume widgets */
12159 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12160 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12161 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12162 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12163 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12164 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12165 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12166 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12167 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12168 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12169 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12170 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12171 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12172 /* The below appears problematic on some hardwares */
12173 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12174 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12175 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12176 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12177 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12179 /* Modes for retasking pin widgets */
12180 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12181 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12182 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12183 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12185 /* Controls for GPIO pins, assuming they are configured as outputs */
12186 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12187 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12188 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12189 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12191 /* Switches to allow the digital SPDIF output pin to be enabled.
12192 * The ALC268 does not have an SPDIF input.
12194 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12196 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12197 * this output to turn on an external amplifier.
12199 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12200 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12206 /* create input playback/capture controls for the given pin */
12207 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12208 const char *ctlname, int idx)
12214 sprintf(name, "%s Playback Volume", ctlname);
12226 if (spec->multiout.dac_nids[0] != dac &&
12227 spec->multiout.dac_nids[1] != dac) {
12228 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12229 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12233 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12236 sprintf(name, "%s Playback Switch", ctlname);
12238 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12239 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12241 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12242 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12248 /* add playback controls from the parsed DAC table */
12249 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12250 const struct auto_pin_cfg *cfg)
12255 spec->multiout.dac_nids = spec->private_dac_nids;
12257 nid = cfg->line_out_pins[0];
12260 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12264 err = alc268_new_analog_output(spec, nid, name, 0);
12269 nid = cfg->speaker_pins[0];
12271 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12272 "Speaker Playback Volume",
12273 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12277 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12281 nid = cfg->hp_pins[0];
12283 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12288 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12290 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12291 "Mono Playback Switch",
12292 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12299 /* create playback/capture controls for input pins */
12300 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12301 const struct auto_pin_cfg *cfg)
12303 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12306 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12307 hda_nid_t nid, int pin_type)
12311 alc_set_pin_output(codec, nid, pin_type);
12312 if (nid == 0x14 || nid == 0x16)
12316 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12319 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12321 struct alc_spec *spec = codec->spec;
12322 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12324 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12325 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12329 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12331 struct alc_spec *spec = codec->spec;
12334 pin = spec->autocfg.hp_pins[0];
12336 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12337 pin = spec->autocfg.speaker_pins[0];
12339 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12342 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12344 struct alc_spec *spec = codec->spec;
12345 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12346 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12347 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12348 unsigned int dac_vol1, dac_vol2;
12350 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12351 snd_hda_codec_write(codec, speaker_nid, 0,
12352 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12353 /* mute mixer inputs from 0x1d */
12354 snd_hda_codec_write(codec, 0x0f, 0,
12355 AC_VERB_SET_AMP_GAIN_MUTE,
12357 snd_hda_codec_write(codec, 0x10, 0,
12358 AC_VERB_SET_AMP_GAIN_MUTE,
12361 /* unmute mixer inputs from 0x1d */
12362 snd_hda_codec_write(codec, 0x0f, 0,
12363 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12364 snd_hda_codec_write(codec, 0x10, 0,
12365 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12368 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12369 if (line_nid == 0x14)
12370 dac_vol2 = AMP_OUT_ZERO;
12371 else if (line_nid == 0x15)
12372 dac_vol1 = AMP_OUT_ZERO;
12373 if (hp_nid == 0x14)
12374 dac_vol2 = AMP_OUT_ZERO;
12375 else if (hp_nid == 0x15)
12376 dac_vol1 = AMP_OUT_ZERO;
12377 if (line_nid != 0x16 || hp_nid != 0x16 ||
12378 spec->autocfg.line_out_pins[1] != 0x16 ||
12379 spec->autocfg.line_out_pins[2] != 0x16)
12380 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12382 snd_hda_codec_write(codec, 0x02, 0,
12383 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12384 snd_hda_codec_write(codec, 0x03, 0,
12385 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12388 /* pcm configuration: identical with ALC880 */
12389 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12390 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12391 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12392 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12395 * BIOS auto configuration
12397 static int alc268_parse_auto_config(struct hda_codec *codec)
12399 struct alc_spec *spec = codec->spec;
12401 static hda_nid_t alc268_ignore[] = { 0 };
12403 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12407 if (!spec->autocfg.line_outs) {
12408 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12409 spec->multiout.max_channels = 2;
12410 spec->no_analog = 1;
12413 return 0; /* can't find valid BIOS pin config */
12415 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12418 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12422 spec->multiout.max_channels = 2;
12425 /* digital only support output */
12426 if (spec->autocfg.dig_outs) {
12427 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12428 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12430 if (spec->kctls.list)
12431 add_mixer(spec, spec->kctls.list);
12433 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12434 add_mixer(spec, alc268_beep_mixer);
12436 add_verb(spec, alc268_volume_init_verbs);
12437 spec->num_mux_defs = 2;
12438 spec->input_mux = &spec->private_imux[0];
12440 err = alc_auto_add_mic_boost(codec);
12444 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12449 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12451 /* init callback for auto-configuration model -- overriding the default init */
12452 static void alc268_auto_init(struct hda_codec *codec)
12454 struct alc_spec *spec = codec->spec;
12455 alc268_auto_init_multi_out(codec);
12456 alc268_auto_init_hp_out(codec);
12457 alc268_auto_init_mono_speaker_out(codec);
12458 alc268_auto_init_analog_input(codec);
12459 if (spec->unsol_event)
12460 alc_inithook(codec);
12464 * configuration and preset
12466 static const char *alc268_models[ALC268_MODEL_LAST] = {
12467 [ALC267_QUANTA_IL1] = "quanta-il1",
12468 [ALC268_3ST] = "3stack",
12469 [ALC268_TOSHIBA] = "toshiba",
12470 [ALC268_ACER] = "acer",
12471 [ALC268_ACER_DMIC] = "acer-dmic",
12472 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12473 [ALC268_DELL] = "dell",
12474 [ALC268_ZEPTO] = "zepto",
12475 #ifdef CONFIG_SND_DEBUG
12476 [ALC268_TEST] = "test",
12478 [ALC268_AUTO] = "auto",
12481 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12482 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12483 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12484 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12485 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12486 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12487 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12488 ALC268_ACER_ASPIRE_ONE),
12489 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12490 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12491 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12493 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12494 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12495 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12496 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12497 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12498 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12502 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12503 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12504 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12505 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12506 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12511 static struct alc_config_preset alc268_presets[] = {
12512 [ALC267_QUANTA_IL1] = {
12513 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12514 alc268_capture_nosrc_mixer },
12515 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12516 alc267_quanta_il1_verbs },
12517 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12518 .dac_nids = alc268_dac_nids,
12519 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12520 .adc_nids = alc268_adc_nids_alt,
12522 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12523 .channel_mode = alc268_modes,
12524 .unsol_event = alc_sku_unsol_event,
12525 .setup = alc267_quanta_il1_setup,
12526 .init_hook = alc_inithook,
12529 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12530 alc268_beep_mixer },
12531 .init_verbs = { alc268_base_init_verbs },
12532 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12533 .dac_nids = alc268_dac_nids,
12534 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12535 .adc_nids = alc268_adc_nids_alt,
12536 .capsrc_nids = alc268_capsrc_nids,
12538 .dig_out_nid = ALC268_DIGOUT_NID,
12539 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12540 .channel_mode = alc268_modes,
12541 .input_mux = &alc268_capture_source,
12543 [ALC268_TOSHIBA] = {
12544 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12545 alc268_beep_mixer },
12546 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12547 alc268_toshiba_verbs },
12548 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12549 .dac_nids = alc268_dac_nids,
12550 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12551 .adc_nids = alc268_adc_nids_alt,
12552 .capsrc_nids = alc268_capsrc_nids,
12554 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12555 .channel_mode = alc268_modes,
12556 .input_mux = &alc268_capture_source,
12557 .unsol_event = alc268_toshiba_unsol_event,
12558 .setup = alc268_toshiba_setup,
12559 .init_hook = alc268_toshiba_automute,
12562 .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer,
12563 alc268_beep_mixer },
12564 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12565 alc268_acer_verbs },
12566 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12567 .dac_nids = alc268_dac_nids,
12568 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12569 .adc_nids = alc268_adc_nids_alt,
12570 .capsrc_nids = alc268_capsrc_nids,
12572 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12573 .channel_mode = alc268_modes,
12574 .input_mux = &alc268_acer_capture_source,
12575 .unsol_event = alc268_acer_unsol_event,
12576 .init_hook = alc268_acer_init_hook,
12578 [ALC268_ACER_DMIC] = {
12579 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12580 alc268_beep_mixer },
12581 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12582 alc268_acer_verbs },
12583 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12584 .dac_nids = alc268_dac_nids,
12585 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12586 .adc_nids = alc268_adc_nids_alt,
12587 .capsrc_nids = alc268_capsrc_nids,
12589 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12590 .channel_mode = alc268_modes,
12591 .input_mux = &alc268_acer_dmic_capture_source,
12592 .unsol_event = alc268_acer_unsol_event,
12593 .init_hook = alc268_acer_init_hook,
12595 [ALC268_ACER_ASPIRE_ONE] = {
12596 .mixers = { alc268_acer_aspire_one_mixer,
12598 alc268_capture_nosrc_mixer },
12599 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12600 alc268_acer_aspire_one_verbs },
12601 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12602 .dac_nids = alc268_dac_nids,
12603 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12604 .adc_nids = alc268_adc_nids_alt,
12605 .capsrc_nids = alc268_capsrc_nids,
12607 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12608 .channel_mode = alc268_modes,
12609 .unsol_event = alc268_acer_lc_unsol_event,
12610 .setup = alc268_acer_lc_setup,
12611 .init_hook = alc268_acer_lc_init_hook,
12614 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12615 alc268_capture_nosrc_mixer },
12616 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12617 alc268_dell_verbs },
12618 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12619 .dac_nids = alc268_dac_nids,
12620 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12621 .adc_nids = alc268_adc_nids_alt,
12622 .capsrc_nids = alc268_capsrc_nids,
12624 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12625 .channel_mode = alc268_modes,
12626 .unsol_event = alc_sku_unsol_event,
12627 .setup = alc268_dell_setup,
12628 .init_hook = alc_inithook,
12631 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12632 alc268_beep_mixer },
12633 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12634 alc268_toshiba_verbs },
12635 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12636 .dac_nids = alc268_dac_nids,
12637 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12638 .adc_nids = alc268_adc_nids_alt,
12639 .capsrc_nids = alc268_capsrc_nids,
12641 .dig_out_nid = ALC268_DIGOUT_NID,
12642 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12643 .channel_mode = alc268_modes,
12644 .input_mux = &alc268_capture_source,
12645 .setup = alc268_toshiba_setup,
12646 .init_hook = alc268_toshiba_automute,
12648 #ifdef CONFIG_SND_DEBUG
12650 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12651 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12652 alc268_volume_init_verbs },
12653 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12654 .dac_nids = alc268_dac_nids,
12655 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12656 .adc_nids = alc268_adc_nids_alt,
12657 .capsrc_nids = alc268_capsrc_nids,
12659 .dig_out_nid = ALC268_DIGOUT_NID,
12660 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12661 .channel_mode = alc268_modes,
12662 .input_mux = &alc268_capture_source,
12667 static int patch_alc268(struct hda_codec *codec)
12669 struct alc_spec *spec;
12671 int i, has_beep, err;
12673 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12677 codec->spec = spec;
12679 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12683 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12684 board_config = snd_hda_check_board_codec_sid_config(codec,
12685 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12687 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12688 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12690 board_config = ALC268_AUTO;
12693 if (board_config == ALC268_AUTO) {
12694 /* automatic parse from the BIOS config */
12695 err = alc268_parse_auto_config(codec);
12701 "hda_codec: Cannot set up configuration "
12702 "from BIOS. Using base mode...\n");
12703 board_config = ALC268_3ST;
12707 if (board_config != ALC268_AUTO)
12708 setup_preset(codec, &alc268_presets[board_config]);
12710 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12711 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12712 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12714 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12717 for (i = 0; i < spec->num_mixers; i++) {
12718 if (spec->mixers[i] == alc268_beep_mixer) {
12725 err = snd_hda_attach_beep_device(codec, 0x1);
12730 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12731 /* override the amp caps for beep generator */
12732 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12733 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12734 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12735 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12736 (0 << AC_AMPCAP_MUTE_SHIFT));
12739 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12740 /* check whether NID 0x07 is valid */
12741 unsigned int wcap = get_wcaps(codec, 0x07);
12745 wcap = get_wcaps_type(wcap);
12746 if (spec->auto_mic ||
12747 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12748 spec->adc_nids = alc268_adc_nids_alt;
12749 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12750 if (spec->auto_mic || spec->input_mux->num_items == 1)
12751 add_mixer(spec, alc268_capture_nosrc_mixer);
12753 add_mixer(spec, alc268_capture_alt_mixer);
12755 spec->adc_nids = alc268_adc_nids;
12756 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12757 add_mixer(spec, alc268_capture_mixer);
12759 spec->capsrc_nids = alc268_capsrc_nids;
12760 /* set default input source */
12761 for (i = 0; i < spec->num_adc_nids; i++)
12762 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12763 0, AC_VERB_SET_CONNECT_SEL,
12764 i < spec->num_mux_defs ?
12765 spec->input_mux[i].items[0].index :
12766 spec->input_mux->items[0].index);
12769 spec->vmaster_nid = 0x02;
12771 codec->patch_ops = alc_patch_ops;
12772 if (board_config == ALC268_AUTO)
12773 spec->init_hook = alc268_auto_init;
12775 codec->proc_widget_hook = print_realtek_coef;
12781 * ALC269 channel source setting (2 channel)
12783 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12785 #define alc269_dac_nids alc260_dac_nids
12787 static hda_nid_t alc269_adc_nids[1] = {
12792 static hda_nid_t alc269_capsrc_nids[1] = {
12796 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12800 #define alc269_modes alc260_modes
12801 #define alc269_capture_source alc880_lg_lw_capture_source
12803 static struct snd_kcontrol_new alc269_base_mixer[] = {
12804 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12805 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12806 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12807 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12810 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12811 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12812 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12813 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12814 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12815 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12819 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12820 /* output mixer control */
12821 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12823 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12824 .name = "Master Playback Switch",
12825 .info = snd_hda_mixer_amp_switch_info,
12826 .get = snd_hda_mixer_amp_switch_get,
12827 .put = alc268_acer_master_sw_put,
12828 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12832 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12833 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12834 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12835 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12839 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12840 /* output mixer control */
12841 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12843 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12844 .name = "Master Playback Switch",
12845 .info = snd_hda_mixer_amp_switch_info,
12846 .get = snd_hda_mixer_amp_switch_get,
12847 .put = alc268_acer_master_sw_put,
12848 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12852 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12853 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12854 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12855 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12856 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12857 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12858 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12862 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12863 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12864 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12865 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12866 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12870 /* capture mixer elements */
12871 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12872 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12873 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12874 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12879 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12881 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12882 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12883 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12884 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12885 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12886 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12887 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12891 static struct hda_verb alc269_lifebook_verbs[] = {
12892 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12893 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12894 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12895 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12896 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12897 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12898 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12899 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12900 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12901 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12905 /* toggle speaker-output according to the hp-jack state */
12906 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12908 unsigned int present;
12909 unsigned char bits;
12911 present = snd_hda_codec_read(codec, 0x15, 0,
12912 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12913 bits = present ? AMP_IN_MUTE(0) : 0;
12914 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12915 AMP_IN_MUTE(0), bits);
12916 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12917 AMP_IN_MUTE(0), bits);
12919 snd_hda_codec_write(codec, 0x20, 0,
12920 AC_VERB_SET_COEF_INDEX, 0x0c);
12921 snd_hda_codec_write(codec, 0x20, 0,
12922 AC_VERB_SET_PROC_COEF, 0x680);
12924 snd_hda_codec_write(codec, 0x20, 0,
12925 AC_VERB_SET_COEF_INDEX, 0x0c);
12926 snd_hda_codec_write(codec, 0x20, 0,
12927 AC_VERB_SET_PROC_COEF, 0x480);
12930 /* toggle speaker-output according to the hp-jacks state */
12931 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12933 unsigned int present;
12934 unsigned char bits;
12936 /* Check laptop headphone socket */
12937 present = snd_hda_codec_read(codec, 0x15, 0,
12938 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12940 /* Check port replicator headphone socket */
12941 present |= snd_hda_codec_read(codec, 0x1a, 0,
12942 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12944 bits = present ? AMP_IN_MUTE(0) : 0;
12945 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12946 AMP_IN_MUTE(0), bits);
12947 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12948 AMP_IN_MUTE(0), bits);
12950 snd_hda_codec_write(codec, 0x20, 0,
12951 AC_VERB_SET_COEF_INDEX, 0x0c);
12952 snd_hda_codec_write(codec, 0x20, 0,
12953 AC_VERB_SET_PROC_COEF, 0x680);
12955 snd_hda_codec_write(codec, 0x20, 0,
12956 AC_VERB_SET_COEF_INDEX, 0x0c);
12957 snd_hda_codec_write(codec, 0x20, 0,
12958 AC_VERB_SET_PROC_COEF, 0x480);
12961 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12963 unsigned int present_laptop;
12964 unsigned int present_dock;
12966 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12967 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12969 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12970 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12972 /* Laptop mic port overrides dock mic port, design decision */
12974 snd_hda_codec_write(codec, 0x23, 0,
12975 AC_VERB_SET_CONNECT_SEL, 0x3);
12976 if (present_laptop)
12977 snd_hda_codec_write(codec, 0x23, 0,
12978 AC_VERB_SET_CONNECT_SEL, 0x0);
12979 if (!present_dock && !present_laptop)
12980 snd_hda_codec_write(codec, 0x23, 0,
12981 AC_VERB_SET_CONNECT_SEL, 0x1);
12984 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12987 switch (res >> 26) {
12988 case ALC880_HP_EVENT:
12989 alc269_quanta_fl1_speaker_automute(codec);
12991 case ALC880_MIC_EVENT:
12992 alc_mic_automute(codec);
12997 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13000 if ((res >> 26) == ALC880_HP_EVENT)
13001 alc269_lifebook_speaker_automute(codec);
13002 if ((res >> 26) == ALC880_MIC_EVENT)
13003 alc269_lifebook_mic_autoswitch(codec);
13006 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13008 struct alc_spec *spec = codec->spec;
13009 spec->ext_mic.pin = 0x18;
13010 spec->ext_mic.mux_idx = 0;
13011 spec->int_mic.pin = 0x19;
13012 spec->int_mic.mux_idx = 1;
13013 spec->auto_mic = 1;
13016 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13018 alc269_quanta_fl1_speaker_automute(codec);
13019 alc_mic_automute(codec);
13022 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13024 alc269_lifebook_speaker_automute(codec);
13025 alc269_lifebook_mic_autoswitch(codec);
13028 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13029 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13030 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13031 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13032 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13033 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13034 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13035 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13039 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13040 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13041 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13042 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13043 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13044 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13045 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13049 /* toggle speaker-output according to the hp-jack state */
13050 static void alc269_speaker_automute(struct hda_codec *codec)
13052 unsigned int present;
13053 unsigned char bits;
13055 present = snd_hda_codec_read(codec, 0x15, 0,
13056 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13057 bits = present ? AMP_IN_MUTE(0) : 0;
13058 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13059 AMP_IN_MUTE(0), bits);
13060 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13061 AMP_IN_MUTE(0), bits);
13064 /* unsolicited event for HP jack sensing */
13065 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13068 switch (res >> 26) {
13069 case ALC880_HP_EVENT:
13070 alc269_speaker_automute(codec);
13072 case ALC880_MIC_EVENT:
13073 alc_mic_automute(codec);
13078 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13080 struct alc_spec *spec = codec->spec;
13081 spec->ext_mic.pin = 0x18;
13082 spec->ext_mic.mux_idx = 0;
13083 spec->int_mic.pin = 0x12;
13084 spec->int_mic.mux_idx = 5;
13085 spec->auto_mic = 1;
13088 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13090 struct alc_spec *spec = codec->spec;
13091 spec->ext_mic.pin = 0x18;
13092 spec->ext_mic.mux_idx = 0;
13093 spec->int_mic.pin = 0x19;
13094 spec->int_mic.mux_idx = 1;
13095 spec->auto_mic = 1;
13098 static void alc269_eeepc_inithook(struct hda_codec *codec)
13100 alc269_speaker_automute(codec);
13101 alc_mic_automute(codec);
13105 * generic initialization of ADC, input mixers and output mixers
13107 static struct hda_verb alc269_init_verbs[] = {
13109 * Unmute ADC0 and set the default input to mic-in
13111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13113 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13114 * analog-loopback mixer widget
13115 * Note: PASD motherboards uses the Line In 2 as the input for
13116 * front panel mic (mic 2)
13118 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13123 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13126 * Set up output mixers (0x0c - 0x0e)
13128 /* set vol=0 to output mixers */
13129 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13130 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13132 /* set up input amps for analog loopback */
13133 /* Amp Indices: DAC = 0, mixer = 1 */
13134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13135 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13137 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13141 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13143 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13144 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13145 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13146 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13147 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13150 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13151 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13152 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13153 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13154 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13155 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13157 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13158 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13160 /* FIXME: use matrix-type input source selection */
13161 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13162 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13163 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13164 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13165 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13166 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13169 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13170 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13174 #define alc269_auto_create_multi_out_ctls \
13175 alc268_auto_create_multi_out_ctls
13176 #define alc269_auto_create_input_ctls \
13177 alc268_auto_create_input_ctls
13179 #ifdef CONFIG_SND_HDA_POWER_SAVE
13180 #define alc269_loopbacks alc880_loopbacks
13183 /* pcm configuration: identical with ALC880 */
13184 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13185 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13186 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13187 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13189 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13193 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13194 /* NID is set in alc_build_pcms */
13196 .open = alc880_playback_pcm_open,
13197 .prepare = alc880_playback_pcm_prepare,
13198 .cleanup = alc880_playback_pcm_cleanup
13202 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13206 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13207 /* NID is set in alc_build_pcms */
13211 * BIOS auto configuration
13213 static int alc269_parse_auto_config(struct hda_codec *codec)
13215 struct alc_spec *spec = codec->spec;
13217 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13219 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13224 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13227 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13231 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13233 if (spec->autocfg.dig_outs)
13234 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13236 if (spec->kctls.list)
13237 add_mixer(spec, spec->kctls.list);
13239 add_verb(spec, alc269_init_verbs);
13240 spec->num_mux_defs = 1;
13241 spec->input_mux = &spec->private_imux[0];
13242 /* set default input source */
13243 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13244 0, AC_VERB_SET_CONNECT_SEL,
13245 spec->input_mux->items[0].index);
13247 err = alc_auto_add_mic_boost(codec);
13251 if (!spec->cap_mixer && !spec->no_analog)
13252 set_capture_mixer(codec);
13254 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13259 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13260 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13261 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13264 /* init callback for auto-configuration model -- overriding the default init */
13265 static void alc269_auto_init(struct hda_codec *codec)
13267 struct alc_spec *spec = codec->spec;
13268 alc269_auto_init_multi_out(codec);
13269 alc269_auto_init_hp_out(codec);
13270 alc269_auto_init_analog_input(codec);
13271 if (spec->unsol_event)
13272 alc_inithook(codec);
13276 * configuration and preset
13278 static const char *alc269_models[ALC269_MODEL_LAST] = {
13279 [ALC269_BASIC] = "basic",
13280 [ALC269_QUANTA_FL1] = "quanta",
13281 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13282 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13283 [ALC269_FUJITSU] = "fujitsu",
13284 [ALC269_LIFEBOOK] = "lifebook"
13287 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13288 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13289 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13290 ALC269_ASUS_EEEPC_P703),
13291 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13292 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13293 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13294 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13295 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13296 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13297 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13298 ALC269_ASUS_EEEPC_P901),
13299 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13300 ALC269_ASUS_EEEPC_P901),
13301 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13302 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13303 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13307 static struct alc_config_preset alc269_presets[] = {
13309 .mixers = { alc269_base_mixer },
13310 .init_verbs = { alc269_init_verbs },
13311 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13312 .dac_nids = alc269_dac_nids,
13314 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13315 .channel_mode = alc269_modes,
13316 .input_mux = &alc269_capture_source,
13318 [ALC269_QUANTA_FL1] = {
13319 .mixers = { alc269_quanta_fl1_mixer },
13320 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13321 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13322 .dac_nids = alc269_dac_nids,
13324 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13325 .channel_mode = alc269_modes,
13326 .input_mux = &alc269_capture_source,
13327 .unsol_event = alc269_quanta_fl1_unsol_event,
13328 .setup = alc269_quanta_fl1_setup,
13329 .init_hook = alc269_quanta_fl1_init_hook,
13331 [ALC269_ASUS_EEEPC_P703] = {
13332 .mixers = { alc269_eeepc_mixer },
13333 .cap_mixer = alc269_epc_capture_mixer,
13334 .init_verbs = { alc269_init_verbs,
13335 alc269_eeepc_amic_init_verbs },
13336 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13337 .dac_nids = alc269_dac_nids,
13339 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13340 .channel_mode = alc269_modes,
13341 .unsol_event = alc269_eeepc_unsol_event,
13342 .setup = alc269_eeepc_amic_setup,
13343 .init_hook = alc269_eeepc_inithook,
13345 [ALC269_ASUS_EEEPC_P901] = {
13346 .mixers = { alc269_eeepc_mixer },
13347 .cap_mixer = alc269_epc_capture_mixer,
13348 .init_verbs = { alc269_init_verbs,
13349 alc269_eeepc_dmic_init_verbs },
13350 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13351 .dac_nids = alc269_dac_nids,
13353 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13354 .channel_mode = alc269_modes,
13355 .unsol_event = alc269_eeepc_unsol_event,
13356 .setup = alc269_eeepc_dmic_setup,
13357 .init_hook = alc269_eeepc_inithook,
13359 [ALC269_FUJITSU] = {
13360 .mixers = { alc269_fujitsu_mixer },
13361 .cap_mixer = alc269_epc_capture_mixer,
13362 .init_verbs = { alc269_init_verbs,
13363 alc269_eeepc_dmic_init_verbs },
13364 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13365 .dac_nids = alc269_dac_nids,
13367 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13368 .channel_mode = alc269_modes,
13369 .unsol_event = alc269_eeepc_unsol_event,
13370 .setup = alc269_eeepc_dmic_setup,
13371 .init_hook = alc269_eeepc_inithook,
13373 [ALC269_LIFEBOOK] = {
13374 .mixers = { alc269_lifebook_mixer },
13375 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13376 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13377 .dac_nids = alc269_dac_nids,
13379 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13380 .channel_mode = alc269_modes,
13381 .input_mux = &alc269_capture_source,
13382 .unsol_event = alc269_lifebook_unsol_event,
13383 .init_hook = alc269_lifebook_init_hook,
13387 static int patch_alc269(struct hda_codec *codec)
13389 struct alc_spec *spec;
13393 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13397 codec->spec = spec;
13399 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13401 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13405 if (board_config < 0) {
13406 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13408 board_config = ALC269_AUTO;
13411 if (board_config == ALC269_AUTO) {
13412 /* automatic parse from the BIOS config */
13413 err = alc269_parse_auto_config(codec);
13419 "hda_codec: Cannot set up configuration "
13420 "from BIOS. Using base mode...\n");
13421 board_config = ALC269_BASIC;
13425 err = snd_hda_attach_beep_device(codec, 0x1);
13431 if (board_config != ALC269_AUTO)
13432 setup_preset(codec, &alc269_presets[board_config]);
13434 if (codec->subsystem_id == 0x17aa3bf8) {
13435 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13436 * fix the sample rate of analog I/O to 44.1kHz
13438 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13439 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13441 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13442 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13444 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13445 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13447 spec->adc_nids = alc269_adc_nids;
13448 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13449 spec->capsrc_nids = alc269_capsrc_nids;
13450 if (!spec->cap_mixer)
13451 set_capture_mixer(codec);
13452 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13454 spec->vmaster_nid = 0x02;
13456 codec->patch_ops = alc_patch_ops;
13457 if (board_config == ALC269_AUTO)
13458 spec->init_hook = alc269_auto_init;
13459 #ifdef CONFIG_SND_HDA_POWER_SAVE
13460 if (!spec->loopback.amplist)
13461 spec->loopback.amplist = alc269_loopbacks;
13463 codec->proc_widget_hook = print_realtek_coef;
13469 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13473 * set the path ways for 2 channel output
13474 * need to set the codec line out and mic 1 pin widgets to inputs
13476 static struct hda_verb alc861_threestack_ch2_init[] = {
13477 /* set pin widget 1Ah (line in) for input */
13478 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13479 /* set pin widget 18h (mic1/2) for input, for mic also enable
13482 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13484 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13486 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13487 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13493 * need to set the codec line out and mic 1 pin widgets to outputs
13495 static struct hda_verb alc861_threestack_ch6_init[] = {
13496 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13497 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13498 /* set pin widget 18h (mic1) for output (CLFE)*/
13499 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13501 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13502 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13504 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13506 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13507 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13512 static struct hda_channel_mode alc861_threestack_modes[2] = {
13513 { 2, alc861_threestack_ch2_init },
13514 { 6, alc861_threestack_ch6_init },
13516 /* Set mic1 as input and unmute the mixer */
13517 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13518 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13519 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13522 /* Set mic1 as output and mute mixer */
13523 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13524 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13525 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13529 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13530 { 2, alc861_uniwill_m31_ch2_init },
13531 { 4, alc861_uniwill_m31_ch4_init },
13534 /* Set mic1 and line-in as input and unmute the mixer */
13535 static struct hda_verb alc861_asus_ch2_init[] = {
13536 /* set pin widget 1Ah (line in) for input */
13537 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13538 /* set pin widget 18h (mic1/2) for input, for mic also enable
13541 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13543 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13545 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13546 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13550 /* Set mic1 nad line-in as output and mute mixer */
13551 static struct hda_verb alc861_asus_ch6_init[] = {
13552 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13553 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13554 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13555 /* set pin widget 18h (mic1) for output (CLFE)*/
13556 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13557 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13558 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13559 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13561 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13563 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13564 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13569 static struct hda_channel_mode alc861_asus_modes[2] = {
13570 { 2, alc861_asus_ch2_init },
13571 { 6, alc861_asus_ch6_init },
13576 static struct snd_kcontrol_new alc861_base_mixer[] = {
13577 /* output mixer control */
13578 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13579 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13580 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13581 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13582 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13584 /*Input mixer control */
13585 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13586 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13587 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13588 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13589 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13590 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13591 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13592 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13593 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13594 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13599 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13600 /* output mixer control */
13601 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13602 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13603 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13604 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13605 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13607 /* Input mixer control */
13608 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13609 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13610 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13611 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13612 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13613 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13615 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13616 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13617 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13620 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13621 .name = "Channel Mode",
13622 .info = alc_ch_mode_info,
13623 .get = alc_ch_mode_get,
13624 .put = alc_ch_mode_put,
13625 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13630 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13631 /* output mixer control */
13632 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13633 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13634 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13639 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13640 /* output mixer control */
13641 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13642 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13643 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13644 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13645 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13647 /* Input mixer control */
13648 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13649 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13650 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13651 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13652 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13653 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13654 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13655 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13656 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13660 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13661 .name = "Channel Mode",
13662 .info = alc_ch_mode_info,
13663 .get = alc_ch_mode_get,
13664 .put = alc_ch_mode_put,
13665 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13670 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13671 /* output mixer control */
13672 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13673 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13674 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13675 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13676 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13678 /* Input mixer control */
13679 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13680 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13681 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13682 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13683 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13684 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13686 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13687 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13688 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13691 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13692 .name = "Channel Mode",
13693 .info = alc_ch_mode_info,
13694 .get = alc_ch_mode_get,
13695 .put = alc_ch_mode_put,
13696 .private_value = ARRAY_SIZE(alc861_asus_modes),
13701 /* additional mixer */
13702 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13703 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13704 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13709 * generic initialization of ADC, input mixers and output mixers
13711 static struct hda_verb alc861_base_init_verbs[] = {
13713 * Unmute ADC0 and set the default input to mic-in
13715 /* port-A for surround (rear panel) */
13716 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13717 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13718 /* port-B for mic-in (rear panel) with vref */
13719 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13720 /* port-C for line-in (rear panel) */
13721 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13722 /* port-D for Front */
13723 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13724 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13725 /* port-E for HP out (front panel) */
13726 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13727 /* route front PCM to HP */
13728 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13729 /* port-F for mic-in (front panel) with vref */
13730 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13731 /* port-G for CLFE (rear panel) */
13732 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13733 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13734 /* port-H for side (rear panel) */
13735 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13736 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13738 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13739 /* route front mic to ADC1*/
13740 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13741 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13743 /* Unmute DAC0~3 & spdif out*/
13744 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13745 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13746 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13747 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13750 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13751 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13752 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13753 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13754 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13756 /* Unmute Stereo Mixer 15 */
13757 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13760 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13762 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13763 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13764 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13765 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13766 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13767 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13768 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13769 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13770 /* hp used DAC 3 (Front) */
13771 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13772 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13777 static struct hda_verb alc861_threestack_init_verbs[] = {
13779 * Unmute ADC0 and set the default input to mic-in
13781 /* port-A for surround (rear panel) */
13782 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13783 /* port-B for mic-in (rear panel) with vref */
13784 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13785 /* port-C for line-in (rear panel) */
13786 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13787 /* port-D for Front */
13788 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13789 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13790 /* port-E for HP out (front panel) */
13791 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13792 /* route front PCM to HP */
13793 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13794 /* port-F for mic-in (front panel) with vref */
13795 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13796 /* port-G for CLFE (rear panel) */
13797 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13798 /* port-H for side (rear panel) */
13799 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13801 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13802 /* route front mic to ADC1*/
13803 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13804 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13805 /* Unmute DAC0~3 & spdif out*/
13806 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13807 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13808 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13809 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13810 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13812 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13813 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13814 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13815 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13816 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13818 /* Unmute Stereo Mixer 15 */
13819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13820 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13821 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13822 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13824 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13825 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13826 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13827 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13828 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13829 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13830 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13831 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13832 /* hp used DAC 3 (Front) */
13833 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13834 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13838 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13840 * Unmute ADC0 and set the default input to mic-in
13842 /* port-A for surround (rear panel) */
13843 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13844 /* port-B for mic-in (rear panel) with vref */
13845 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13846 /* port-C for line-in (rear panel) */
13847 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13848 /* port-D for Front */
13849 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13850 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13851 /* port-E for HP out (front panel) */
13852 /* this has to be set to VREF80 */
13853 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13854 /* route front PCM to HP */
13855 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13856 /* port-F for mic-in (front panel) with vref */
13857 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13858 /* port-G for CLFE (rear panel) */
13859 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13860 /* port-H for side (rear panel) */
13861 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13863 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13864 /* route front mic to ADC1*/
13865 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13866 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13867 /* Unmute DAC0~3 & spdif out*/
13868 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13869 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13870 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13871 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13872 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13874 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13875 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13876 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13877 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13878 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13880 /* Unmute Stereo Mixer 15 */
13881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13882 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13883 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13886 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13887 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13888 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13889 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13890 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13891 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13892 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13893 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13894 /* hp used DAC 3 (Front) */
13895 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13896 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13900 static struct hda_verb alc861_asus_init_verbs[] = {
13902 * Unmute ADC0 and set the default input to mic-in
13904 /* port-A for surround (rear panel)
13905 * according to codec#0 this is the HP jack
13907 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13908 /* route front PCM to HP */
13909 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13910 /* port-B for mic-in (rear panel) with vref */
13911 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13912 /* port-C for line-in (rear panel) */
13913 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13914 /* port-D for Front */
13915 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13916 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13917 /* port-E for HP out (front panel) */
13918 /* this has to be set to VREF80 */
13919 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13920 /* route front PCM to HP */
13921 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13922 /* port-F for mic-in (front panel) with vref */
13923 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13924 /* port-G for CLFE (rear panel) */
13925 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13926 /* port-H for side (rear panel) */
13927 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13929 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13930 /* route front mic to ADC1*/
13931 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13932 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13933 /* Unmute DAC0~3 & spdif out*/
13934 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13935 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13936 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13937 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13939 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13940 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13941 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13942 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13943 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13945 /* Unmute Stereo Mixer 15 */
13946 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13947 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13948 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13949 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13951 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13952 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13953 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13954 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13955 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13956 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13957 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13958 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13959 /* hp used DAC 3 (Front) */
13960 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13961 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13965 /* additional init verbs for ASUS laptops */
13966 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13967 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13968 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13973 * generic initialization of ADC, input mixers and output mixers
13975 static struct hda_verb alc861_auto_init_verbs[] = {
13977 * Unmute ADC0 and set the default input to mic-in
13979 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13980 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13982 /* Unmute DAC0~3 & spdif out*/
13983 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13984 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13985 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13986 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13989 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13990 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13991 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13992 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13993 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13995 /* Unmute Stereo Mixer 15 */
13996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13998 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14001 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14002 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14003 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14004 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14005 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14006 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14007 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14008 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14010 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14011 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14012 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14013 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14014 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14015 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14016 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14017 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14019 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14024 static struct hda_verb alc861_toshiba_init_verbs[] = {
14025 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14030 /* toggle speaker-output according to the hp-jack state */
14031 static void alc861_toshiba_automute(struct hda_codec *codec)
14033 unsigned int present;
14035 present = snd_hda_codec_read(codec, 0x0f, 0,
14036 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14037 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14038 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14039 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14040 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14043 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14046 if ((res >> 26) == ALC880_HP_EVENT)
14047 alc861_toshiba_automute(codec);
14050 /* pcm configuration: identical with ALC880 */
14051 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14052 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14053 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14054 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14057 #define ALC861_DIGOUT_NID 0x07
14059 static struct hda_channel_mode alc861_8ch_modes[1] = {
14063 static hda_nid_t alc861_dac_nids[4] = {
14064 /* front, surround, clfe, side */
14065 0x03, 0x06, 0x05, 0x04
14068 static hda_nid_t alc660_dac_nids[3] = {
14069 /* front, clfe, surround */
14073 static hda_nid_t alc861_adc_nids[1] = {
14078 static struct hda_input_mux alc861_capture_source = {
14082 { "Front Mic", 0x3 },
14089 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14091 struct alc_spec *spec = codec->spec;
14092 hda_nid_t mix, srcs[5];
14095 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14097 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14100 for (i = 0; i < num; i++) {
14102 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14103 if (type != AC_WID_AUD_OUT)
14105 for (j = 0; j < spec->multiout.num_dacs; j++)
14106 if (spec->multiout.dac_nids[j] == srcs[i])
14108 if (j >= spec->multiout.num_dacs)
14114 /* fill in the dac_nids table from the parsed pin configuration */
14115 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14116 const struct auto_pin_cfg *cfg)
14118 struct alc_spec *spec = codec->spec;
14120 hda_nid_t nid, dac;
14122 spec->multiout.dac_nids = spec->private_dac_nids;
14123 for (i = 0; i < cfg->line_outs; i++) {
14124 nid = cfg->line_out_pins[i];
14125 dac = alc861_look_for_dac(codec, nid);
14128 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14133 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14134 hda_nid_t nid, unsigned int chs)
14137 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14138 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14139 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14142 /* add playback controls from the parsed DAC table */
14143 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14144 const struct auto_pin_cfg *cfg)
14146 struct alc_spec *spec = codec->spec;
14147 static const char *chname[4] = {
14148 "Front", "Surround", NULL /*CLFE*/, "Side"
14153 if (cfg->line_outs == 1) {
14154 const char *pfx = NULL;
14157 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14160 nid = spec->multiout.dac_nids[0];
14161 return alc861_create_out_sw(codec, pfx, nid, 3);
14165 for (i = 0; i < cfg->line_outs; i++) {
14166 nid = spec->multiout.dac_nids[i];
14171 err = alc861_create_out_sw(codec, "Center", nid, 1);
14174 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14178 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14186 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14188 struct alc_spec *spec = codec->spec;
14195 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14196 nid = alc861_look_for_dac(codec, pin);
14198 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14201 spec->multiout.hp_nid = nid;
14207 /* create playback/capture controls for input pins */
14208 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14209 const struct auto_pin_cfg *cfg)
14211 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14214 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14216 int pin_type, hda_nid_t dac)
14218 hda_nid_t mix, srcs[5];
14221 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14223 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14225 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14227 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14230 for (i = 0; i < num; i++) {
14232 if (srcs[i] == dac || srcs[i] == 0x15)
14233 mute = AMP_IN_UNMUTE(i);
14235 mute = AMP_IN_MUTE(i);
14236 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14241 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14243 struct alc_spec *spec = codec->spec;
14246 for (i = 0; i < spec->autocfg.line_outs; i++) {
14247 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14248 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14250 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14251 spec->multiout.dac_nids[i]);
14255 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14257 struct alc_spec *spec = codec->spec;
14260 pin = spec->autocfg.hp_pins[0];
14262 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14263 spec->multiout.hp_nid);
14264 pin = spec->autocfg.speaker_pins[0];
14266 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14267 spec->multiout.dac_nids[0]);
14270 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14272 struct alc_spec *spec = codec->spec;
14275 for (i = 0; i < AUTO_PIN_LAST; i++) {
14276 hda_nid_t nid = spec->autocfg.input_pins[i];
14277 if (nid >= 0x0c && nid <= 0x11)
14278 alc_set_input_pin(codec, nid, i);
14282 /* parse the BIOS configuration and set up the alc_spec */
14283 /* return 1 if successful, 0 if the proper config is not found,
14284 * or a negative error code
14286 static int alc861_parse_auto_config(struct hda_codec *codec)
14288 struct alc_spec *spec = codec->spec;
14290 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14292 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14296 if (!spec->autocfg.line_outs)
14297 return 0; /* can't find valid BIOS pin config */
14299 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14302 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14305 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14308 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14312 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14314 if (spec->autocfg.dig_outs)
14315 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14317 if (spec->kctls.list)
14318 add_mixer(spec, spec->kctls.list);
14320 add_verb(spec, alc861_auto_init_verbs);
14322 spec->num_mux_defs = 1;
14323 spec->input_mux = &spec->private_imux[0];
14325 spec->adc_nids = alc861_adc_nids;
14326 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14327 set_capture_mixer(codec);
14329 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14334 /* additional initialization for auto-configuration model */
14335 static void alc861_auto_init(struct hda_codec *codec)
14337 struct alc_spec *spec = codec->spec;
14338 alc861_auto_init_multi_out(codec);
14339 alc861_auto_init_hp_out(codec);
14340 alc861_auto_init_analog_input(codec);
14341 if (spec->unsol_event)
14342 alc_inithook(codec);
14345 #ifdef CONFIG_SND_HDA_POWER_SAVE
14346 static struct hda_amp_list alc861_loopbacks[] = {
14347 { 0x15, HDA_INPUT, 0 },
14348 { 0x15, HDA_INPUT, 1 },
14349 { 0x15, HDA_INPUT, 2 },
14350 { 0x15, HDA_INPUT, 3 },
14357 * configuration and preset
14359 static const char *alc861_models[ALC861_MODEL_LAST] = {
14360 [ALC861_3ST] = "3stack",
14361 [ALC660_3ST] = "3stack-660",
14362 [ALC861_3ST_DIG] = "3stack-dig",
14363 [ALC861_6ST_DIG] = "6stack-dig",
14364 [ALC861_UNIWILL_M31] = "uniwill-m31",
14365 [ALC861_TOSHIBA] = "toshiba",
14366 [ALC861_ASUS] = "asus",
14367 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14368 [ALC861_AUTO] = "auto",
14371 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14372 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14373 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14374 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14375 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14376 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14377 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14378 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14379 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14380 * Any other models that need this preset?
14382 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14383 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14384 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14385 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14386 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14387 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14388 /* FIXME: the below seems conflict */
14389 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14390 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14391 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14395 static struct alc_config_preset alc861_presets[] = {
14397 .mixers = { alc861_3ST_mixer },
14398 .init_verbs = { alc861_threestack_init_verbs },
14399 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14400 .dac_nids = alc861_dac_nids,
14401 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14402 .channel_mode = alc861_threestack_modes,
14404 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14405 .adc_nids = alc861_adc_nids,
14406 .input_mux = &alc861_capture_source,
14408 [ALC861_3ST_DIG] = {
14409 .mixers = { alc861_base_mixer },
14410 .init_verbs = { alc861_threestack_init_verbs },
14411 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14412 .dac_nids = alc861_dac_nids,
14413 .dig_out_nid = ALC861_DIGOUT_NID,
14414 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14415 .channel_mode = alc861_threestack_modes,
14417 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14418 .adc_nids = alc861_adc_nids,
14419 .input_mux = &alc861_capture_source,
14421 [ALC861_6ST_DIG] = {
14422 .mixers = { alc861_base_mixer },
14423 .init_verbs = { alc861_base_init_verbs },
14424 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14425 .dac_nids = alc861_dac_nids,
14426 .dig_out_nid = ALC861_DIGOUT_NID,
14427 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14428 .channel_mode = alc861_8ch_modes,
14429 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14430 .adc_nids = alc861_adc_nids,
14431 .input_mux = &alc861_capture_source,
14434 .mixers = { alc861_3ST_mixer },
14435 .init_verbs = { alc861_threestack_init_verbs },
14436 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14437 .dac_nids = alc660_dac_nids,
14438 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14439 .channel_mode = alc861_threestack_modes,
14441 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14442 .adc_nids = alc861_adc_nids,
14443 .input_mux = &alc861_capture_source,
14445 [ALC861_UNIWILL_M31] = {
14446 .mixers = { alc861_uniwill_m31_mixer },
14447 .init_verbs = { alc861_uniwill_m31_init_verbs },
14448 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14449 .dac_nids = alc861_dac_nids,
14450 .dig_out_nid = ALC861_DIGOUT_NID,
14451 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14452 .channel_mode = alc861_uniwill_m31_modes,
14454 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14455 .adc_nids = alc861_adc_nids,
14456 .input_mux = &alc861_capture_source,
14458 [ALC861_TOSHIBA] = {
14459 .mixers = { alc861_toshiba_mixer },
14460 .init_verbs = { alc861_base_init_verbs,
14461 alc861_toshiba_init_verbs },
14462 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14463 .dac_nids = alc861_dac_nids,
14464 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14465 .channel_mode = alc883_3ST_2ch_modes,
14466 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14467 .adc_nids = alc861_adc_nids,
14468 .input_mux = &alc861_capture_source,
14469 .unsol_event = alc861_toshiba_unsol_event,
14470 .init_hook = alc861_toshiba_automute,
14473 .mixers = { alc861_asus_mixer },
14474 .init_verbs = { alc861_asus_init_verbs },
14475 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14476 .dac_nids = alc861_dac_nids,
14477 .dig_out_nid = ALC861_DIGOUT_NID,
14478 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14479 .channel_mode = alc861_asus_modes,
14482 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14483 .adc_nids = alc861_adc_nids,
14484 .input_mux = &alc861_capture_source,
14486 [ALC861_ASUS_LAPTOP] = {
14487 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14488 .init_verbs = { alc861_asus_init_verbs,
14489 alc861_asus_laptop_init_verbs },
14490 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14491 .dac_nids = alc861_dac_nids,
14492 .dig_out_nid = ALC861_DIGOUT_NID,
14493 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14494 .channel_mode = alc883_3ST_2ch_modes,
14496 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14497 .adc_nids = alc861_adc_nids,
14498 .input_mux = &alc861_capture_source,
14503 static int patch_alc861(struct hda_codec *codec)
14505 struct alc_spec *spec;
14509 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14513 codec->spec = spec;
14515 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14519 if (board_config < 0) {
14520 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14522 board_config = ALC861_AUTO;
14525 if (board_config == ALC861_AUTO) {
14526 /* automatic parse from the BIOS config */
14527 err = alc861_parse_auto_config(codec);
14533 "hda_codec: Cannot set up configuration "
14534 "from BIOS. Using base mode...\n");
14535 board_config = ALC861_3ST_DIG;
14539 err = snd_hda_attach_beep_device(codec, 0x23);
14545 if (board_config != ALC861_AUTO)
14546 setup_preset(codec, &alc861_presets[board_config]);
14548 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14549 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14551 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14552 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14554 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14556 spec->vmaster_nid = 0x03;
14558 codec->patch_ops = alc_patch_ops;
14559 if (board_config == ALC861_AUTO)
14560 spec->init_hook = alc861_auto_init;
14561 #ifdef CONFIG_SND_HDA_POWER_SAVE
14562 if (!spec->loopback.amplist)
14563 spec->loopback.amplist = alc861_loopbacks;
14565 codec->proc_widget_hook = print_realtek_coef;
14571 * ALC861-VD support
14575 * In addition, an independent DAC
14577 #define ALC861VD_DIGOUT_NID 0x06
14579 static hda_nid_t alc861vd_dac_nids[4] = {
14580 /* front, surr, clfe, side surr */
14581 0x02, 0x03, 0x04, 0x05
14584 /* dac_nids for ALC660vd are in a different order - according to
14585 * Realtek's driver.
14586 * This should probably result in a different mixer for 6stack models
14587 * of ALC660vd codecs, but for now there is only 3stack mixer
14588 * - and it is the same as in 861vd.
14589 * adc_nids in ALC660vd are (is) the same as in 861vd
14591 static hda_nid_t alc660vd_dac_nids[3] = {
14592 /* front, rear, clfe, rear_surr */
14596 static hda_nid_t alc861vd_adc_nids[1] = {
14601 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14604 /* FIXME: should be a matrix-type input source selection */
14605 static struct hda_input_mux alc861vd_capture_source = {
14609 { "Front Mic", 0x1 },
14615 static struct hda_input_mux alc861vd_dallas_capture_source = {
14618 { "Ext Mic", 0x0 },
14619 { "Int Mic", 0x1 },
14623 static struct hda_input_mux alc861vd_hp_capture_source = {
14626 { "Front Mic", 0x0 },
14627 { "ATAPI Mic", 0x1 },
14634 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14641 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14642 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14643 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14644 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14645 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14652 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14653 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14654 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14655 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14656 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14660 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14661 { 6, alc861vd_6stack_ch6_init },
14662 { 8, alc861vd_6stack_ch8_init },
14665 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14667 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14668 .name = "Channel Mode",
14669 .info = alc_ch_mode_info,
14670 .get = alc_ch_mode_get,
14671 .put = alc_ch_mode_put,
14676 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14677 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14679 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14680 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14681 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14683 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14684 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14686 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14688 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14690 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14691 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14693 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14694 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14696 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14698 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14699 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14700 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14702 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14703 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14704 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14706 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14707 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14709 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14710 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14715 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14716 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14717 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14719 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14721 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14725 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14726 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14727 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14729 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14730 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14732 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14733 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14738 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14739 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14740 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14741 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14743 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14745 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14746 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14747 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14749 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14750 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14751 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14753 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14754 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14759 /* Pin assignment: Speaker=0x14, HP = 0x15,
14760 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14762 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14763 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14764 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14765 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14766 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14767 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14768 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14769 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14770 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14771 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14772 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14776 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14777 * Front Mic=0x18, ATAPI Mic = 0x19,
14779 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14780 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14781 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14782 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14783 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14784 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14785 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14786 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14787 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14793 * generic initialization of ADC, input mixers and output mixers
14795 static struct hda_verb alc861vd_volume_init_verbs[] = {
14797 * Unmute ADC0 and set the default input to mic-in
14799 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14800 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14802 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14803 * the analog-loopback mixer widget
14805 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14806 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14807 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14808 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14809 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14810 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14812 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14813 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14814 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14815 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14819 * Set up output mixers (0x02 - 0x05)
14821 /* set vol=0 to output mixers */
14822 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14823 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14824 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14825 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14827 /* set up input amps for analog loopback */
14828 /* Amp Indices: DAC = 0, mixer = 1 */
14829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14830 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14831 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14832 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14833 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14834 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14835 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14836 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14842 * 3-stack pin configuration:
14843 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14845 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14847 * Set pin mode and muting
14849 /* set front pin widgets 0x14 for output */
14850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14851 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14852 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14854 /* Mic (rear) pin: input vref at 80% */
14855 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14856 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14857 /* Front Mic pin: input vref at 80% */
14858 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14859 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14860 /* Line In pin: input */
14861 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14862 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14863 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14864 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14865 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14866 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14867 /* CD pin widget for input */
14868 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14874 * 6-stack pin configuration:
14876 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14878 * Set pin mode and muting
14880 /* set front pin widgets 0x14 for output */
14881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14883 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14885 /* Rear Pin: output 1 (0x0d) */
14886 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14887 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14888 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14889 /* CLFE Pin: output 2 (0x0e) */
14890 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14891 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14892 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14893 /* Side Pin: output 3 (0x0f) */
14894 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14895 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14896 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14898 /* Mic (rear) pin: input vref at 80% */
14899 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14900 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14901 /* Front Mic pin: input vref at 80% */
14902 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14903 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14904 /* Line In pin: input */
14905 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14906 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14907 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14908 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14909 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14910 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14911 /* CD pin widget for input */
14912 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14917 static struct hda_verb alc861vd_eapd_verbs[] = {
14918 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14922 static struct hda_verb alc660vd_eapd_verbs[] = {
14923 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14924 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14928 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14930 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14932 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14933 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14937 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14939 unsigned int present;
14940 unsigned char bits;
14942 present = snd_hda_codec_read(codec, 0x18, 0,
14943 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14944 bits = present ? HDA_AMP_MUTE : 0;
14945 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14946 HDA_AMP_MUTE, bits);
14949 static void alc861vd_lenovo_setup(struct hda_codec *codec)
14951 struct alc_spec *spec = codec->spec;
14952 spec->autocfg.hp_pins[0] = 0x1b;
14953 spec->autocfg.speaker_pins[0] = 0x14;
14956 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14958 alc_automute_amp(codec);
14959 alc861vd_lenovo_mic_automute(codec);
14962 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14965 switch (res >> 26) {
14966 case ALC880_MIC_EVENT:
14967 alc861vd_lenovo_mic_automute(codec);
14970 alc_automute_amp_unsol_event(codec, res);
14975 static struct hda_verb alc861vd_dallas_verbs[] = {
14976 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14977 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14978 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14979 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14981 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14982 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14983 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14984 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14985 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14986 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14987 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14988 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14990 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14991 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14992 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14994 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14995 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14996 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14997 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14999 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15000 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15001 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15002 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15003 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15004 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15005 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15006 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15008 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15013 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15014 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15015 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15020 /* toggle speaker-output according to the hp-jack state */
15021 static void alc861vd_dallas_setup(struct hda_codec *codec)
15023 struct alc_spec *spec = codec->spec;
15025 spec->autocfg.hp_pins[0] = 0x15;
15026 spec->autocfg.speaker_pins[0] = 0x14;
15029 #ifdef CONFIG_SND_HDA_POWER_SAVE
15030 #define alc861vd_loopbacks alc880_loopbacks
15033 /* pcm configuration: identical with ALC880 */
15034 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15035 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15036 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15037 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15040 * configuration and preset
15042 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15043 [ALC660VD_3ST] = "3stack-660",
15044 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15045 [ALC660VD_ASUS_V1S] = "asus-v1s",
15046 [ALC861VD_3ST] = "3stack",
15047 [ALC861VD_3ST_DIG] = "3stack-digout",
15048 [ALC861VD_6ST_DIG] = "6stack-digout",
15049 [ALC861VD_LENOVO] = "lenovo",
15050 [ALC861VD_DALLAS] = "dallas",
15051 [ALC861VD_HP] = "hp",
15052 [ALC861VD_AUTO] = "auto",
15055 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15056 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15057 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15058 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15059 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15060 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15061 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15062 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15063 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15064 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15065 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15066 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15067 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15068 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15069 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15070 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15074 static struct alc_config_preset alc861vd_presets[] = {
15076 .mixers = { alc861vd_3st_mixer },
15077 .init_verbs = { alc861vd_volume_init_verbs,
15078 alc861vd_3stack_init_verbs },
15079 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15080 .dac_nids = alc660vd_dac_nids,
15081 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15082 .channel_mode = alc861vd_3stack_2ch_modes,
15083 .input_mux = &alc861vd_capture_source,
15085 [ALC660VD_3ST_DIG] = {
15086 .mixers = { alc861vd_3st_mixer },
15087 .init_verbs = { alc861vd_volume_init_verbs,
15088 alc861vd_3stack_init_verbs },
15089 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15090 .dac_nids = alc660vd_dac_nids,
15091 .dig_out_nid = ALC861VD_DIGOUT_NID,
15092 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15093 .channel_mode = alc861vd_3stack_2ch_modes,
15094 .input_mux = &alc861vd_capture_source,
15097 .mixers = { alc861vd_3st_mixer },
15098 .init_verbs = { alc861vd_volume_init_verbs,
15099 alc861vd_3stack_init_verbs },
15100 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15101 .dac_nids = alc861vd_dac_nids,
15102 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15103 .channel_mode = alc861vd_3stack_2ch_modes,
15104 .input_mux = &alc861vd_capture_source,
15106 [ALC861VD_3ST_DIG] = {
15107 .mixers = { alc861vd_3st_mixer },
15108 .init_verbs = { alc861vd_volume_init_verbs,
15109 alc861vd_3stack_init_verbs },
15110 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15111 .dac_nids = alc861vd_dac_nids,
15112 .dig_out_nid = ALC861VD_DIGOUT_NID,
15113 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15114 .channel_mode = alc861vd_3stack_2ch_modes,
15115 .input_mux = &alc861vd_capture_source,
15117 [ALC861VD_6ST_DIG] = {
15118 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15119 .init_verbs = { alc861vd_volume_init_verbs,
15120 alc861vd_6stack_init_verbs },
15121 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15122 .dac_nids = alc861vd_dac_nids,
15123 .dig_out_nid = ALC861VD_DIGOUT_NID,
15124 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15125 .channel_mode = alc861vd_6stack_modes,
15126 .input_mux = &alc861vd_capture_source,
15128 [ALC861VD_LENOVO] = {
15129 .mixers = { alc861vd_lenovo_mixer },
15130 .init_verbs = { alc861vd_volume_init_verbs,
15131 alc861vd_3stack_init_verbs,
15132 alc861vd_eapd_verbs,
15133 alc861vd_lenovo_unsol_verbs },
15134 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15135 .dac_nids = alc660vd_dac_nids,
15136 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15137 .channel_mode = alc861vd_3stack_2ch_modes,
15138 .input_mux = &alc861vd_capture_source,
15139 .unsol_event = alc861vd_lenovo_unsol_event,
15140 .setup = alc861vd_lenovo_setup,
15141 .init_hook = alc861vd_lenovo_init_hook,
15143 [ALC861VD_DALLAS] = {
15144 .mixers = { alc861vd_dallas_mixer },
15145 .init_verbs = { alc861vd_dallas_verbs },
15146 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15147 .dac_nids = alc861vd_dac_nids,
15148 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15149 .channel_mode = alc861vd_3stack_2ch_modes,
15150 .input_mux = &alc861vd_dallas_capture_source,
15151 .unsol_event = alc_automute_amp_unsol_event,
15152 .setup = alc861vd_dallas_setup,
15153 .init_hook = alc_automute_amp,
15156 .mixers = { alc861vd_hp_mixer },
15157 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15158 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15159 .dac_nids = alc861vd_dac_nids,
15160 .dig_out_nid = ALC861VD_DIGOUT_NID,
15161 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15162 .channel_mode = alc861vd_3stack_2ch_modes,
15163 .input_mux = &alc861vd_hp_capture_source,
15164 .unsol_event = alc_automute_amp_unsol_event,
15165 .setup = alc861vd_dallas_setup,
15166 .init_hook = alc_automute_amp,
15168 [ALC660VD_ASUS_V1S] = {
15169 .mixers = { alc861vd_lenovo_mixer },
15170 .init_verbs = { alc861vd_volume_init_verbs,
15171 alc861vd_3stack_init_verbs,
15172 alc861vd_eapd_verbs,
15173 alc861vd_lenovo_unsol_verbs },
15174 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15175 .dac_nids = alc660vd_dac_nids,
15176 .dig_out_nid = ALC861VD_DIGOUT_NID,
15177 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15178 .channel_mode = alc861vd_3stack_2ch_modes,
15179 .input_mux = &alc861vd_capture_source,
15180 .unsol_event = alc861vd_lenovo_unsol_event,
15181 .setup = alc861vd_lenovo_setup,
15182 .init_hook = alc861vd_lenovo_init_hook,
15187 * BIOS auto configuration
15189 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15190 const struct auto_pin_cfg *cfg)
15192 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15196 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15197 hda_nid_t nid, int pin_type, int dac_idx)
15199 alc_set_pin_output(codec, nid, pin_type);
15202 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15204 struct alc_spec *spec = codec->spec;
15207 for (i = 0; i <= HDA_SIDE; i++) {
15208 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15209 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15211 alc861vd_auto_set_output_and_unmute(codec, nid,
15217 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15219 struct alc_spec *spec = codec->spec;
15222 pin = spec->autocfg.hp_pins[0];
15223 if (pin) /* connect to front and use dac 0 */
15224 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15225 pin = spec->autocfg.speaker_pins[0];
15227 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15230 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15232 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15234 struct alc_spec *spec = codec->spec;
15237 for (i = 0; i < AUTO_PIN_LAST; i++) {
15238 hda_nid_t nid = spec->autocfg.input_pins[i];
15239 if (alc_is_input_pin(codec, nid)) {
15240 alc_set_input_pin(codec, nid, i);
15241 if (nid != ALC861VD_PIN_CD_NID &&
15242 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15243 snd_hda_codec_write(codec, nid, 0,
15244 AC_VERB_SET_AMP_GAIN_MUTE,
15250 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15252 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15253 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15255 /* add playback controls from the parsed DAC table */
15256 /* Based on ALC880 version. But ALC861VD has separate,
15257 * different NIDs for mute/unmute switch and volume control */
15258 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15259 const struct auto_pin_cfg *cfg)
15262 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15263 hda_nid_t nid_v, nid_s;
15266 for (i = 0; i < cfg->line_outs; i++) {
15267 if (!spec->multiout.dac_nids[i])
15269 nid_v = alc861vd_idx_to_mixer_vol(
15271 spec->multiout.dac_nids[i]));
15272 nid_s = alc861vd_idx_to_mixer_switch(
15274 spec->multiout.dac_nids[i]));
15278 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15279 "Center Playback Volume",
15280 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15284 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15285 "LFE Playback Volume",
15286 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15290 err = add_control(spec, ALC_CTL_BIND_MUTE,
15291 "Center Playback Switch",
15292 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15296 err = add_control(spec, ALC_CTL_BIND_MUTE,
15297 "LFE Playback Switch",
15298 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15304 if (cfg->line_outs == 1 &&
15305 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15312 sprintf(name, "%s Playback Volume", pfx);
15313 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15314 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15318 if (cfg->line_outs == 1 &&
15319 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15321 sprintf(name, "%s Playback Switch", pfx);
15322 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15323 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15332 /* add playback controls for speaker and HP outputs */
15333 /* Based on ALC880 version. But ALC861VD has separate,
15334 * different NIDs for mute/unmute switch and volume control */
15335 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15336 hda_nid_t pin, const char *pfx)
15338 hda_nid_t nid_v, nid_s;
15345 if (alc880_is_fixed_pin(pin)) {
15346 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15347 /* specify the DAC as the extra output */
15348 if (!spec->multiout.hp_nid)
15349 spec->multiout.hp_nid = nid_v;
15351 spec->multiout.extra_out_nid[0] = nid_v;
15352 /* control HP volume/switch on the output mixer amp */
15353 nid_v = alc861vd_idx_to_mixer_vol(
15354 alc880_fixed_pin_idx(pin));
15355 nid_s = alc861vd_idx_to_mixer_switch(
15356 alc880_fixed_pin_idx(pin));
15358 sprintf(name, "%s Playback Volume", pfx);
15359 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15360 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15363 sprintf(name, "%s Playback Switch", pfx);
15364 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15365 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15368 } else if (alc880_is_multi_pin(pin)) {
15369 /* set manual connection */
15370 /* we have only a switch on HP-out PIN */
15371 sprintf(name, "%s Playback Switch", pfx);
15372 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15373 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15380 /* parse the BIOS configuration and set up the alc_spec
15381 * return 1 if successful, 0 if the proper config is not found,
15382 * or a negative error code
15383 * Based on ALC880 version - had to change it to override
15384 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15385 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15387 struct alc_spec *spec = codec->spec;
15389 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15391 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15395 if (!spec->autocfg.line_outs)
15396 return 0; /* can't find valid BIOS pin config */
15398 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15401 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15404 err = alc861vd_auto_create_extra_out(spec,
15405 spec->autocfg.speaker_pins[0],
15409 err = alc861vd_auto_create_extra_out(spec,
15410 spec->autocfg.hp_pins[0],
15414 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15418 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15420 if (spec->autocfg.dig_outs)
15421 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15423 if (spec->kctls.list)
15424 add_mixer(spec, spec->kctls.list);
15426 add_verb(spec, alc861vd_volume_init_verbs);
15428 spec->num_mux_defs = 1;
15429 spec->input_mux = &spec->private_imux[0];
15431 err = alc_auto_add_mic_boost(codec);
15435 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15440 /* additional initialization for auto-configuration model */
15441 static void alc861vd_auto_init(struct hda_codec *codec)
15443 struct alc_spec *spec = codec->spec;
15444 alc861vd_auto_init_multi_out(codec);
15445 alc861vd_auto_init_hp_out(codec);
15446 alc861vd_auto_init_analog_input(codec);
15447 alc861vd_auto_init_input_src(codec);
15448 if (spec->unsol_event)
15449 alc_inithook(codec);
15452 static int patch_alc861vd(struct hda_codec *codec)
15454 struct alc_spec *spec;
15455 int err, board_config;
15457 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15461 codec->spec = spec;
15463 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15467 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15468 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15470 board_config = ALC861VD_AUTO;
15473 if (board_config == ALC861VD_AUTO) {
15474 /* automatic parse from the BIOS config */
15475 err = alc861vd_parse_auto_config(codec);
15481 "hda_codec: Cannot set up configuration "
15482 "from BIOS. Using base mode...\n");
15483 board_config = ALC861VD_3ST;
15487 err = snd_hda_attach_beep_device(codec, 0x23);
15493 if (board_config != ALC861VD_AUTO)
15494 setup_preset(codec, &alc861vd_presets[board_config]);
15496 if (codec->vendor_id == 0x10ec0660) {
15497 /* always turn on EAPD */
15498 add_verb(spec, alc660vd_eapd_verbs);
15501 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15502 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15504 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15505 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15507 if (!spec->adc_nids) {
15508 spec->adc_nids = alc861vd_adc_nids;
15509 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15511 if (!spec->capsrc_nids)
15512 spec->capsrc_nids = alc861vd_capsrc_nids;
15514 set_capture_mixer(codec);
15515 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15517 spec->vmaster_nid = 0x02;
15519 codec->patch_ops = alc_patch_ops;
15521 if (board_config == ALC861VD_AUTO)
15522 spec->init_hook = alc861vd_auto_init;
15523 #ifdef CONFIG_SND_HDA_POWER_SAVE
15524 if (!spec->loopback.amplist)
15525 spec->loopback.amplist = alc861vd_loopbacks;
15527 codec->proc_widget_hook = print_realtek_coef;
15535 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15536 * configuration. Each pin widget can choose any input DACs and a mixer.
15537 * Each ADC is connected from a mixer of all inputs. This makes possible
15538 * 6-channel independent captures.
15540 * In addition, an independent DAC for the multi-playback (not used in this
15543 #define ALC662_DIGOUT_NID 0x06
15544 #define ALC662_DIGIN_NID 0x0a
15546 static hda_nid_t alc662_dac_nids[4] = {
15547 /* front, rear, clfe, rear_surr */
15551 static hda_nid_t alc272_dac_nids[2] = {
15555 static hda_nid_t alc662_adc_nids[2] = {
15560 static hda_nid_t alc272_adc_nids[1] = {
15565 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15566 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15570 /* FIXME: should be a matrix-type input source selection */
15571 static struct hda_input_mux alc662_capture_source = {
15575 { "Front Mic", 0x1 },
15581 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15589 static struct hda_input_mux alc663_capture_source = {
15593 { "Front Mic", 0x1 },
15598 #if 0 /* set to 1 for testing other input sources below */
15599 static struct hda_input_mux alc272_nc10_capture_source = {
15602 { "Autoselect Mic", 0x0 },
15603 { "Internal Mic", 0x1 },
15604 { "In-0x02", 0x2 },
15605 { "In-0x03", 0x3 },
15606 { "In-0x04", 0x4 },
15607 { "In-0x05", 0x5 },
15608 { "In-0x06", 0x6 },
15609 { "In-0x07", 0x7 },
15610 { "In-0x08", 0x8 },
15611 { "In-0x09", 0x9 },
15612 { "In-0x0a", 0x0a },
15613 { "In-0x0b", 0x0b },
15614 { "In-0x0c", 0x0c },
15615 { "In-0x0d", 0x0d },
15616 { "In-0x0e", 0x0e },
15617 { "In-0x0f", 0x0f },
15625 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15632 static struct hda_verb alc662_3ST_ch2_init[] = {
15633 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15634 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15635 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15636 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15643 static struct hda_verb alc662_3ST_ch6_init[] = {
15644 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15645 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15646 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15647 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15648 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15649 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15653 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15654 { 2, alc662_3ST_ch2_init },
15655 { 6, alc662_3ST_ch6_init },
15661 static struct hda_verb alc662_sixstack_ch6_init[] = {
15662 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15663 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15664 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15671 static struct hda_verb alc662_sixstack_ch8_init[] = {
15672 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15673 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15674 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15678 static struct hda_channel_mode alc662_5stack_modes[2] = {
15679 { 2, alc662_sixstack_ch6_init },
15680 { 6, alc662_sixstack_ch8_init },
15683 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15684 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15687 static struct snd_kcontrol_new alc662_base_mixer[] = {
15688 /* output mixer control */
15689 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15690 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15691 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15692 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15693 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15694 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15695 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15696 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15697 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15699 /*Input mixer control */
15700 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15701 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15702 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15703 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15704 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15705 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15706 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15707 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15711 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15712 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15713 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15714 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15715 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15716 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15717 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15718 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15721 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15722 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15726 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15727 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15728 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15729 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15730 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15731 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15732 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15733 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15734 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15735 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15736 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15737 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15738 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15739 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15740 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15741 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15742 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15743 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15747 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15748 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15749 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15750 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15751 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15753 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15754 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15755 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15756 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15760 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15761 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15762 ALC262_HIPPO_MASTER_SWITCH,
15764 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15765 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15766 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15768 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15769 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15770 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15774 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15775 ALC262_HIPPO_MASTER_SWITCH,
15776 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15777 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15778 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15779 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15780 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15781 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15782 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15783 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15784 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15788 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15789 .ops = &snd_hda_bind_vol,
15791 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15792 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15797 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15798 .ops = &snd_hda_bind_sw,
15800 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15801 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15806 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15807 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15808 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15814 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15815 .ops = &snd_hda_bind_sw,
15817 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15818 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15819 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15824 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15825 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15826 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15829 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15830 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15835 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15836 .ops = &snd_hda_bind_sw,
15838 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15839 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15840 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15845 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15846 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15847 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15850 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15851 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15855 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15856 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15857 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15858 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15861 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15862 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15866 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15867 .ops = &snd_hda_bind_vol,
15869 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15870 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15875 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15876 .ops = &snd_hda_bind_sw,
15878 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15879 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15884 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15885 HDA_BIND_VOL("Master Playback Volume",
15886 &alc663_asus_two_bind_master_vol),
15887 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15888 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15895 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15896 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15897 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15898 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15899 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15905 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15906 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15907 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15908 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15909 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15910 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15914 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15915 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15919 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15920 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15921 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15922 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15926 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15927 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15928 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15929 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15933 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15935 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15936 .name = "Channel Mode",
15937 .info = alc_ch_mode_info,
15938 .get = alc_ch_mode_get,
15939 .put = alc_ch_mode_put,
15944 static struct hda_verb alc662_init_verbs[] = {
15945 /* ADC: mute amp left and right */
15946 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15947 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15948 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15950 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15951 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15952 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15953 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15954 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15958 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15959 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15960 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15961 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15963 /* Front Pin: output 0 (0x0c) */
15964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15965 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15967 /* Rear Pin: output 1 (0x0d) */
15968 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15971 /* CLFE Pin: output 2 (0x0e) */
15972 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15973 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15975 /* Mic (rear) pin: input vref at 80% */
15976 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15977 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15978 /* Front Mic pin: input vref at 80% */
15979 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15980 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15981 /* Line In pin: input */
15982 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15983 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15984 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15985 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15986 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15987 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15988 /* CD pin widget for input */
15989 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15991 /* FIXME: use matrix-type input source selection */
15992 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15995 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15997 /* always trun on EAPD */
15998 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15999 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16004 static struct hda_verb alc662_sue_init_verbs[] = {
16005 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16006 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16010 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16012 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16016 /* Set Unsolicited Event*/
16017 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16018 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16019 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16024 * generic initialization of ADC, input mixers and output mixers
16026 static struct hda_verb alc662_auto_init_verbs[] = {
16028 * Unmute ADC and set the default input to mic-in
16030 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16031 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16033 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16035 * Note: PASD motherboards uses the Line In 2 as the input for front
16036 * panel mic (mic 2)
16038 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16046 * Set up output mixers (0x0c - 0x0f)
16048 /* set vol=0 to output mixers */
16049 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16050 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16051 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16053 /* set up input amps for analog loopback */
16054 /* Amp Indices: DAC = 0, mixer = 1 */
16055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16056 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16058 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16059 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16060 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16063 /* FIXME: use matrix-type input source selection */
16064 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16066 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16067 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16071 /* additional verbs for ALC663 */
16072 static struct hda_verb alc663_auto_init_verbs[] = {
16073 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16074 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16078 static struct hda_verb alc663_m51va_init_verbs[] = {
16079 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16080 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16081 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16082 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16083 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16086 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16087 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16091 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16092 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16093 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16094 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16095 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16096 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16097 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16098 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16102 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16103 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16104 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16105 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16106 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16109 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16110 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16114 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16115 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16116 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16117 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16120 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16121 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16125 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16126 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16127 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16128 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16129 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16132 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16133 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16135 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16136 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16137 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16141 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16142 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16143 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16144 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16145 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16146 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16147 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16148 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16149 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16151 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16152 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16153 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16157 static struct hda_verb alc663_g71v_init_verbs[] = {
16158 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16159 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16160 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16162 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16163 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16164 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16166 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16167 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16168 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16172 static struct hda_verb alc663_g50v_init_verbs[] = {
16173 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16174 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16175 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16177 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16178 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16182 static struct hda_verb alc662_ecs_init_verbs[] = {
16183 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16184 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16185 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16186 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16190 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16191 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16192 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16193 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16194 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16195 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16196 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16197 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16200 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16201 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16205 static struct hda_verb alc272_dell_init_verbs[] = {
16206 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16207 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16209 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16210 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16211 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16212 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16213 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16214 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16215 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16216 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16220 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16221 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16222 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16226 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16227 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16228 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16232 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16234 unsigned int present;
16235 unsigned char bits;
16237 present = snd_hda_codec_read(codec, 0x14, 0,
16238 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16239 bits = present ? HDA_AMP_MUTE : 0;
16240 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16241 HDA_AMP_MUTE, bits);
16244 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16246 unsigned int present;
16247 unsigned char bits;
16249 present = snd_hda_codec_read(codec, 0x1b, 0,
16250 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16251 bits = present ? HDA_AMP_MUTE : 0;
16252 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16253 HDA_AMP_MUTE, bits);
16254 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16255 HDA_AMP_MUTE, bits);
16258 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16261 if ((res >> 26) == ALC880_HP_EVENT)
16262 alc662_lenovo_101e_all_automute(codec);
16263 if ((res >> 26) == ALC880_FRONT_EVENT)
16264 alc662_lenovo_101e_ispeaker_automute(codec);
16267 /* unsolicited event for HP jack sensing */
16268 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16271 if ((res >> 26) == ALC880_MIC_EVENT)
16272 alc_mic_automute(codec);
16274 alc262_hippo_unsol_event(codec, res);
16277 static void alc662_eeepc_setup(struct hda_codec *codec)
16279 struct alc_spec *spec = codec->spec;
16281 alc262_hippo1_setup(codec);
16282 spec->ext_mic.pin = 0x18;
16283 spec->ext_mic.mux_idx = 0;
16284 spec->int_mic.pin = 0x19;
16285 spec->int_mic.mux_idx = 1;
16286 spec->auto_mic = 1;
16289 static void alc662_eeepc_inithook(struct hda_codec *codec)
16291 alc262_hippo_automute(codec);
16292 alc_mic_automute(codec);
16295 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16297 struct alc_spec *spec = codec->spec;
16299 spec->autocfg.hp_pins[0] = 0x14;
16300 spec->autocfg.speaker_pins[0] = 0x1b;
16303 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16305 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16307 unsigned int present;
16308 unsigned char bits;
16310 present = snd_hda_codec_read(codec, 0x21, 0,
16311 AC_VERB_GET_PIN_SENSE, 0)
16312 & AC_PINSENSE_PRESENCE;
16313 bits = present ? HDA_AMP_MUTE : 0;
16314 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16315 AMP_IN_MUTE(0), bits);
16316 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16317 AMP_IN_MUTE(0), bits);
16320 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16322 unsigned int present;
16323 unsigned char bits;
16325 present = snd_hda_codec_read(codec, 0x21, 0,
16326 AC_VERB_GET_PIN_SENSE, 0)
16327 & AC_PINSENSE_PRESENCE;
16328 bits = present ? HDA_AMP_MUTE : 0;
16329 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16330 AMP_IN_MUTE(0), bits);
16331 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16332 AMP_IN_MUTE(0), bits);
16333 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16334 AMP_IN_MUTE(0), bits);
16335 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16336 AMP_IN_MUTE(0), bits);
16339 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16341 unsigned int present;
16342 unsigned char bits;
16344 present = snd_hda_codec_read(codec, 0x15, 0,
16345 AC_VERB_GET_PIN_SENSE, 0)
16346 & AC_PINSENSE_PRESENCE;
16347 bits = present ? HDA_AMP_MUTE : 0;
16348 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16349 AMP_IN_MUTE(0), bits);
16350 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16351 AMP_IN_MUTE(0), bits);
16352 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16353 AMP_IN_MUTE(0), bits);
16354 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16355 AMP_IN_MUTE(0), bits);
16358 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16360 unsigned int present;
16361 unsigned char bits;
16363 present = snd_hda_codec_read(codec, 0x1b, 0,
16364 AC_VERB_GET_PIN_SENSE, 0)
16365 & AC_PINSENSE_PRESENCE;
16366 bits = present ? 0 : PIN_OUT;
16367 snd_hda_codec_write(codec, 0x14, 0,
16368 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16371 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16373 unsigned int present1, present2;
16375 present1 = snd_hda_codec_read(codec, 0x21, 0,
16376 AC_VERB_GET_PIN_SENSE, 0)
16377 & AC_PINSENSE_PRESENCE;
16378 present2 = snd_hda_codec_read(codec, 0x15, 0,
16379 AC_VERB_GET_PIN_SENSE, 0)
16380 & AC_PINSENSE_PRESENCE;
16382 if (present1 || present2) {
16383 snd_hda_codec_write_cache(codec, 0x14, 0,
16384 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16386 snd_hda_codec_write_cache(codec, 0x14, 0,
16387 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16391 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16393 unsigned int present1, present2;
16395 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16396 AC_VERB_GET_PIN_SENSE, 0)
16397 & AC_PINSENSE_PRESENCE;
16398 present2 = snd_hda_codec_read(codec, 0x15, 0,
16399 AC_VERB_GET_PIN_SENSE, 0)
16400 & AC_PINSENSE_PRESENCE;
16402 if (present1 || present2) {
16403 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16404 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16405 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16406 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16408 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16409 AMP_IN_MUTE(0), 0);
16410 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16411 AMP_IN_MUTE(0), 0);
16415 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16418 switch (res >> 26) {
16419 case ALC880_HP_EVENT:
16420 alc663_m51va_speaker_automute(codec);
16422 case ALC880_MIC_EVENT:
16423 alc_mic_automute(codec);
16428 static void alc663_m51va_setup(struct hda_codec *codec)
16430 struct alc_spec *spec = codec->spec;
16431 spec->ext_mic.pin = 0x18;
16432 spec->ext_mic.mux_idx = 0;
16433 spec->int_mic.pin = 0x12;
16434 spec->int_mic.mux_idx = 1;
16435 spec->auto_mic = 1;
16438 static void alc663_m51va_inithook(struct hda_codec *codec)
16440 alc663_m51va_speaker_automute(codec);
16441 alc_mic_automute(codec);
16444 /* ***************** Mode1 ******************************/
16445 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16446 #define alc663_mode1_setup alc663_m51va_setup
16447 #define alc663_mode1_inithook alc663_m51va_inithook
16449 /* ***************** Mode2 ******************************/
16450 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16453 switch (res >> 26) {
16454 case ALC880_HP_EVENT:
16455 alc662_f5z_speaker_automute(codec);
16457 case ALC880_MIC_EVENT:
16458 alc_mic_automute(codec);
16463 #define alc662_mode2_setup alc663_m51va_setup
16465 static void alc662_mode2_inithook(struct hda_codec *codec)
16467 alc662_f5z_speaker_automute(codec);
16468 alc_mic_automute(codec);
16470 /* ***************** Mode3 ******************************/
16471 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16474 switch (res >> 26) {
16475 case ALC880_HP_EVENT:
16476 alc663_two_hp_m1_speaker_automute(codec);
16478 case ALC880_MIC_EVENT:
16479 alc_mic_automute(codec);
16484 #define alc663_mode3_setup alc663_m51va_setup
16486 static void alc663_mode3_inithook(struct hda_codec *codec)
16488 alc663_two_hp_m1_speaker_automute(codec);
16489 alc_mic_automute(codec);
16491 /* ***************** Mode4 ******************************/
16492 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16495 switch (res >> 26) {
16496 case ALC880_HP_EVENT:
16497 alc663_21jd_two_speaker_automute(codec);
16499 case ALC880_MIC_EVENT:
16500 alc_mic_automute(codec);
16505 #define alc663_mode4_setup alc663_m51va_setup
16507 static void alc663_mode4_inithook(struct hda_codec *codec)
16509 alc663_21jd_two_speaker_automute(codec);
16510 alc_mic_automute(codec);
16512 /* ***************** Mode5 ******************************/
16513 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16516 switch (res >> 26) {
16517 case ALC880_HP_EVENT:
16518 alc663_15jd_two_speaker_automute(codec);
16520 case ALC880_MIC_EVENT:
16521 alc_mic_automute(codec);
16526 #define alc663_mode5_setup alc663_m51va_setup
16528 static void alc663_mode5_inithook(struct hda_codec *codec)
16530 alc663_15jd_two_speaker_automute(codec);
16531 alc_mic_automute(codec);
16533 /* ***************** Mode6 ******************************/
16534 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16537 switch (res >> 26) {
16538 case ALC880_HP_EVENT:
16539 alc663_two_hp_m2_speaker_automute(codec);
16541 case ALC880_MIC_EVENT:
16542 alc_mic_automute(codec);
16547 #define alc663_mode6_setup alc663_m51va_setup
16549 static void alc663_mode6_inithook(struct hda_codec *codec)
16551 alc663_two_hp_m2_speaker_automute(codec);
16552 alc_mic_automute(codec);
16555 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16557 unsigned int present;
16558 unsigned char bits;
16560 present = snd_hda_codec_read(codec, 0x21, 0,
16561 AC_VERB_GET_PIN_SENSE, 0)
16562 & AC_PINSENSE_PRESENCE;
16563 bits = present ? HDA_AMP_MUTE : 0;
16564 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16565 HDA_AMP_MUTE, bits);
16566 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16567 HDA_AMP_MUTE, bits);
16570 static void alc663_g71v_front_automute(struct hda_codec *codec)
16572 unsigned int present;
16573 unsigned char bits;
16575 present = snd_hda_codec_read(codec, 0x15, 0,
16576 AC_VERB_GET_PIN_SENSE, 0)
16577 & AC_PINSENSE_PRESENCE;
16578 bits = present ? HDA_AMP_MUTE : 0;
16579 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16580 HDA_AMP_MUTE, bits);
16583 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16586 switch (res >> 26) {
16587 case ALC880_HP_EVENT:
16588 alc663_g71v_hp_automute(codec);
16590 case ALC880_FRONT_EVENT:
16591 alc663_g71v_front_automute(codec);
16593 case ALC880_MIC_EVENT:
16594 alc_mic_automute(codec);
16599 #define alc663_g71v_setup alc663_m51va_setup
16601 static void alc663_g71v_inithook(struct hda_codec *codec)
16603 alc663_g71v_front_automute(codec);
16604 alc663_g71v_hp_automute(codec);
16605 alc_mic_automute(codec);
16608 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16611 switch (res >> 26) {
16612 case ALC880_HP_EVENT:
16613 alc663_m51va_speaker_automute(codec);
16615 case ALC880_MIC_EVENT:
16616 alc_mic_automute(codec);
16621 #define alc663_g50v_setup alc663_m51va_setup
16623 static void alc663_g50v_inithook(struct hda_codec *codec)
16625 alc663_m51va_speaker_automute(codec);
16626 alc_mic_automute(codec);
16629 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16630 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16631 ALC262_HIPPO_MASTER_SWITCH,
16633 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16634 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16635 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16637 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16638 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16639 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16643 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16644 /* Master Playback automatically created from Speaker and Headphone */
16645 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16646 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16647 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16650 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16651 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16652 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16654 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16655 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16656 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16660 #ifdef CONFIG_SND_HDA_POWER_SAVE
16661 #define alc662_loopbacks alc880_loopbacks
16665 /* pcm configuration: identical with ALC880 */
16666 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16667 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16668 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16669 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16672 * configuration and preset
16674 static const char *alc662_models[ALC662_MODEL_LAST] = {
16675 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16676 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16677 [ALC662_3ST_6ch] = "3stack-6ch",
16678 [ALC662_5ST_DIG] = "6stack-dig",
16679 [ALC662_LENOVO_101E] = "lenovo-101e",
16680 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16681 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16682 [ALC662_ECS] = "ecs",
16683 [ALC663_ASUS_M51VA] = "m51va",
16684 [ALC663_ASUS_G71V] = "g71v",
16685 [ALC663_ASUS_H13] = "h13",
16686 [ALC663_ASUS_G50V] = "g50v",
16687 [ALC663_ASUS_MODE1] = "asus-mode1",
16688 [ALC662_ASUS_MODE2] = "asus-mode2",
16689 [ALC663_ASUS_MODE3] = "asus-mode3",
16690 [ALC663_ASUS_MODE4] = "asus-mode4",
16691 [ALC663_ASUS_MODE5] = "asus-mode5",
16692 [ALC663_ASUS_MODE6] = "asus-mode6",
16693 [ALC272_DELL] = "dell",
16694 [ALC272_DELL_ZM1] = "dell-zm1",
16695 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16696 [ALC662_AUTO] = "auto",
16699 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16700 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16701 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16702 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16703 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16704 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16705 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16706 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16707 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16708 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16709 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16710 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16711 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16712 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16713 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16714 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16715 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16716 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16717 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16718 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16719 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16720 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16721 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16722 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16723 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16724 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16725 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16726 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16727 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16728 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16729 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16730 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16731 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16732 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16733 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16734 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16735 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16736 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16737 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16738 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16739 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16740 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16741 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16742 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16743 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16744 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16745 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16746 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16747 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16748 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16749 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16750 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16751 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16752 ALC662_3ST_6ch_DIG),
16753 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16754 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16755 ALC662_3ST_6ch_DIG),
16756 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16757 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16758 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16759 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16760 ALC662_3ST_6ch_DIG),
16761 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16766 static struct alc_config_preset alc662_presets[] = {
16767 [ALC662_3ST_2ch_DIG] = {
16768 .mixers = { alc662_3ST_2ch_mixer },
16769 .init_verbs = { alc662_init_verbs },
16770 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16771 .dac_nids = alc662_dac_nids,
16772 .dig_out_nid = ALC662_DIGOUT_NID,
16773 .dig_in_nid = ALC662_DIGIN_NID,
16774 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16775 .channel_mode = alc662_3ST_2ch_modes,
16776 .input_mux = &alc662_capture_source,
16778 [ALC662_3ST_6ch_DIG] = {
16779 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16780 .init_verbs = { alc662_init_verbs },
16781 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16782 .dac_nids = alc662_dac_nids,
16783 .dig_out_nid = ALC662_DIGOUT_NID,
16784 .dig_in_nid = ALC662_DIGIN_NID,
16785 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16786 .channel_mode = alc662_3ST_6ch_modes,
16788 .input_mux = &alc662_capture_source,
16790 [ALC662_3ST_6ch] = {
16791 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16792 .init_verbs = { alc662_init_verbs },
16793 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16794 .dac_nids = alc662_dac_nids,
16795 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16796 .channel_mode = alc662_3ST_6ch_modes,
16798 .input_mux = &alc662_capture_source,
16800 [ALC662_5ST_DIG] = {
16801 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16802 .init_verbs = { alc662_init_verbs },
16803 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16804 .dac_nids = alc662_dac_nids,
16805 .dig_out_nid = ALC662_DIGOUT_NID,
16806 .dig_in_nid = ALC662_DIGIN_NID,
16807 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16808 .channel_mode = alc662_5stack_modes,
16809 .input_mux = &alc662_capture_source,
16811 [ALC662_LENOVO_101E] = {
16812 .mixers = { alc662_lenovo_101e_mixer },
16813 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16814 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16815 .dac_nids = alc662_dac_nids,
16816 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16817 .channel_mode = alc662_3ST_2ch_modes,
16818 .input_mux = &alc662_lenovo_101e_capture_source,
16819 .unsol_event = alc662_lenovo_101e_unsol_event,
16820 .init_hook = alc662_lenovo_101e_all_automute,
16822 [ALC662_ASUS_EEEPC_P701] = {
16823 .mixers = { alc662_eeepc_p701_mixer },
16824 .init_verbs = { alc662_init_verbs,
16825 alc662_eeepc_sue_init_verbs },
16826 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16827 .dac_nids = alc662_dac_nids,
16828 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16829 .channel_mode = alc662_3ST_2ch_modes,
16830 .unsol_event = alc662_eeepc_unsol_event,
16831 .setup = alc662_eeepc_setup,
16832 .init_hook = alc662_eeepc_inithook,
16834 [ALC662_ASUS_EEEPC_EP20] = {
16835 .mixers = { alc662_eeepc_ep20_mixer,
16836 alc662_chmode_mixer },
16837 .init_verbs = { alc662_init_verbs,
16838 alc662_eeepc_ep20_sue_init_verbs },
16839 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16840 .dac_nids = alc662_dac_nids,
16841 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16842 .channel_mode = alc662_3ST_6ch_modes,
16843 .input_mux = &alc662_lenovo_101e_capture_source,
16844 .unsol_event = alc662_eeepc_unsol_event,
16845 .setup = alc662_eeepc_ep20_setup,
16846 .init_hook = alc662_eeepc_ep20_inithook,
16849 .mixers = { alc662_ecs_mixer },
16850 .init_verbs = { alc662_init_verbs,
16851 alc662_ecs_init_verbs },
16852 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16853 .dac_nids = alc662_dac_nids,
16854 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16855 .channel_mode = alc662_3ST_2ch_modes,
16856 .unsol_event = alc662_eeepc_unsol_event,
16857 .setup = alc662_eeepc_setup,
16858 .init_hook = alc662_eeepc_inithook,
16860 [ALC663_ASUS_M51VA] = {
16861 .mixers = { alc663_m51va_mixer },
16862 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16863 .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_m51va_unsol_event,
16869 .setup = alc663_m51va_setup,
16870 .init_hook = alc663_m51va_inithook,
16872 [ALC663_ASUS_G71V] = {
16873 .mixers = { alc663_g71v_mixer },
16874 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16875 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16876 .dac_nids = alc662_dac_nids,
16877 .dig_out_nid = ALC662_DIGOUT_NID,
16878 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16879 .channel_mode = alc662_3ST_2ch_modes,
16880 .unsol_event = alc663_g71v_unsol_event,
16881 .setup = alc663_g71v_setup,
16882 .init_hook = alc663_g71v_inithook,
16884 [ALC663_ASUS_H13] = {
16885 .mixers = { alc663_m51va_mixer },
16886 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16887 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16888 .dac_nids = alc662_dac_nids,
16889 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16890 .channel_mode = alc662_3ST_2ch_modes,
16891 .unsol_event = alc663_m51va_unsol_event,
16892 .init_hook = alc663_m51va_inithook,
16894 [ALC663_ASUS_G50V] = {
16895 .mixers = { alc663_g50v_mixer },
16896 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16897 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16898 .dac_nids = alc662_dac_nids,
16899 .dig_out_nid = ALC662_DIGOUT_NID,
16900 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16901 .channel_mode = alc662_3ST_6ch_modes,
16902 .input_mux = &alc663_capture_source,
16903 .unsol_event = alc663_g50v_unsol_event,
16904 .setup = alc663_g50v_setup,
16905 .init_hook = alc663_g50v_inithook,
16907 [ALC663_ASUS_MODE1] = {
16908 .mixers = { alc663_m51va_mixer },
16909 .cap_mixer = alc662_auto_capture_mixer,
16910 .init_verbs = { alc662_init_verbs,
16911 alc663_21jd_amic_init_verbs },
16912 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16914 .dac_nids = alc662_dac_nids,
16915 .dig_out_nid = ALC662_DIGOUT_NID,
16916 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16917 .channel_mode = alc662_3ST_2ch_modes,
16918 .unsol_event = alc663_mode1_unsol_event,
16919 .setup = alc663_mode1_setup,
16920 .init_hook = alc663_mode1_inithook,
16922 [ALC662_ASUS_MODE2] = {
16923 .mixers = { alc662_1bjd_mixer },
16924 .cap_mixer = alc662_auto_capture_mixer,
16925 .init_verbs = { alc662_init_verbs,
16926 alc662_1bjd_amic_init_verbs },
16927 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16928 .dac_nids = alc662_dac_nids,
16929 .dig_out_nid = ALC662_DIGOUT_NID,
16930 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16931 .channel_mode = alc662_3ST_2ch_modes,
16932 .unsol_event = alc662_mode2_unsol_event,
16933 .setup = alc662_mode2_setup,
16934 .init_hook = alc662_mode2_inithook,
16936 [ALC663_ASUS_MODE3] = {
16937 .mixers = { alc663_two_hp_m1_mixer },
16938 .cap_mixer = alc662_auto_capture_mixer,
16939 .init_verbs = { alc662_init_verbs,
16940 alc663_two_hp_amic_m1_init_verbs },
16941 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16943 .dac_nids = alc662_dac_nids,
16944 .dig_out_nid = ALC662_DIGOUT_NID,
16945 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16946 .channel_mode = alc662_3ST_2ch_modes,
16947 .unsol_event = alc663_mode3_unsol_event,
16948 .setup = alc663_mode3_setup,
16949 .init_hook = alc663_mode3_inithook,
16951 [ALC663_ASUS_MODE4] = {
16952 .mixers = { alc663_asus_21jd_clfe_mixer },
16953 .cap_mixer = alc662_auto_capture_mixer,
16954 .init_verbs = { alc662_init_verbs,
16955 alc663_21jd_amic_init_verbs},
16956 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16958 .dac_nids = alc662_dac_nids,
16959 .dig_out_nid = ALC662_DIGOUT_NID,
16960 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16961 .channel_mode = alc662_3ST_2ch_modes,
16962 .unsol_event = alc663_mode4_unsol_event,
16963 .setup = alc663_mode4_setup,
16964 .init_hook = alc663_mode4_inithook,
16966 [ALC663_ASUS_MODE5] = {
16967 .mixers = { alc663_asus_15jd_clfe_mixer },
16968 .cap_mixer = alc662_auto_capture_mixer,
16969 .init_verbs = { alc662_init_verbs,
16970 alc663_15jd_amic_init_verbs },
16971 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16973 .dac_nids = alc662_dac_nids,
16974 .dig_out_nid = ALC662_DIGOUT_NID,
16975 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16976 .channel_mode = alc662_3ST_2ch_modes,
16977 .unsol_event = alc663_mode5_unsol_event,
16978 .setup = alc663_mode5_setup,
16979 .init_hook = alc663_mode5_inithook,
16981 [ALC663_ASUS_MODE6] = {
16982 .mixers = { alc663_two_hp_m2_mixer },
16983 .cap_mixer = alc662_auto_capture_mixer,
16984 .init_verbs = { alc662_init_verbs,
16985 alc663_two_hp_amic_m2_init_verbs },
16986 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16988 .dac_nids = alc662_dac_nids,
16989 .dig_out_nid = ALC662_DIGOUT_NID,
16990 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16991 .channel_mode = alc662_3ST_2ch_modes,
16992 .unsol_event = alc663_mode6_unsol_event,
16993 .setup = alc663_mode6_setup,
16994 .init_hook = alc663_mode6_inithook,
16997 .mixers = { alc663_m51va_mixer },
16998 .cap_mixer = alc272_auto_capture_mixer,
16999 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17000 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17001 .dac_nids = alc662_dac_nids,
17002 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17003 .adc_nids = alc272_adc_nids,
17004 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17005 .capsrc_nids = alc272_capsrc_nids,
17006 .channel_mode = alc662_3ST_2ch_modes,
17007 .unsol_event = alc663_m51va_unsol_event,
17008 .setup = alc663_m51va_setup,
17009 .init_hook = alc663_m51va_inithook,
17011 [ALC272_DELL_ZM1] = {
17012 .mixers = { alc663_m51va_mixer },
17013 .cap_mixer = alc662_auto_capture_mixer,
17014 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17015 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17016 .dac_nids = alc662_dac_nids,
17017 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17018 .adc_nids = alc662_adc_nids,
17020 .capsrc_nids = alc662_capsrc_nids,
17021 .channel_mode = alc662_3ST_2ch_modes,
17022 .unsol_event = alc663_m51va_unsol_event,
17023 .setup = alc663_m51va_setup,
17024 .init_hook = alc663_m51va_inithook,
17026 [ALC272_SAMSUNG_NC10] = {
17027 .mixers = { alc272_nc10_mixer },
17028 .init_verbs = { alc662_init_verbs,
17029 alc663_21jd_amic_init_verbs },
17030 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17031 .dac_nids = alc272_dac_nids,
17032 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17033 .channel_mode = alc662_3ST_2ch_modes,
17034 /*.input_mux = &alc272_nc10_capture_source,*/
17035 .unsol_event = alc663_mode4_unsol_event,
17036 .setup = alc663_mode4_setup,
17037 .init_hook = alc663_mode4_inithook,
17043 * BIOS auto configuration
17046 /* add playback controls from the parsed DAC table */
17047 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17048 const struct auto_pin_cfg *cfg)
17051 static const char *chname[4] = {
17052 "Front", "Surround", NULL /*CLFE*/, "Side"
17057 for (i = 0; i < cfg->line_outs; i++) {
17058 if (!spec->multiout.dac_nids[i])
17060 nid = alc880_idx_to_dac(i);
17063 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17064 "Center Playback Volume",
17065 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17069 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17070 "LFE Playback Volume",
17071 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17075 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17076 "Center Playback Switch",
17077 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17081 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17082 "LFE Playback Switch",
17083 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17089 if (cfg->line_outs == 1 &&
17090 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17097 sprintf(name, "%s Playback Volume", pfx);
17098 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17099 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17103 if (cfg->line_outs == 1 &&
17104 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17106 sprintf(name, "%s Playback Switch", pfx);
17107 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17108 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17117 /* add playback controls for speaker and HP outputs */
17118 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17129 /* ALC663 has a mono output pin on 0x17 */
17130 sprintf(name, "%s Playback Switch", pfx);
17131 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17132 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17136 if (alc880_is_fixed_pin(pin)) {
17137 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17138 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17139 /* specify the DAC as the extra output */
17140 if (!spec->multiout.hp_nid)
17141 spec->multiout.hp_nid = nid;
17143 spec->multiout.extra_out_nid[0] = nid;
17144 /* control HP volume/switch on the output mixer amp */
17145 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17146 sprintf(name, "%s Playback Volume", pfx);
17147 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17148 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17151 sprintf(name, "%s Playback Switch", pfx);
17152 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17153 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17156 } else if (alc880_is_multi_pin(pin)) {
17157 /* set manual connection */
17158 /* we have only a switch on HP-out PIN */
17159 sprintf(name, "%s Playback Switch", pfx);
17160 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17161 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17168 /* create playback/capture controls for input pins */
17169 #define alc662_auto_create_input_ctls \
17170 alc880_auto_create_input_ctls
17172 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17173 hda_nid_t nid, int pin_type,
17176 alc_set_pin_output(codec, nid, pin_type);
17177 /* need the manual connection? */
17178 if (alc880_is_multi_pin(nid)) {
17179 struct alc_spec *spec = codec->spec;
17180 int idx = alc880_multi_pin_idx(nid);
17181 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17182 AC_VERB_SET_CONNECT_SEL,
17183 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17187 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17189 struct alc_spec *spec = codec->spec;
17192 for (i = 0; i <= HDA_SIDE; i++) {
17193 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17194 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17196 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17201 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17203 struct alc_spec *spec = codec->spec;
17206 pin = spec->autocfg.hp_pins[0];
17207 if (pin) /* connect to front */
17209 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17210 pin = spec->autocfg.speaker_pins[0];
17212 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17215 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17217 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17219 struct alc_spec *spec = codec->spec;
17222 for (i = 0; i < AUTO_PIN_LAST; i++) {
17223 hda_nid_t nid = spec->autocfg.input_pins[i];
17224 if (alc_is_input_pin(codec, nid)) {
17225 alc_set_input_pin(codec, nid, i);
17226 if (nid != ALC662_PIN_CD_NID &&
17227 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17228 snd_hda_codec_write(codec, nid, 0,
17229 AC_VERB_SET_AMP_GAIN_MUTE,
17235 #define alc662_auto_init_input_src alc882_auto_init_input_src
17237 static int alc662_parse_auto_config(struct hda_codec *codec)
17239 struct alc_spec *spec = codec->spec;
17241 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17243 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17247 if (!spec->autocfg.line_outs)
17248 return 0; /* can't find valid BIOS pin config */
17250 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17253 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17256 err = alc662_auto_create_extra_out(spec,
17257 spec->autocfg.speaker_pins[0],
17261 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17265 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17269 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17271 if (spec->autocfg.dig_outs)
17272 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17274 if (spec->kctls.list)
17275 add_mixer(spec, spec->kctls.list);
17277 spec->num_mux_defs = 1;
17278 spec->input_mux = &spec->private_imux[0];
17280 add_verb(spec, alc662_auto_init_verbs);
17281 if (codec->vendor_id == 0x10ec0663)
17282 add_verb(spec, alc663_auto_init_verbs);
17284 err = alc_auto_add_mic_boost(codec);
17288 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17293 /* additional initialization for auto-configuration model */
17294 static void alc662_auto_init(struct hda_codec *codec)
17296 struct alc_spec *spec = codec->spec;
17297 alc662_auto_init_multi_out(codec);
17298 alc662_auto_init_hp_out(codec);
17299 alc662_auto_init_analog_input(codec);
17300 alc662_auto_init_input_src(codec);
17301 if (spec->unsol_event)
17302 alc_inithook(codec);
17305 static int patch_alc662(struct hda_codec *codec)
17307 struct alc_spec *spec;
17308 int err, board_config;
17310 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17314 codec->spec = spec;
17316 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17318 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17321 if (board_config < 0) {
17322 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17324 board_config = ALC662_AUTO;
17327 if (board_config == ALC662_AUTO) {
17328 /* automatic parse from the BIOS config */
17329 err = alc662_parse_auto_config(codec);
17335 "hda_codec: Cannot set up configuration "
17336 "from BIOS. Using base mode...\n");
17337 board_config = ALC662_3ST_2ch_DIG;
17341 err = snd_hda_attach_beep_device(codec, 0x1);
17347 if (board_config != ALC662_AUTO)
17348 setup_preset(codec, &alc662_presets[board_config]);
17350 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17351 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17353 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17354 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17356 if (!spec->adc_nids) {
17357 spec->adc_nids = alc662_adc_nids;
17358 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17360 if (!spec->capsrc_nids)
17361 spec->capsrc_nids = alc662_capsrc_nids;
17363 if (!spec->cap_mixer)
17364 set_capture_mixer(codec);
17365 if (codec->vendor_id == 0x10ec0662)
17366 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17368 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17370 spec->vmaster_nid = 0x02;
17372 codec->patch_ops = alc_patch_ops;
17373 if (board_config == ALC662_AUTO)
17374 spec->init_hook = alc662_auto_init;
17375 #ifdef CONFIG_SND_HDA_POWER_SAVE
17376 if (!spec->loopback.amplist)
17377 spec->loopback.amplist = alc662_loopbacks;
17379 codec->proc_widget_hook = print_realtek_coef;
17387 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17388 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17389 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17390 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17391 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17392 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17393 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17394 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17395 .patch = patch_alc861 },
17396 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17397 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17398 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17399 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17400 .patch = patch_alc882 },
17401 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17402 .patch = patch_alc662 },
17403 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17404 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17405 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17406 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17407 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17408 .patch = patch_alc882 },
17409 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17410 .patch = patch_alc882 },
17411 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17412 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17413 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17414 .patch = patch_alc882 },
17415 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17416 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17417 {} /* terminator */
17420 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17422 MODULE_LICENSE("GPL");
17423 MODULE_DESCRIPTION("Realtek HD-audio codec");
17425 static struct hda_codec_preset_list realtek_list = {
17426 .preset = snd_hda_preset_realtek,
17427 .owner = THIS_MODULE,
17430 static int __init patch_realtek_init(void)
17432 return snd_hda_add_codec_preset(&realtek_list);
17435 static void __exit patch_realtek_exit(void)
17437 snd_hda_delete_codec_preset(&realtek_list);
17440 module_init(patch_realtek_init)
17441 module_exit(patch_realtek_exit)