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 */
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
219 ALC883_TARGA_2ch_DIG,
220 ALC883_TARGA_8ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
224 ALC888_ACER_ASPIRE_6530G,
225 ALC888_ACER_ASPIRE_8930G,
226 ALC888_ACER_ASPIRE_7730G,
230 ALC883_LENOVO_101E_2ch,
231 ALC883_LENOVO_NB0763,
232 ALC888_LENOVO_MS7195_DIG,
240 ALC883_FUJITSU_PI2515,
241 ALC888_FUJITSU_XA3530,
242 ALC883_3ST_6ch_INTEL,
255 #define GPIO_MASK 0x03
257 /* extra amp-initialization sequence types */
266 struct alc_mic_route {
268 unsigned char mux_idx;
269 unsigned char amix_idx;
272 #define MUX_IDX_UNDEF ((unsigned char)-1)
275 /* codec parameterization */
276 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
277 unsigned int num_mixers;
278 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
279 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
281 const struct hda_verb *init_verbs[10]; /* initialization verbs
285 unsigned int num_init_verbs;
287 char stream_name_analog[32]; /* analog PCM stream */
288 struct hda_pcm_stream *stream_analog_playback;
289 struct hda_pcm_stream *stream_analog_capture;
290 struct hda_pcm_stream *stream_analog_alt_playback;
291 struct hda_pcm_stream *stream_analog_alt_capture;
293 char stream_name_digital[32]; /* digital PCM stream */
294 struct hda_pcm_stream *stream_digital_playback;
295 struct hda_pcm_stream *stream_digital_capture;
298 struct hda_multi_out multiout; /* playback set-up
299 * max_channels, dacs must be set
300 * dig_out_nid and hp_nid are optional
302 hda_nid_t alt_dac_nid;
303 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
307 unsigned int num_adc_nids;
309 hda_nid_t *capsrc_nids;
310 hda_nid_t dig_in_nid; /* digital-in NID; optional */
313 unsigned int num_mux_defs;
314 const struct hda_input_mux *input_mux;
315 unsigned int cur_mux[3];
316 struct alc_mic_route ext_mic;
317 struct alc_mic_route int_mic;
320 const struct hda_channel_mode *channel_mode;
321 int num_channel_mode;
323 int const_channel_count;
324 int ext_channel_count;
326 /* PCM information */
327 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
329 /* dynamic controls, init_verbs and input_mux */
330 struct auto_pin_cfg autocfg;
331 struct snd_array kctls;
332 struct hda_input_mux private_imux[3];
333 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
334 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
335 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
341 /* for pin sensing */
342 unsigned int sense_updated: 1;
343 unsigned int jack_present: 1;
344 unsigned int master_sw: 1;
345 unsigned int auto_mic:1;
348 unsigned int no_analog :1; /* digital I/O only */
351 /* for virtual master */
352 hda_nid_t vmaster_nid;
353 #ifdef CONFIG_SND_HDA_POWER_SAVE
354 struct hda_loopback_check loopback;
359 unsigned int pll_coef_idx, pll_coef_bit;
363 * configuration template - to be copied to the spec instance
365 struct alc_config_preset {
366 struct snd_kcontrol_new *mixers[5]; /* should be identical size
369 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
370 const struct hda_verb *init_verbs[5];
371 unsigned int num_dacs;
373 hda_nid_t dig_out_nid; /* optional */
374 hda_nid_t hp_nid; /* optional */
375 hda_nid_t *slave_dig_outs;
376 unsigned int num_adc_nids;
378 hda_nid_t *capsrc_nids;
379 hda_nid_t dig_in_nid;
380 unsigned int num_channel_mode;
381 const struct hda_channel_mode *channel_mode;
383 int const_channel_count;
384 unsigned int num_mux_defs;
385 const struct hda_input_mux *input_mux;
386 void (*unsol_event)(struct hda_codec *, unsigned int);
387 void (*setup)(struct hda_codec *);
388 void (*init_hook)(struct hda_codec *);
389 #ifdef CONFIG_SND_HDA_POWER_SAVE
390 struct hda_amp_list *loopbacks;
398 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
399 struct snd_ctl_elem_info *uinfo)
401 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
402 struct alc_spec *spec = codec->spec;
403 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
404 if (mux_idx >= spec->num_mux_defs)
406 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
409 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
410 struct snd_ctl_elem_value *ucontrol)
412 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
413 struct alc_spec *spec = codec->spec;
414 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
416 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
420 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
421 struct snd_ctl_elem_value *ucontrol)
423 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
424 struct alc_spec *spec = codec->spec;
425 const struct hda_input_mux *imux;
426 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
427 unsigned int mux_idx;
428 hda_nid_t nid = spec->capsrc_nids ?
429 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
432 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
433 imux = &spec->input_mux[mux_idx];
435 type = get_wcaps_type(get_wcaps(codec, nid));
436 if (type == AC_WID_AUD_MIX) {
437 /* Matrix-mixer style (e.g. ALC882) */
438 unsigned int *cur_val = &spec->cur_mux[adc_idx];
441 idx = ucontrol->value.enumerated.item[0];
442 if (idx >= imux->num_items)
443 idx = imux->num_items - 1;
446 for (i = 0; i < imux->num_items; i++) {
447 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
448 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
449 imux->items[i].index,
455 /* MUX style (e.g. ALC880) */
456 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
457 &spec->cur_mux[adc_idx]);
462 * channel mode setting
464 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
465 struct snd_ctl_elem_info *uinfo)
467 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
468 struct alc_spec *spec = codec->spec;
469 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
470 spec->num_channel_mode);
473 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
474 struct snd_ctl_elem_value *ucontrol)
476 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
477 struct alc_spec *spec = codec->spec;
478 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
479 spec->num_channel_mode,
480 spec->ext_channel_count);
483 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
484 struct snd_ctl_elem_value *ucontrol)
486 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
487 struct alc_spec *spec = codec->spec;
488 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
489 spec->num_channel_mode,
490 &spec->ext_channel_count);
491 if (err >= 0 && !spec->const_channel_count) {
492 spec->multiout.max_channels = spec->ext_channel_count;
493 if (spec->need_dac_fix)
494 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
500 * Control the mode of pin widget settings via the mixer. "pc" is used
501 * instead of "%" to avoid consequences of accidently treating the % as
502 * being part of a format specifier. Maximum allowed length of a value is
503 * 63 characters plus NULL terminator.
505 * Note: some retasking pin complexes seem to ignore requests for input
506 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
507 * are requested. Therefore order this list so that this behaviour will not
508 * cause problems when mixer clients move through the enum sequentially.
509 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
512 static char *alc_pin_mode_names[] = {
513 "Mic 50pc bias", "Mic 80pc bias",
514 "Line in", "Line out", "Headphone out",
516 static unsigned char alc_pin_mode_values[] = {
517 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
519 /* The control can present all 5 options, or it can limit the options based
520 * in the pin being assumed to be exclusively an input or an output pin. In
521 * addition, "input" pins may or may not process the mic bias option
522 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
523 * accept requests for bias as of chip versions up to March 2006) and/or
524 * wiring in the computer.
526 #define ALC_PIN_DIR_IN 0x00
527 #define ALC_PIN_DIR_OUT 0x01
528 #define ALC_PIN_DIR_INOUT 0x02
529 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
530 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
532 /* Info about the pin modes supported by the different pin direction modes.
533 * For each direction the minimum and maximum values are given.
535 static signed char alc_pin_mode_dir_info[5][2] = {
536 { 0, 2 }, /* ALC_PIN_DIR_IN */
537 { 3, 4 }, /* ALC_PIN_DIR_OUT */
538 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
539 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
540 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
542 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
543 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
544 #define alc_pin_mode_n_items(_dir) \
545 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
547 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
548 struct snd_ctl_elem_info *uinfo)
550 unsigned int item_num = uinfo->value.enumerated.item;
551 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
553 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
555 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
557 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
558 item_num = alc_pin_mode_min(dir);
559 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
563 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
564 struct snd_ctl_elem_value *ucontrol)
567 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
568 hda_nid_t nid = kcontrol->private_value & 0xffff;
569 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
570 long *valp = ucontrol->value.integer.value;
571 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
572 AC_VERB_GET_PIN_WIDGET_CONTROL,
575 /* Find enumerated value for current pinctl setting */
576 i = alc_pin_mode_min(dir);
577 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
579 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
583 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
584 struct snd_ctl_elem_value *ucontrol)
587 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
588 hda_nid_t nid = kcontrol->private_value & 0xffff;
589 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
590 long val = *ucontrol->value.integer.value;
591 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
592 AC_VERB_GET_PIN_WIDGET_CONTROL,
595 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
596 val = alc_pin_mode_min(dir);
598 change = pinctl != alc_pin_mode_values[val];
600 /* Set pin mode to that requested */
601 snd_hda_codec_write_cache(codec, nid, 0,
602 AC_VERB_SET_PIN_WIDGET_CONTROL,
603 alc_pin_mode_values[val]);
605 /* Also enable the retasking pin's input/output as required
606 * for the requested pin mode. Enum values of 2 or less are
609 * Dynamically switching the input/output buffers probably
610 * reduces noise slightly (particularly on input) so we'll
611 * do it. However, having both input and output buffers
612 * enabled simultaneously doesn't seem to be problematic if
613 * this turns out to be necessary in the future.
616 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
617 HDA_AMP_MUTE, HDA_AMP_MUTE);
618 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
621 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
622 HDA_AMP_MUTE, HDA_AMP_MUTE);
623 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
630 #define ALC_PIN_MODE(xname, nid, dir) \
631 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
632 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
633 .info = alc_pin_mode_info, \
634 .get = alc_pin_mode_get, \
635 .put = alc_pin_mode_put, \
636 .private_value = nid | (dir<<16) }
638 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
639 * together using a mask with more than one bit set. This control is
640 * currently used only by the ALC260 test model. At this stage they are not
641 * needed for any "production" models.
643 #ifdef CONFIG_SND_DEBUG
644 #define alc_gpio_data_info snd_ctl_boolean_mono_info
646 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
647 struct snd_ctl_elem_value *ucontrol)
649 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
650 hda_nid_t nid = kcontrol->private_value & 0xffff;
651 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
652 long *valp = ucontrol->value.integer.value;
653 unsigned int val = snd_hda_codec_read(codec, nid, 0,
654 AC_VERB_GET_GPIO_DATA, 0x00);
656 *valp = (val & mask) != 0;
659 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
660 struct snd_ctl_elem_value *ucontrol)
663 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
664 hda_nid_t nid = kcontrol->private_value & 0xffff;
665 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
666 long val = *ucontrol->value.integer.value;
667 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
668 AC_VERB_GET_GPIO_DATA,
671 /* Set/unset the masked GPIO bit(s) as needed */
672 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
677 snd_hda_codec_write_cache(codec, nid, 0,
678 AC_VERB_SET_GPIO_DATA, gpio_data);
682 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
683 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
684 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
685 .info = alc_gpio_data_info, \
686 .get = alc_gpio_data_get, \
687 .put = alc_gpio_data_put, \
688 .private_value = nid | (mask<<16) }
689 #endif /* CONFIG_SND_DEBUG */
691 /* A switch control to allow the enabling of the digital IO pins on the
692 * ALC260. This is incredibly simplistic; the intention of this control is
693 * to provide something in the test model allowing digital outputs to be
694 * identified if present. If models are found which can utilise these
695 * outputs a more complete mixer control can be devised for those models if
698 #ifdef CONFIG_SND_DEBUG
699 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
701 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
702 struct snd_ctl_elem_value *ucontrol)
704 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
705 hda_nid_t nid = kcontrol->private_value & 0xffff;
706 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
707 long *valp = ucontrol->value.integer.value;
708 unsigned int val = snd_hda_codec_read(codec, nid, 0,
709 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
711 *valp = (val & mask) != 0;
714 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
715 struct snd_ctl_elem_value *ucontrol)
718 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
719 hda_nid_t nid = kcontrol->private_value & 0xffff;
720 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
721 long val = *ucontrol->value.integer.value;
722 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
723 AC_VERB_GET_DIGI_CONVERT_1,
726 /* Set/unset the masked control bit(s) as needed */
727 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
732 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
737 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
738 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
739 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
740 .info = alc_spdif_ctrl_info, \
741 .get = alc_spdif_ctrl_get, \
742 .put = alc_spdif_ctrl_put, \
743 .private_value = nid | (mask<<16) }
744 #endif /* CONFIG_SND_DEBUG */
746 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
747 * Again, this is only used in the ALC26x test models to help identify when
748 * the EAPD line must be asserted for features to work.
750 #ifdef CONFIG_SND_DEBUG
751 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
753 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
754 struct snd_ctl_elem_value *ucontrol)
756 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
757 hda_nid_t nid = kcontrol->private_value & 0xffff;
758 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
759 long *valp = ucontrol->value.integer.value;
760 unsigned int val = snd_hda_codec_read(codec, nid, 0,
761 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
763 *valp = (val & mask) != 0;
767 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
768 struct snd_ctl_elem_value *ucontrol)
771 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
772 hda_nid_t nid = kcontrol->private_value & 0xffff;
773 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
774 long val = *ucontrol->value.integer.value;
775 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
776 AC_VERB_GET_EAPD_BTLENABLE,
779 /* Set/unset the masked control bit(s) as needed */
780 change = (!val ? 0 : mask) != (ctrl_data & mask);
785 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
791 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
792 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
793 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
794 .info = alc_eapd_ctrl_info, \
795 .get = alc_eapd_ctrl_get, \
796 .put = alc_eapd_ctrl_put, \
797 .private_value = nid | (mask<<16) }
798 #endif /* CONFIG_SND_DEBUG */
801 * set up the input pin config (depending on the given auto-pin type)
803 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
806 unsigned int val = PIN_IN;
808 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
810 pincap = snd_hda_query_pin_caps(codec, nid);
811 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
812 if (pincap & AC_PINCAP_VREF_80)
814 else if (pincap & AC_PINCAP_VREF_50)
816 else if (pincap & AC_PINCAP_VREF_100)
818 else if (pincap & AC_PINCAP_VREF_GRD)
821 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
826 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
828 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
830 spec->mixers[spec->num_mixers++] = mix;
833 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
835 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
837 spec->init_verbs[spec->num_init_verbs++] = verb;
840 #ifdef CONFIG_PROC_FS
844 static void print_realtek_coef(struct snd_info_buffer *buffer,
845 struct hda_codec *codec, hda_nid_t nid)
851 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
852 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
853 coeff = snd_hda_codec_read(codec, nid, 0,
854 AC_VERB_GET_COEF_INDEX, 0);
855 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
858 #define print_realtek_coef NULL
862 * set up from the preset table
864 static void setup_preset(struct hda_codec *codec,
865 const struct alc_config_preset *preset)
867 struct alc_spec *spec = codec->spec;
870 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
871 add_mixer(spec, preset->mixers[i]);
872 spec->cap_mixer = preset->cap_mixer;
873 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
875 add_verb(spec, preset->init_verbs[i]);
877 spec->channel_mode = preset->channel_mode;
878 spec->num_channel_mode = preset->num_channel_mode;
879 spec->need_dac_fix = preset->need_dac_fix;
880 spec->const_channel_count = preset->const_channel_count;
882 if (preset->const_channel_count)
883 spec->multiout.max_channels = preset->const_channel_count;
885 spec->multiout.max_channels = spec->channel_mode[0].channels;
886 spec->ext_channel_count = spec->channel_mode[0].channels;
888 spec->multiout.num_dacs = preset->num_dacs;
889 spec->multiout.dac_nids = preset->dac_nids;
890 spec->multiout.dig_out_nid = preset->dig_out_nid;
891 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
892 spec->multiout.hp_nid = preset->hp_nid;
894 spec->num_mux_defs = preset->num_mux_defs;
895 if (!spec->num_mux_defs)
896 spec->num_mux_defs = 1;
897 spec->input_mux = preset->input_mux;
899 spec->num_adc_nids = preset->num_adc_nids;
900 spec->adc_nids = preset->adc_nids;
901 spec->capsrc_nids = preset->capsrc_nids;
902 spec->dig_in_nid = preset->dig_in_nid;
904 spec->unsol_event = preset->unsol_event;
905 spec->init_hook = preset->init_hook;
906 #ifdef CONFIG_SND_HDA_POWER_SAVE
907 spec->loopback.amplist = preset->loopbacks;
911 preset->setup(codec);
914 /* Enable GPIO mask and set output */
915 static struct hda_verb alc_gpio1_init_verbs[] = {
916 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
917 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
918 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
922 static struct hda_verb alc_gpio2_init_verbs[] = {
923 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
924 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
925 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
929 static struct hda_verb alc_gpio3_init_verbs[] = {
930 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
931 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
932 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
937 * Fix hardware PLL issue
938 * On some codecs, the analog PLL gating control must be off while
939 * the default value is 1.
941 static void alc_fix_pll(struct hda_codec *codec)
943 struct alc_spec *spec = codec->spec;
948 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
950 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
951 AC_VERB_GET_PROC_COEF, 0);
952 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
954 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
955 val & ~(1 << spec->pll_coef_bit));
958 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
959 unsigned int coef_idx, unsigned int coef_bit)
961 struct alc_spec *spec = codec->spec;
963 spec->pll_coef_idx = coef_idx;
964 spec->pll_coef_bit = coef_bit;
968 static void alc_automute_pin(struct hda_codec *codec)
970 struct alc_spec *spec = codec->spec;
971 unsigned int nid = spec->autocfg.hp_pins[0];
976 spec->jack_present = snd_hda_jack_detect(codec, nid);
977 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
978 nid = spec->autocfg.speaker_pins[i];
981 snd_hda_codec_write(codec, nid, 0,
982 AC_VERB_SET_PIN_WIDGET_CONTROL,
983 spec->jack_present ? 0 : PIN_OUT);
987 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
990 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
993 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
994 for (i = 0; i < nums; i++)
1000 static void alc_mic_automute(struct hda_codec *codec)
1002 struct alc_spec *spec = codec->spec;
1003 struct alc_mic_route *dead, *alive;
1004 unsigned int present, type;
1007 if (!spec->auto_mic)
1009 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1011 if (snd_BUG_ON(!spec->adc_nids))
1014 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1016 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1018 alive = &spec->ext_mic;
1019 dead = &spec->int_mic;
1021 alive = &spec->int_mic;
1022 dead = &spec->ext_mic;
1025 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1026 if (type == AC_WID_AUD_MIX) {
1027 /* Matrix-mixer style (e.g. ALC882) */
1028 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1031 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1033 HDA_AMP_MUTE, HDA_AMP_MUTE);
1035 /* MUX style (e.g. ALC880) */
1036 snd_hda_codec_write_cache(codec, cap_nid, 0,
1037 AC_VERB_SET_CONNECT_SEL,
1041 /* FIXME: analog mixer */
1044 /* unsolicited event for HP jack sensing */
1045 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1047 if (codec->vendor_id == 0x10ec0880)
1052 case ALC880_HP_EVENT:
1053 alc_automute_pin(codec);
1055 case ALC880_MIC_EVENT:
1056 alc_mic_automute(codec);
1061 static void alc_inithook(struct hda_codec *codec)
1063 alc_automute_pin(codec);
1064 alc_mic_automute(codec);
1067 /* additional initialization for ALC888 variants */
1068 static void alc888_coef_init(struct hda_codec *codec)
1072 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1073 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1074 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1075 if ((tmp & 0xf0) == 0x20)
1077 snd_hda_codec_read(codec, 0x20, 0,
1078 AC_VERB_SET_PROC_COEF, 0x830);
1081 snd_hda_codec_read(codec, 0x20, 0,
1082 AC_VERB_SET_PROC_COEF, 0x3030);
1085 static void alc889_coef_init(struct hda_codec *codec)
1089 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1090 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1091 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1092 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1095 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1100 case ALC_INIT_GPIO1:
1101 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1103 case ALC_INIT_GPIO2:
1104 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1106 case ALC_INIT_GPIO3:
1107 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1109 case ALC_INIT_DEFAULT:
1110 switch (codec->vendor_id) {
1112 snd_hda_codec_write(codec, 0x0f, 0,
1113 AC_VERB_SET_EAPD_BTLENABLE, 2);
1114 snd_hda_codec_write(codec, 0x10, 0,
1115 AC_VERB_SET_EAPD_BTLENABLE, 2);
1127 snd_hda_codec_write(codec, 0x14, 0,
1128 AC_VERB_SET_EAPD_BTLENABLE, 2);
1129 snd_hda_codec_write(codec, 0x15, 0,
1130 AC_VERB_SET_EAPD_BTLENABLE, 2);
1133 switch (codec->vendor_id) {
1135 snd_hda_codec_write(codec, 0x1a, 0,
1136 AC_VERB_SET_COEF_INDEX, 7);
1137 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1138 AC_VERB_GET_PROC_COEF, 0);
1139 snd_hda_codec_write(codec, 0x1a, 0,
1140 AC_VERB_SET_COEF_INDEX, 7);
1141 snd_hda_codec_write(codec, 0x1a, 0,
1142 AC_VERB_SET_PROC_COEF,
1152 alc889_coef_init(codec);
1155 alc888_coef_init(codec);
1159 snd_hda_codec_write(codec, 0x20, 0,
1160 AC_VERB_SET_COEF_INDEX, 7);
1161 tmp = snd_hda_codec_read(codec, 0x20, 0,
1162 AC_VERB_GET_PROC_COEF, 0);
1163 snd_hda_codec_write(codec, 0x20, 0,
1164 AC_VERB_SET_COEF_INDEX, 7);
1165 snd_hda_codec_write(codec, 0x20, 0,
1166 AC_VERB_SET_PROC_COEF,
1174 static void alc_init_auto_hp(struct hda_codec *codec)
1176 struct alc_spec *spec = codec->spec;
1178 if (!spec->autocfg.hp_pins[0])
1181 if (!spec->autocfg.speaker_pins[0]) {
1182 if (spec->autocfg.line_out_pins[0] &&
1183 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1184 spec->autocfg.speaker_pins[0] =
1185 spec->autocfg.line_out_pins[0];
1190 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1191 spec->autocfg.hp_pins[0]);
1192 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1193 AC_VERB_SET_UNSOLICITED_ENABLE,
1194 AC_USRSP_EN | ALC880_HP_EVENT);
1195 spec->unsol_event = alc_sku_unsol_event;
1198 static void alc_init_auto_mic(struct hda_codec *codec)
1200 struct alc_spec *spec = codec->spec;
1201 struct auto_pin_cfg *cfg = &spec->autocfg;
1202 hda_nid_t fixed, ext;
1205 /* there must be only two mic inputs exclusively */
1206 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1207 if (cfg->input_pins[i])
1211 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1212 hda_nid_t nid = cfg->input_pins[i];
1213 unsigned int defcfg;
1216 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1217 switch (get_defcfg_connect(defcfg)) {
1218 case AC_JACK_PORT_FIXED:
1220 return; /* already occupied */
1223 case AC_JACK_PORT_COMPLEX:
1225 return; /* already occupied */
1229 return; /* invalid entry */
1232 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1233 return; /* no unsol support */
1234 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1236 spec->ext_mic.pin = ext;
1237 spec->int_mic.pin = fixed;
1238 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1239 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1241 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1242 AC_VERB_SET_UNSOLICITED_ENABLE,
1243 AC_USRSP_EN | ALC880_MIC_EVENT);
1244 spec->unsol_event = alc_sku_unsol_event;
1247 /* check subsystem ID and set up device-specific initialization;
1248 * return 1 if initialized, 0 if invalid SSID
1250 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1251 * 31 ~ 16 : Manufacture ID
1253 * 7 ~ 0 : Assembly ID
1254 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1256 static int alc_subsystem_id(struct hda_codec *codec,
1257 hda_nid_t porta, hda_nid_t porte,
1260 unsigned int ass, tmp, i;
1262 struct alc_spec *spec = codec->spec;
1264 ass = codec->subsystem_id & 0xffff;
1265 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1268 /* invalid SSID, check the special NID pin defcfg instead */
1270 * 31~30 : port connectivity
1273 * 19~16 : Check sum (15:1)
1278 if (codec->vendor_id == 0x10ec0260)
1280 ass = snd_hda_codec_get_pincfg(codec, nid);
1281 snd_printd("realtek: No valid SSID, "
1282 "checking pincfg 0x%08x for NID 0x%x\n",
1284 if (!(ass & 1) && !(ass & 0x100000))
1286 if ((ass >> 30) != 1) /* no physical connection */
1291 for (i = 1; i < 16; i++) {
1295 if (((ass >> 16) & 0xf) != tmp)
1298 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1299 ass & 0xffff, codec->vendor_id);
1303 * 2 : 0 --> Desktop, 1 --> Laptop
1304 * 3~5 : External Amplifier control
1307 tmp = (ass & 0x38) >> 3; /* external Amp control */
1310 spec->init_amp = ALC_INIT_GPIO1;
1313 spec->init_amp = ALC_INIT_GPIO2;
1316 spec->init_amp = ALC_INIT_GPIO3;
1319 spec->init_amp = ALC_INIT_DEFAULT;
1323 /* is laptop or Desktop and enable the function "Mute internal speaker
1324 * when the external headphone out jack is plugged"
1326 if (!(ass & 0x8000))
1329 * 10~8 : Jack location
1330 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1332 * 15 : 1 --> enable the function "Mute internal speaker
1333 * when the external headphone out jack is plugged"
1335 if (!spec->autocfg.hp_pins[0]) {
1337 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1346 for (i = 0; i < spec->autocfg.line_outs; i++)
1347 if (spec->autocfg.line_out_pins[i] == nid)
1349 spec->autocfg.hp_pins[0] = nid;
1352 alc_init_auto_hp(codec);
1353 alc_init_auto_mic(codec);
1357 static void alc_ssid_check(struct hda_codec *codec,
1358 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1360 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1361 struct alc_spec *spec = codec->spec;
1362 snd_printd("realtek: "
1363 "Enable default setup for auto mode as fallback\n");
1364 spec->init_amp = ALC_INIT_DEFAULT;
1365 alc_init_auto_hp(codec);
1366 alc_init_auto_mic(codec);
1371 * Fix-up pin default configurations and add default verbs
1380 const struct alc_pincfg *pins;
1381 const struct hda_verb *verbs;
1384 static void alc_pick_fixup(struct hda_codec *codec,
1385 const struct snd_pci_quirk *quirk,
1386 const struct alc_fixup *fix)
1388 const struct alc_pincfg *cfg;
1390 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1394 fix += quirk->value;
1397 for (; cfg->nid; cfg++)
1398 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1401 add_verb(codec->spec, fix->verbs);
1404 static int alc_read_coef_idx(struct hda_codec *codec,
1405 unsigned int coef_idx)
1408 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1410 val = snd_hda_codec_read(codec, 0x20, 0,
1411 AC_VERB_GET_PROC_COEF, 0);
1422 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1423 /* Mic-in jack as mic in */
1424 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1425 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1426 /* Line-in jack as Line in */
1427 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1428 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1429 /* Line-Out as Front */
1430 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1437 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1438 /* Mic-in jack as mic in */
1439 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1440 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1441 /* Line-in jack as Surround */
1442 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1443 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1444 /* Line-Out as Front */
1445 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1452 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1453 /* Mic-in jack as CLFE */
1454 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1455 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1456 /* Line-in jack as Surround */
1457 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1458 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1459 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1460 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1467 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1468 /* Mic-in jack as CLFE */
1469 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1470 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1471 /* Line-in jack as Surround */
1472 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1473 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1474 /* Line-Out as Side */
1475 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1479 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1480 { 2, alc888_4ST_ch2_intel_init },
1481 { 4, alc888_4ST_ch4_intel_init },
1482 { 6, alc888_4ST_ch6_intel_init },
1483 { 8, alc888_4ST_ch8_intel_init },
1487 * ALC888 Fujitsu Siemens Amillo xa3530
1490 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1491 /* Front Mic: set to PIN_IN (empty by default) */
1492 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1493 /* Connect Internal HP to Front */
1494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1495 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1496 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1497 /* Connect Bass HP to Front */
1498 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1499 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1500 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1501 /* Connect Line-Out side jack (SPDIF) to Side */
1502 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1503 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1504 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1505 /* Connect Mic jack to CLFE */
1506 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1507 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1508 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1509 /* Connect Line-in jack to Surround */
1510 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1511 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1512 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1513 /* Connect HP out jack to Front */
1514 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1515 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1516 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1517 /* Enable unsolicited event for HP jack and Line-out jack */
1518 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1519 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1523 static void alc_automute_amp(struct hda_codec *codec)
1525 struct alc_spec *spec = codec->spec;
1530 spec->jack_present = 0;
1531 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1532 nid = spec->autocfg.hp_pins[i];
1535 if (snd_hda_jack_detect(codec, nid)) {
1536 spec->jack_present = 1;
1541 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1542 /* Toggle internal speakers muting */
1543 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1544 nid = spec->autocfg.speaker_pins[i];
1547 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1548 HDA_AMP_MUTE, mute);
1552 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1555 if (codec->vendor_id == 0x10ec0880)
1559 if (res == ALC880_HP_EVENT)
1560 alc_automute_amp(codec);
1563 static void alc889_automute_setup(struct hda_codec *codec)
1565 struct alc_spec *spec = codec->spec;
1567 spec->autocfg.hp_pins[0] = 0x15;
1568 spec->autocfg.speaker_pins[0] = 0x14;
1569 spec->autocfg.speaker_pins[1] = 0x16;
1570 spec->autocfg.speaker_pins[2] = 0x17;
1571 spec->autocfg.speaker_pins[3] = 0x19;
1572 spec->autocfg.speaker_pins[4] = 0x1a;
1575 static void alc889_intel_init_hook(struct hda_codec *codec)
1577 alc889_coef_init(codec);
1578 alc_automute_amp(codec);
1581 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1583 struct alc_spec *spec = codec->spec;
1585 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1586 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1587 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1588 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1592 * ALC888 Acer Aspire 4930G model
1595 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1596 /* Front Mic: set to PIN_IN (empty by default) */
1597 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1598 /* Unselect Front Mic by default in input mixer 3 */
1599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1600 /* Enable unsolicited event for HP jack */
1601 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1602 /* Connect Internal HP to front */
1603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1604 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1605 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1606 /* Connect HP out to front */
1607 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1608 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1614 * ALC888 Acer Aspire 6530G model
1617 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1618 /* Bias voltage on for external mic port */
1619 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1620 /* Front Mic: set to PIN_IN (empty by default) */
1621 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1622 /* Unselect Front Mic by default in input mixer 3 */
1623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1624 /* Enable unsolicited event for HP jack */
1625 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1626 /* Enable speaker output */
1627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1628 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1629 /* Enable headphone output */
1630 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1631 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1632 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1637 * ALC889 Acer Aspire 8930G model
1640 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1641 /* Front Mic: set to PIN_IN (empty by default) */
1642 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1643 /* Unselect Front Mic by default in input mixer 3 */
1644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1645 /* Enable unsolicited event for HP jack */
1646 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1647 /* Connect Internal Front to Front */
1648 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1649 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1650 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1651 /* Connect Internal Rear to Rear */
1652 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1653 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1654 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1655 /* Connect Internal CLFE to CLFE */
1656 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1657 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1658 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1659 /* Connect HP out to Front */
1660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1662 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1663 /* Enable all DACs */
1664 /* DAC DISABLE/MUTE 1? */
1665 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1666 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1667 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1668 /* DAC DISABLE/MUTE 2? */
1669 /* some bit here disables the other DACs. Init=0x4900 */
1670 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1671 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1672 /* Enable amplifiers */
1673 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1674 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1676 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1677 * which makes the stereo useless. However, either the mic or the ALC889
1678 * makes the signal become a difference/sum signal instead of standard
1679 * stereo, which is annoying. So instead we flip this bit which makes the
1680 * codec replicate the sum signal to both channels, turning it into a
1683 /* DMIC_CONTROL? Init value = 0x0001 */
1684 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1685 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1689 static struct hda_input_mux alc888_2_capture_sources[2] = {
1690 /* Front mic only available on one ADC */
1697 { "Front Mic", 0xb },
1710 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1711 /* Interal mic only available on one ADC */
1718 { "Input Mix", 0xa },
1728 { "Input Mix", 0xa },
1733 static struct hda_input_mux alc889_capture_sources[3] = {
1734 /* Digital mic only available on first "ADC" */
1741 { "Front Mic", 0xb },
1742 { "Input Mix", 0xa },
1751 { "Input Mix", 0xa },
1760 { "Input Mix", 0xa },
1765 static struct snd_kcontrol_new alc888_base_mixer[] = {
1766 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1767 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1768 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1769 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1770 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1772 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1773 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1774 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1775 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1776 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1777 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1778 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1779 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1780 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1781 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1782 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1783 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1787 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1789 struct alc_spec *spec = codec->spec;
1791 spec->autocfg.hp_pins[0] = 0x15;
1792 spec->autocfg.speaker_pins[0] = 0x14;
1793 spec->autocfg.speaker_pins[1] = 0x16;
1794 spec->autocfg.speaker_pins[2] = 0x17;
1797 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1799 struct alc_spec *spec = codec->spec;
1801 spec->autocfg.hp_pins[0] = 0x15;
1802 spec->autocfg.speaker_pins[0] = 0x14;
1803 spec->autocfg.speaker_pins[1] = 0x16;
1804 spec->autocfg.speaker_pins[2] = 0x17;
1807 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1809 struct alc_spec *spec = codec->spec;
1811 spec->autocfg.hp_pins[0] = 0x15;
1812 spec->autocfg.speaker_pins[0] = 0x14;
1813 spec->autocfg.speaker_pins[1] = 0x16;
1814 spec->autocfg.speaker_pins[2] = 0x1b;
1818 * ALC880 3-stack model
1820 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1821 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1822 * F-Mic = 0x1b, HP = 0x19
1825 static hda_nid_t alc880_dac_nids[4] = {
1826 /* front, rear, clfe, rear_surr */
1827 0x02, 0x05, 0x04, 0x03
1830 static hda_nid_t alc880_adc_nids[3] = {
1835 /* The datasheet says the node 0x07 is connected from inputs,
1836 * but it shows zero connection in the real implementation on some devices.
1837 * Note: this is a 915GAV bug, fixed on 915GLV
1839 static hda_nid_t alc880_adc_nids_alt[2] = {
1844 #define ALC880_DIGOUT_NID 0x06
1845 #define ALC880_DIGIN_NID 0x0a
1847 static struct hda_input_mux alc880_capture_source = {
1851 { "Front Mic", 0x3 },
1857 /* channel source setting (2/6 channel selection for 3-stack) */
1859 static struct hda_verb alc880_threestack_ch2_init[] = {
1860 /* set line-in to input, mute it */
1861 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1862 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1863 /* set mic-in to input vref 80%, mute it */
1864 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1865 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1870 static struct hda_verb alc880_threestack_ch6_init[] = {
1871 /* set line-in to output, unmute it */
1872 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1873 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1874 /* set mic-in to output, unmute it */
1875 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1876 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1880 static struct hda_channel_mode alc880_threestack_modes[2] = {
1881 { 2, alc880_threestack_ch2_init },
1882 { 6, alc880_threestack_ch6_init },
1885 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1886 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1887 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1888 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1889 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1890 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1891 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1892 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1893 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1894 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1895 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1896 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1897 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1900 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1901 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1902 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1904 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1905 .name = "Channel Mode",
1906 .info = alc_ch_mode_info,
1907 .get = alc_ch_mode_get,
1908 .put = alc_ch_mode_put,
1913 /* capture mixer elements */
1914 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1915 struct snd_ctl_elem_info *uinfo)
1917 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1918 struct alc_spec *spec = codec->spec;
1921 mutex_lock(&codec->control_mutex);
1922 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1924 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1925 mutex_unlock(&codec->control_mutex);
1929 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1930 unsigned int size, unsigned int __user *tlv)
1932 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1933 struct alc_spec *spec = codec->spec;
1936 mutex_lock(&codec->control_mutex);
1937 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1939 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1940 mutex_unlock(&codec->control_mutex);
1944 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1945 struct snd_ctl_elem_value *ucontrol);
1947 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1948 struct snd_ctl_elem_value *ucontrol,
1951 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1952 struct alc_spec *spec = codec->spec;
1953 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1956 mutex_lock(&codec->control_mutex);
1957 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1959 err = func(kcontrol, ucontrol);
1960 mutex_unlock(&codec->control_mutex);
1964 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1965 struct snd_ctl_elem_value *ucontrol)
1967 return alc_cap_getput_caller(kcontrol, ucontrol,
1968 snd_hda_mixer_amp_volume_get);
1971 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1972 struct snd_ctl_elem_value *ucontrol)
1974 return alc_cap_getput_caller(kcontrol, ucontrol,
1975 snd_hda_mixer_amp_volume_put);
1978 /* capture mixer elements */
1979 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1981 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1982 struct snd_ctl_elem_value *ucontrol)
1984 return alc_cap_getput_caller(kcontrol, ucontrol,
1985 snd_hda_mixer_amp_switch_get);
1988 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1989 struct snd_ctl_elem_value *ucontrol)
1991 return alc_cap_getput_caller(kcontrol, ucontrol,
1992 snd_hda_mixer_amp_switch_put);
1995 #define _DEFINE_CAPMIX(num) \
1997 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1998 .name = "Capture Switch", \
1999 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2001 .info = alc_cap_sw_info, \
2002 .get = alc_cap_sw_get, \
2003 .put = alc_cap_sw_put, \
2006 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2007 .name = "Capture Volume", \
2008 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2009 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2010 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2012 .info = alc_cap_vol_info, \
2013 .get = alc_cap_vol_get, \
2014 .put = alc_cap_vol_put, \
2015 .tlv = { .c = alc_cap_vol_tlv }, \
2018 #define _DEFINE_CAPSRC(num) \
2020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2021 /* .name = "Capture Source", */ \
2022 .name = "Input Source", \
2024 .info = alc_mux_enum_info, \
2025 .get = alc_mux_enum_get, \
2026 .put = alc_mux_enum_put, \
2029 #define DEFINE_CAPMIX(num) \
2030 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2031 _DEFINE_CAPMIX(num), \
2032 _DEFINE_CAPSRC(num), \
2036 #define DEFINE_CAPMIX_NOSRC(num) \
2037 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2038 _DEFINE_CAPMIX(num), \
2042 /* up to three ADCs */
2046 DEFINE_CAPMIX_NOSRC(1);
2047 DEFINE_CAPMIX_NOSRC(2);
2048 DEFINE_CAPMIX_NOSRC(3);
2051 * ALC880 5-stack model
2053 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2055 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2056 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2059 /* additional mixers to alc880_three_stack_mixer */
2060 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2061 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2062 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2066 /* channel source setting (6/8 channel selection for 5-stack) */
2068 static struct hda_verb alc880_fivestack_ch6_init[] = {
2069 /* set line-in to input, mute it */
2070 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2071 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2076 static struct hda_verb alc880_fivestack_ch8_init[] = {
2077 /* set line-in to output, unmute it */
2078 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2079 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2083 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2084 { 6, alc880_fivestack_ch6_init },
2085 { 8, alc880_fivestack_ch8_init },
2090 * ALC880 6-stack model
2092 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2093 * Side = 0x05 (0x0f)
2094 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2095 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2098 static hda_nid_t alc880_6st_dac_nids[4] = {
2099 /* front, rear, clfe, rear_surr */
2100 0x02, 0x03, 0x04, 0x05
2103 static struct hda_input_mux alc880_6stack_capture_source = {
2107 { "Front Mic", 0x1 },
2113 /* fixed 8-channels */
2114 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2118 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2120 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2121 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2122 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2123 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2124 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2125 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2126 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2127 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2128 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2131 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2132 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2135 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2136 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2138 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2139 .name = "Channel Mode",
2140 .info = alc_ch_mode_info,
2141 .get = alc_ch_mode_get,
2142 .put = alc_ch_mode_put,
2151 * W810 has rear IO for:
2154 * Center/LFE (DAC 04)
2157 * The system also has a pair of internal speakers, and a headphone jack.
2158 * These are both connected to Line2 on the codec, hence to DAC 02.
2160 * There is a variable resistor to control the speaker or headphone
2161 * volume. This is a hardware-only device without a software API.
2163 * Plugging headphones in will disable the internal speakers. This is
2164 * implemented in hardware, not via the driver using jack sense. In
2165 * a similar fashion, plugging into the rear socket marked "front" will
2166 * disable both the speakers and headphones.
2168 * For input, there's a microphone jack, and an "audio in" jack.
2169 * These may not do anything useful with this driver yet, because I
2170 * haven't setup any initialization verbs for these yet...
2173 static hda_nid_t alc880_w810_dac_nids[3] = {
2174 /* front, rear/surround, clfe */
2178 /* fixed 6 channels */
2179 static struct hda_channel_mode alc880_w810_modes[1] = {
2183 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2184 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2185 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2186 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2187 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2188 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2189 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2190 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2191 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2192 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2193 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2201 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2202 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2206 static hda_nid_t alc880_z71v_dac_nids[1] = {
2209 #define ALC880_Z71V_HP_DAC 0x03
2211 /* fixed 2 channels */
2212 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2216 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2217 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2220 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2230 * ALC880 F1734 model
2232 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2233 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2236 static hda_nid_t alc880_f1734_dac_nids[1] = {
2239 #define ALC880_F1734_HP_DAC 0x02
2241 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2242 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2243 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2244 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2245 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2246 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2247 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2253 static struct hda_input_mux alc880_f1734_capture_source = {
2265 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2266 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2267 * Mic = 0x18, Line = 0x1a
2270 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2271 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2273 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2274 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2275 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2276 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2277 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2278 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2279 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2280 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2281 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2282 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2283 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2285 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2286 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2287 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2289 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2290 .name = "Channel Mode",
2291 .info = alc_ch_mode_info,
2292 .get = alc_ch_mode_get,
2293 .put = alc_ch_mode_put,
2299 * ALC880 ASUS W1V model
2301 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2302 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2303 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2306 /* additional mixers to alc880_asus_mixer */
2307 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2308 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2309 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2314 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2315 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2316 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2317 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2318 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2319 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2322 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2323 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2328 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2329 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2330 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2331 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2332 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2333 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2334 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2335 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2336 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2337 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2338 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2340 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2342 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2343 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2344 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2346 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2347 .name = "Channel Mode",
2348 .info = alc_ch_mode_info,
2349 .get = alc_ch_mode_get,
2350 .put = alc_ch_mode_put,
2355 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2356 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2357 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2358 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2359 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2360 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2361 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2362 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2363 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2364 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2365 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2369 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2370 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2371 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2372 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2373 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2380 * virtual master controls
2384 * slave controls for virtual master
2386 static const char *alc_slave_vols[] = {
2387 "Front Playback Volume",
2388 "Surround Playback Volume",
2389 "Center Playback Volume",
2390 "LFE Playback Volume",
2391 "Side Playback Volume",
2392 "Headphone Playback Volume",
2393 "Speaker Playback Volume",
2394 "Mono Playback Volume",
2395 "Line-Out Playback Volume",
2396 "PCM Playback Volume",
2400 static const char *alc_slave_sws[] = {
2401 "Front Playback Switch",
2402 "Surround Playback Switch",
2403 "Center Playback Switch",
2404 "LFE Playback Switch",
2405 "Side Playback Switch",
2406 "Headphone Playback Switch",
2407 "Speaker Playback Switch",
2408 "Mono Playback Switch",
2409 "IEC958 Playback Switch",
2410 "Line-Out Playback Switch",
2411 "PCM Playback Switch",
2416 * build control elements
2419 #define NID_MAPPING (-1)
2421 #define SUBDEV_SPEAKER_ (0 << 6)
2422 #define SUBDEV_HP_ (1 << 6)
2423 #define SUBDEV_LINE_ (2 << 6)
2424 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2425 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2426 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2428 static void alc_free_kctls(struct hda_codec *codec);
2430 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2431 /* additional beep mixers; the actual parameters are overwritten at build */
2432 static struct snd_kcontrol_new alc_beep_mixer[] = {
2433 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2434 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2439 static int alc_build_controls(struct hda_codec *codec)
2441 struct alc_spec *spec = codec->spec;
2442 struct snd_kcontrol *kctl;
2443 struct snd_kcontrol_new *knew;
2448 for (i = 0; i < spec->num_mixers; i++) {
2449 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2453 if (spec->cap_mixer) {
2454 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2458 if (spec->multiout.dig_out_nid) {
2459 err = snd_hda_create_spdif_out_ctls(codec,
2460 spec->multiout.dig_out_nid);
2463 if (!spec->no_analog) {
2464 err = snd_hda_create_spdif_share_sw(codec,
2468 spec->multiout.share_spdif = 1;
2471 if (spec->dig_in_nid) {
2472 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2477 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2478 /* create beep controls if needed */
2479 if (spec->beep_amp) {
2480 struct snd_kcontrol_new *knew;
2481 for (knew = alc_beep_mixer; knew->name; knew++) {
2482 struct snd_kcontrol *kctl;
2483 kctl = snd_ctl_new1(knew, codec);
2486 kctl->private_value = spec->beep_amp;
2487 err = snd_hda_ctl_add(codec, 0, kctl);
2494 /* if we have no master control, let's create it */
2495 if (!spec->no_analog &&
2496 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2497 unsigned int vmaster_tlv[4];
2498 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2499 HDA_OUTPUT, vmaster_tlv);
2500 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2501 vmaster_tlv, alc_slave_vols);
2505 if (!spec->no_analog &&
2506 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2507 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2508 NULL, alc_slave_sws);
2513 alc_free_kctls(codec); /* no longer needed */
2515 /* assign Capture Source enums to NID */
2516 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2518 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2519 for (i = 0; kctl && i < kctl->count; i++) {
2520 err = snd_hda_add_nids(codec, kctl, i, spec->capsrc_nids,
2521 spec->input_mux->num_items);
2525 if (spec->cap_mixer) {
2526 const char *kname = kctl ? kctl->id.name : NULL;
2527 for (knew = spec->cap_mixer; knew->name; knew++) {
2528 if (kname && strcmp(knew->name, kname) == 0)
2530 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2531 for (i = 0; kctl && i < kctl->count; i++) {
2532 err = snd_hda_add_nid(codec, kctl, i,
2540 /* other nid->control mapping */
2541 for (i = 0; i < spec->num_mixers; i++) {
2542 for (knew = spec->mixers[i]; knew->name; knew++) {
2543 if (knew->iface != NID_MAPPING)
2545 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2548 u = knew->subdevice;
2549 for (j = 0; j < 4; j++, u >>= 8) {
2554 case SUBDEV_SPEAKER_:
2555 nid = spec->autocfg.speaker_pins[nid];
2558 nid = spec->autocfg.line_out_pins[nid];
2561 nid = spec->autocfg.hp_pins[nid];
2566 err = snd_hda_add_nid(codec, kctl, 0, nid);
2570 u = knew->private_value;
2571 for (j = 0; j < 4; j++, u >>= 8) {
2575 err = snd_hda_add_nid(codec, kctl, 0, nid);
2586 * initialize the codec volumes, etc
2590 * generic initialization of ADC, input mixers and output mixers
2592 static struct hda_verb alc880_volume_init_verbs[] = {
2594 * Unmute ADC0-2 and set the default input to mic-in
2596 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2598 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2599 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2600 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2601 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2603 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2605 * Note: PASD motherboards uses the Line In 2 as the input for front
2608 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2618 * Set up output mixers (0x0c - 0x0f)
2620 /* set vol=0 to output mixers */
2621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2623 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2624 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2625 /* set up input amps for analog loopback */
2626 /* Amp Indices: DAC = 0, mixer = 1 */
2627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2630 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2633 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2634 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2640 * 3-stack pin configuration:
2641 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2643 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2645 * preset connection lists of input pins
2646 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2648 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2649 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2650 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2653 * Set pin mode and muting
2655 /* set front pin widgets 0x14 for output */
2656 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2658 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2659 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2660 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2661 /* Mic2 (as headphone out) for HP output */
2662 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2663 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2664 /* Line In pin widget for input */
2665 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2666 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2667 /* Line2 (as front mic) pin widget for input and vref at 80% */
2668 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2669 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2670 /* CD pin widget for input */
2671 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2677 * 5-stack pin configuration:
2678 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2679 * line-in/side = 0x1a, f-mic = 0x1b
2681 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2683 * preset connection lists of input pins
2684 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2686 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2687 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2690 * Set pin mode and muting
2692 /* set pin widgets 0x14-0x17 for output */
2693 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2695 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2696 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2697 /* unmute pins for output (no gain on this amp) */
2698 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2699 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2700 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2701 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2703 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2704 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2705 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2706 /* Mic2 (as headphone out) for HP output */
2707 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2708 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2709 /* Line In pin widget for input */
2710 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2711 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2712 /* Line2 (as front mic) pin widget for input and vref at 80% */
2713 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2714 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2715 /* CD pin widget for input */
2716 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2722 * W810 pin configuration:
2723 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2725 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2726 /* hphone/speaker input selector: front DAC */
2727 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2730 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2734 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2736 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2737 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2743 * Z71V pin configuration:
2744 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2746 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2748 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2753 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2754 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2755 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2761 * 6-stack pin configuration:
2762 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2763 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2765 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2766 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2768 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2770 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2771 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2772 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2773 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2774 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2775 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2777 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2778 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2779 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2780 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2781 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2782 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2783 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2784 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2785 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2791 * Uniwill pin configuration:
2792 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2795 static struct hda_verb alc880_uniwill_init_verbs[] = {
2796 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2798 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2799 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2802 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2803 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2804 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2805 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2811 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2813 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2814 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2815 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2816 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2817 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2818 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2819 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2820 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2821 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2823 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2824 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2831 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2833 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2834 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2836 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2837 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2838 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2840 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2841 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2845 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2849 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2850 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2851 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2852 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2853 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2856 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2857 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2862 static struct hda_verb alc880_beep_init_verbs[] = {
2863 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2867 /* auto-toggle front mic */
2868 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2870 unsigned int present;
2873 present = snd_hda_jack_detect(codec, 0x18);
2874 bits = present ? HDA_AMP_MUTE : 0;
2875 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2878 static void alc880_uniwill_setup(struct hda_codec *codec)
2880 struct alc_spec *spec = codec->spec;
2882 spec->autocfg.hp_pins[0] = 0x14;
2883 spec->autocfg.speaker_pins[0] = 0x15;
2884 spec->autocfg.speaker_pins[0] = 0x16;
2887 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2889 alc_automute_amp(codec);
2890 alc880_uniwill_mic_automute(codec);
2893 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2896 /* Looks like the unsol event is incompatible with the standard
2897 * definition. 4bit tag is placed at 28 bit!
2899 switch (res >> 28) {
2900 case ALC880_MIC_EVENT:
2901 alc880_uniwill_mic_automute(codec);
2904 alc_automute_amp_unsol_event(codec, res);
2909 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2911 struct alc_spec *spec = codec->spec;
2913 spec->autocfg.hp_pins[0] = 0x14;
2914 spec->autocfg.speaker_pins[0] = 0x15;
2917 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2919 unsigned int present;
2921 present = snd_hda_codec_read(codec, 0x21, 0,
2922 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2923 present &= HDA_AMP_VOLMASK;
2924 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2925 HDA_AMP_VOLMASK, present);
2926 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2927 HDA_AMP_VOLMASK, present);
2930 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2933 /* Looks like the unsol event is incompatible with the standard
2934 * definition. 4bit tag is placed at 28 bit!
2936 if ((res >> 28) == ALC880_DCVOL_EVENT)
2937 alc880_uniwill_p53_dcvol_automute(codec);
2939 alc_automute_amp_unsol_event(codec, res);
2943 * F1734 pin configuration:
2944 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2946 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2947 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2948 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2949 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2950 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2951 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2955 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2956 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2958 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2959 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2960 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2961 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2962 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2963 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2965 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2966 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2968 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2969 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2975 * ASUS pin configuration:
2976 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2978 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2979 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2980 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2981 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2982 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2985 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2987 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2988 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2989 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2990 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2991 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2993 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2994 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2995 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2996 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2997 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2998 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2999 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3000 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3001 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3006 /* Enable GPIO mask and set output */
3007 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3008 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3009 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3011 /* Clevo m520g init */
3012 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3013 /* headphone output */
3014 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3016 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3017 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3019 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3020 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3022 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3023 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3024 /* Mic1 (rear panel) */
3025 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3026 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3027 /* Mic2 (front panel) */
3028 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3029 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3031 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3032 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3033 /* change to EAPD mode */
3034 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3035 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3040 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3041 /* change to EAPD mode */
3042 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3043 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3045 /* Headphone output */
3046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3048 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3049 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3051 /* Line In pin widget for input */
3052 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3053 /* CD pin widget for input */
3054 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3055 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3056 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3058 /* change to EAPD mode */
3059 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3060 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3066 * LG m1 express dual
3069 * Rear Line-In/Out (blue): 0x14
3070 * Build-in Mic-In: 0x15
3072 * HP-Out (green): 0x1b
3073 * Mic-In/Out (red): 0x19
3077 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3078 static hda_nid_t alc880_lg_dac_nids[3] = {
3082 /* seems analog CD is not working */
3083 static struct hda_input_mux alc880_lg_capture_source = {
3088 { "Internal Mic", 0x6 },
3092 /* 2,4,6 channel modes */
3093 static struct hda_verb alc880_lg_ch2_init[] = {
3094 /* set line-in and mic-in to input */
3095 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3096 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3100 static struct hda_verb alc880_lg_ch4_init[] = {
3101 /* set line-in to out and mic-in to input */
3102 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3103 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3107 static struct hda_verb alc880_lg_ch6_init[] = {
3108 /* set line-in and mic-in to output */
3109 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3110 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3114 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3115 { 2, alc880_lg_ch2_init },
3116 { 4, alc880_lg_ch4_init },
3117 { 6, alc880_lg_ch6_init },
3120 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3121 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3122 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3123 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3124 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3125 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3126 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3127 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3128 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3131 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3132 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3133 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3134 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3137 .name = "Channel Mode",
3138 .info = alc_ch_mode_info,
3139 .get = alc_ch_mode_get,
3140 .put = alc_ch_mode_put,
3145 static struct hda_verb alc880_lg_init_verbs[] = {
3146 /* set capture source to mic-in */
3147 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3148 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3149 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3150 /* mute all amp mixer inputs */
3151 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3153 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3154 /* line-in to input */
3155 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3156 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3158 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3159 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3161 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3162 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3163 /* mic-in to input */
3164 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3165 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3166 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3168 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3169 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3170 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3172 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3176 /* toggle speaker-output according to the hp-jack state */
3177 static void alc880_lg_setup(struct hda_codec *codec)
3179 struct alc_spec *spec = codec->spec;
3181 spec->autocfg.hp_pins[0] = 0x1b;
3182 spec->autocfg.speaker_pins[0] = 0x17;
3191 * Built-in Mic-In: 0x19
3197 static struct hda_input_mux alc880_lg_lw_capture_source = {
3201 { "Internal Mic", 0x1 },
3206 #define alc880_lg_lw_modes alc880_threestack_modes
3208 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3209 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3210 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3211 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3212 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3213 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3214 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3215 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3216 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3221 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3222 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3224 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3225 .name = "Channel Mode",
3226 .info = alc_ch_mode_info,
3227 .get = alc_ch_mode_get,
3228 .put = alc_ch_mode_put,
3233 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3234 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3235 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3236 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3238 /* set capture source to mic-in */
3239 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3241 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3242 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3244 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3245 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3247 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3248 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3249 /* mic-in to input */
3250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3253 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3254 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3256 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3260 /* toggle speaker-output according to the hp-jack state */
3261 static void alc880_lg_lw_setup(struct hda_codec *codec)
3263 struct alc_spec *spec = codec->spec;
3265 spec->autocfg.hp_pins[0] = 0x1b;
3266 spec->autocfg.speaker_pins[0] = 0x14;
3269 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3270 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3271 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3274 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3275 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3279 static struct hda_input_mux alc880_medion_rim_capture_source = {
3283 { "Internal Mic", 0x1 },
3287 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3288 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3290 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3291 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3293 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3294 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3295 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3296 /* Mic2 (as headphone out) for HP output */
3297 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3298 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3299 /* Internal Speaker */
3300 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3301 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3303 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3304 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3306 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3310 /* toggle speaker-output according to the hp-jack state */
3311 static void alc880_medion_rim_automute(struct hda_codec *codec)
3313 struct alc_spec *spec = codec->spec;
3314 alc_automute_amp(codec);
3316 if (spec->jack_present)
3317 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3319 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3322 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3325 /* Looks like the unsol event is incompatible with the standard
3326 * definition. 4bit tag is placed at 28 bit!
3328 if ((res >> 28) == ALC880_HP_EVENT)
3329 alc880_medion_rim_automute(codec);
3332 static void alc880_medion_rim_setup(struct hda_codec *codec)
3334 struct alc_spec *spec = codec->spec;
3336 spec->autocfg.hp_pins[0] = 0x14;
3337 spec->autocfg.speaker_pins[0] = 0x1b;
3340 #ifdef CONFIG_SND_HDA_POWER_SAVE
3341 static struct hda_amp_list alc880_loopbacks[] = {
3342 { 0x0b, HDA_INPUT, 0 },
3343 { 0x0b, HDA_INPUT, 1 },
3344 { 0x0b, HDA_INPUT, 2 },
3345 { 0x0b, HDA_INPUT, 3 },
3346 { 0x0b, HDA_INPUT, 4 },
3350 static struct hda_amp_list alc880_lg_loopbacks[] = {
3351 { 0x0b, HDA_INPUT, 1 },
3352 { 0x0b, HDA_INPUT, 6 },
3353 { 0x0b, HDA_INPUT, 7 },
3362 static int alc_init(struct hda_codec *codec)
3364 struct alc_spec *spec = codec->spec;
3368 alc_auto_init_amp(codec, spec->init_amp);
3370 for (i = 0; i < spec->num_init_verbs; i++)
3371 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3373 if (spec->init_hook)
3374 spec->init_hook(codec);
3379 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3381 struct alc_spec *spec = codec->spec;
3383 if (spec->unsol_event)
3384 spec->unsol_event(codec, res);
3387 #ifdef CONFIG_SND_HDA_POWER_SAVE
3388 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3390 struct alc_spec *spec = codec->spec;
3391 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3396 * Analog playback callbacks
3398 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3399 struct hda_codec *codec,
3400 struct snd_pcm_substream *substream)
3402 struct alc_spec *spec = codec->spec;
3403 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3407 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3408 struct hda_codec *codec,
3409 unsigned int stream_tag,
3410 unsigned int format,
3411 struct snd_pcm_substream *substream)
3413 struct alc_spec *spec = codec->spec;
3414 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3415 stream_tag, format, substream);
3418 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3419 struct hda_codec *codec,
3420 struct snd_pcm_substream *substream)
3422 struct alc_spec *spec = codec->spec;
3423 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3429 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3430 struct hda_codec *codec,
3431 struct snd_pcm_substream *substream)
3433 struct alc_spec *spec = codec->spec;
3434 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3437 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3438 struct hda_codec *codec,
3439 unsigned int stream_tag,
3440 unsigned int format,
3441 struct snd_pcm_substream *substream)
3443 struct alc_spec *spec = codec->spec;
3444 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3445 stream_tag, format, substream);
3448 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3449 struct hda_codec *codec,
3450 struct snd_pcm_substream *substream)
3452 struct alc_spec *spec = codec->spec;
3453 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3456 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3457 struct hda_codec *codec,
3458 struct snd_pcm_substream *substream)
3460 struct alc_spec *spec = codec->spec;
3461 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3467 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3468 struct hda_codec *codec,
3469 unsigned int stream_tag,
3470 unsigned int format,
3471 struct snd_pcm_substream *substream)
3473 struct alc_spec *spec = codec->spec;
3475 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3476 stream_tag, 0, format);
3480 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3481 struct hda_codec *codec,
3482 struct snd_pcm_substream *substream)
3484 struct alc_spec *spec = codec->spec;
3486 snd_hda_codec_cleanup_stream(codec,
3487 spec->adc_nids[substream->number + 1]);
3494 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3498 /* NID is set in alc_build_pcms */
3500 .open = alc880_playback_pcm_open,
3501 .prepare = alc880_playback_pcm_prepare,
3502 .cleanup = alc880_playback_pcm_cleanup
3506 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3510 /* NID is set in alc_build_pcms */
3513 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3517 /* NID is set in alc_build_pcms */
3520 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3521 .substreams = 2, /* can be overridden */
3524 /* NID is set in alc_build_pcms */
3526 .prepare = alc880_alt_capture_pcm_prepare,
3527 .cleanup = alc880_alt_capture_pcm_cleanup
3531 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3535 /* NID is set in alc_build_pcms */
3537 .open = alc880_dig_playback_pcm_open,
3538 .close = alc880_dig_playback_pcm_close,
3539 .prepare = alc880_dig_playback_pcm_prepare,
3540 .cleanup = alc880_dig_playback_pcm_cleanup
3544 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3548 /* NID is set in alc_build_pcms */
3551 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3552 static struct hda_pcm_stream alc_pcm_null_stream = {
3558 static int alc_build_pcms(struct hda_codec *codec)
3560 struct alc_spec *spec = codec->spec;
3561 struct hda_pcm *info = spec->pcm_rec;
3564 codec->num_pcms = 1;
3565 codec->pcm_info = info;
3567 if (spec->no_analog)
3570 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3571 "%s Analog", codec->chip_name);
3572 info->name = spec->stream_name_analog;
3574 if (spec->stream_analog_playback) {
3575 if (snd_BUG_ON(!spec->multiout.dac_nids))
3577 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3578 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3580 if (spec->stream_analog_capture) {
3581 if (snd_BUG_ON(!spec->adc_nids))
3583 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3584 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3587 if (spec->channel_mode) {
3588 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3589 for (i = 0; i < spec->num_channel_mode; i++) {
3590 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3591 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3597 /* SPDIF for stream index #1 */
3598 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3599 snprintf(spec->stream_name_digital,
3600 sizeof(spec->stream_name_digital),
3601 "%s Digital", codec->chip_name);
3602 codec->num_pcms = 2;
3603 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3604 info = spec->pcm_rec + 1;
3605 info->name = spec->stream_name_digital;
3606 if (spec->dig_out_type)
3607 info->pcm_type = spec->dig_out_type;
3609 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3610 if (spec->multiout.dig_out_nid &&
3611 spec->stream_digital_playback) {
3612 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3613 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3615 if (spec->dig_in_nid &&
3616 spec->stream_digital_capture) {
3617 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3618 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3620 /* FIXME: do we need this for all Realtek codec models? */
3621 codec->spdif_status_reset = 1;
3624 if (spec->no_analog)
3627 /* If the use of more than one ADC is requested for the current
3628 * model, configure a second analog capture-only PCM.
3630 /* Additional Analaog capture for index #2 */
3631 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3632 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3633 codec->num_pcms = 3;
3634 info = spec->pcm_rec + 2;
3635 info->name = spec->stream_name_analog;
3636 if (spec->alt_dac_nid) {
3637 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3638 *spec->stream_analog_alt_playback;
3639 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3642 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3643 alc_pcm_null_stream;
3644 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3646 if (spec->num_adc_nids > 1) {
3647 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3648 *spec->stream_analog_alt_capture;
3649 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3651 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3652 spec->num_adc_nids - 1;
3654 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3655 alc_pcm_null_stream;
3656 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3663 static void alc_free_kctls(struct hda_codec *codec)
3665 struct alc_spec *spec = codec->spec;
3667 if (spec->kctls.list) {
3668 struct snd_kcontrol_new *kctl = spec->kctls.list;
3670 for (i = 0; i < spec->kctls.used; i++)
3671 kfree(kctl[i].name);
3673 snd_array_free(&spec->kctls);
3676 static void alc_free(struct hda_codec *codec)
3678 struct alc_spec *spec = codec->spec;
3683 alc_free_kctls(codec);
3685 snd_hda_detach_beep_device(codec);
3688 #ifdef SND_HDA_NEEDS_RESUME
3689 static int alc_resume(struct hda_codec *codec)
3691 codec->patch_ops.init(codec);
3692 snd_hda_codec_resume_amp(codec);
3693 snd_hda_codec_resume_cache(codec);
3700 static struct hda_codec_ops alc_patch_ops = {
3701 .build_controls = alc_build_controls,
3702 .build_pcms = alc_build_pcms,
3705 .unsol_event = alc_unsol_event,
3706 #ifdef SND_HDA_NEEDS_RESUME
3707 .resume = alc_resume,
3709 #ifdef CONFIG_SND_HDA_POWER_SAVE
3710 .check_power_status = alc_check_power_status,
3716 * Test configuration for debugging
3718 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3721 #ifdef CONFIG_SND_DEBUG
3722 static hda_nid_t alc880_test_dac_nids[4] = {
3723 0x02, 0x03, 0x04, 0x05
3726 static struct hda_input_mux alc880_test_capture_source = {
3735 { "Surround", 0x6 },
3739 static struct hda_channel_mode alc880_test_modes[4] = {
3746 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3747 struct snd_ctl_elem_info *uinfo)
3749 static char *texts[] = {
3750 "N/A", "Line Out", "HP Out",
3751 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3753 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3755 uinfo->value.enumerated.items = 8;
3756 if (uinfo->value.enumerated.item >= 8)
3757 uinfo->value.enumerated.item = 7;
3758 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3762 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3763 struct snd_ctl_elem_value *ucontrol)
3765 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3766 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3767 unsigned int pin_ctl, item = 0;
3769 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3770 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3771 if (pin_ctl & AC_PINCTL_OUT_EN) {
3772 if (pin_ctl & AC_PINCTL_HP_EN)
3776 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3777 switch (pin_ctl & AC_PINCTL_VREFEN) {
3778 case AC_PINCTL_VREF_HIZ: item = 3; break;
3779 case AC_PINCTL_VREF_50: item = 4; break;
3780 case AC_PINCTL_VREF_GRD: item = 5; break;
3781 case AC_PINCTL_VREF_80: item = 6; break;
3782 case AC_PINCTL_VREF_100: item = 7; break;
3785 ucontrol->value.enumerated.item[0] = item;
3789 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3790 struct snd_ctl_elem_value *ucontrol)
3792 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3793 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3794 static unsigned int ctls[] = {
3795 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3796 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3797 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3798 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3799 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3800 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3802 unsigned int old_ctl, new_ctl;
3804 old_ctl = snd_hda_codec_read(codec, nid, 0,
3805 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3806 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3807 if (old_ctl != new_ctl) {
3809 snd_hda_codec_write_cache(codec, nid, 0,
3810 AC_VERB_SET_PIN_WIDGET_CONTROL,
3812 val = ucontrol->value.enumerated.item[0] >= 3 ?
3814 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3821 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3822 struct snd_ctl_elem_info *uinfo)
3824 static char *texts[] = {
3825 "Front", "Surround", "CLFE", "Side"
3827 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3829 uinfo->value.enumerated.items = 4;
3830 if (uinfo->value.enumerated.item >= 4)
3831 uinfo->value.enumerated.item = 3;
3832 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3836 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3837 struct snd_ctl_elem_value *ucontrol)
3839 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3840 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3843 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3844 ucontrol->value.enumerated.item[0] = sel & 3;
3848 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3849 struct snd_ctl_elem_value *ucontrol)
3851 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3852 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3855 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3856 if (ucontrol->value.enumerated.item[0] != sel) {
3857 sel = ucontrol->value.enumerated.item[0] & 3;
3858 snd_hda_codec_write_cache(codec, nid, 0,
3859 AC_VERB_SET_CONNECT_SEL, sel);
3865 #define PIN_CTL_TEST(xname,nid) { \
3866 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3868 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3869 .info = alc_test_pin_ctl_info, \
3870 .get = alc_test_pin_ctl_get, \
3871 .put = alc_test_pin_ctl_put, \
3872 .private_value = nid \
3875 #define PIN_SRC_TEST(xname,nid) { \
3876 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3878 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3879 .info = alc_test_pin_src_info, \
3880 .get = alc_test_pin_src_get, \
3881 .put = alc_test_pin_src_put, \
3882 .private_value = nid \
3885 static struct snd_kcontrol_new alc880_test_mixer[] = {
3886 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3887 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3888 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3889 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3890 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3891 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3892 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3893 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3894 PIN_CTL_TEST("Front Pin Mode", 0x14),
3895 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3896 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3897 PIN_CTL_TEST("Side Pin Mode", 0x17),
3898 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3899 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3900 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3901 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3902 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3903 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3904 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3905 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3906 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3907 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3908 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3909 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3910 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3911 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3912 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3913 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3914 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3915 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3918 .name = "Channel Mode",
3919 .info = alc_ch_mode_info,
3920 .get = alc_ch_mode_get,
3921 .put = alc_ch_mode_put,
3926 static struct hda_verb alc880_test_init_verbs[] = {
3927 /* Unmute inputs of 0x0c - 0x0f */
3928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3930 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3931 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3932 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3933 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3934 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3935 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3936 /* Vol output for 0x0c-0x0f */
3937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3938 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3939 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3940 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3941 /* Set output pins 0x14-0x17 */
3942 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3943 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3944 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3945 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3946 /* Unmute output pins 0x14-0x17 */
3947 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3948 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3949 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3950 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3951 /* Set input pins 0x18-0x1c */
3952 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3953 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3954 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3955 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3956 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3957 /* Mute input pins 0x18-0x1b */
3958 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3959 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3960 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3961 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3963 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3964 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3965 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3966 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3967 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3968 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3969 /* Analog input/passthru */
3970 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3971 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3972 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3982 static const char *alc880_models[ALC880_MODEL_LAST] = {
3983 [ALC880_3ST] = "3stack",
3984 [ALC880_TCL_S700] = "tcl",
3985 [ALC880_3ST_DIG] = "3stack-digout",
3986 [ALC880_CLEVO] = "clevo",
3987 [ALC880_5ST] = "5stack",
3988 [ALC880_5ST_DIG] = "5stack-digout",
3989 [ALC880_W810] = "w810",
3990 [ALC880_Z71V] = "z71v",
3991 [ALC880_6ST] = "6stack",
3992 [ALC880_6ST_DIG] = "6stack-digout",
3993 [ALC880_ASUS] = "asus",
3994 [ALC880_ASUS_W1V] = "asus-w1v",
3995 [ALC880_ASUS_DIG] = "asus-dig",
3996 [ALC880_ASUS_DIG2] = "asus-dig2",
3997 [ALC880_UNIWILL_DIG] = "uniwill",
3998 [ALC880_UNIWILL_P53] = "uniwill-p53",
3999 [ALC880_FUJITSU] = "fujitsu",
4000 [ALC880_F1734] = "F1734",
4002 [ALC880_LG_LW] = "lg-lw",
4003 [ALC880_MEDION_RIM] = "medion",
4004 #ifdef CONFIG_SND_DEBUG
4005 [ALC880_TEST] = "test",
4007 [ALC880_AUTO] = "auto",
4010 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4011 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4012 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4013 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4014 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4015 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4016 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4017 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4018 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4019 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4020 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4021 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4022 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4023 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4024 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4025 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4026 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4027 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4028 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4029 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4030 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4031 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4032 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4033 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4034 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4035 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4036 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4037 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4038 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4039 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4040 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4041 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4042 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4043 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4044 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4045 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4046 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4047 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4048 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4049 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4050 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4051 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4052 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4053 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4054 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4055 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4056 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4057 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4058 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4059 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4060 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4061 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4062 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4063 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4064 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4065 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4066 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4067 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4068 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4069 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4070 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4071 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4072 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4073 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4074 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4075 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4076 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4077 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4078 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4080 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4081 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4082 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4087 * ALC880 codec presets
4089 static struct alc_config_preset alc880_presets[] = {
4091 .mixers = { alc880_three_stack_mixer },
4092 .init_verbs = { alc880_volume_init_verbs,
4093 alc880_pin_3stack_init_verbs },
4094 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4095 .dac_nids = alc880_dac_nids,
4096 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4097 .channel_mode = alc880_threestack_modes,
4099 .input_mux = &alc880_capture_source,
4101 [ALC880_3ST_DIG] = {
4102 .mixers = { alc880_three_stack_mixer },
4103 .init_verbs = { alc880_volume_init_verbs,
4104 alc880_pin_3stack_init_verbs },
4105 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4106 .dac_nids = alc880_dac_nids,
4107 .dig_out_nid = ALC880_DIGOUT_NID,
4108 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4109 .channel_mode = alc880_threestack_modes,
4111 .input_mux = &alc880_capture_source,
4113 [ALC880_TCL_S700] = {
4114 .mixers = { alc880_tcl_s700_mixer },
4115 .init_verbs = { alc880_volume_init_verbs,
4116 alc880_pin_tcl_S700_init_verbs,
4117 alc880_gpio2_init_verbs },
4118 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4119 .dac_nids = alc880_dac_nids,
4120 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4121 .num_adc_nids = 1, /* single ADC */
4123 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4124 .channel_mode = alc880_2_jack_modes,
4125 .input_mux = &alc880_capture_source,
4128 .mixers = { alc880_three_stack_mixer,
4129 alc880_five_stack_mixer},
4130 .init_verbs = { alc880_volume_init_verbs,
4131 alc880_pin_5stack_init_verbs },
4132 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4133 .dac_nids = alc880_dac_nids,
4134 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4135 .channel_mode = alc880_fivestack_modes,
4136 .input_mux = &alc880_capture_source,
4138 [ALC880_5ST_DIG] = {
4139 .mixers = { alc880_three_stack_mixer,
4140 alc880_five_stack_mixer },
4141 .init_verbs = { alc880_volume_init_verbs,
4142 alc880_pin_5stack_init_verbs },
4143 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4144 .dac_nids = alc880_dac_nids,
4145 .dig_out_nid = ALC880_DIGOUT_NID,
4146 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4147 .channel_mode = alc880_fivestack_modes,
4148 .input_mux = &alc880_capture_source,
4151 .mixers = { alc880_six_stack_mixer },
4152 .init_verbs = { alc880_volume_init_verbs,
4153 alc880_pin_6stack_init_verbs },
4154 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4155 .dac_nids = alc880_6st_dac_nids,
4156 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4157 .channel_mode = alc880_sixstack_modes,
4158 .input_mux = &alc880_6stack_capture_source,
4160 [ALC880_6ST_DIG] = {
4161 .mixers = { alc880_six_stack_mixer },
4162 .init_verbs = { alc880_volume_init_verbs,
4163 alc880_pin_6stack_init_verbs },
4164 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4165 .dac_nids = alc880_6st_dac_nids,
4166 .dig_out_nid = ALC880_DIGOUT_NID,
4167 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4168 .channel_mode = alc880_sixstack_modes,
4169 .input_mux = &alc880_6stack_capture_source,
4172 .mixers = { alc880_w810_base_mixer },
4173 .init_verbs = { alc880_volume_init_verbs,
4174 alc880_pin_w810_init_verbs,
4175 alc880_gpio2_init_verbs },
4176 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4177 .dac_nids = alc880_w810_dac_nids,
4178 .dig_out_nid = ALC880_DIGOUT_NID,
4179 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4180 .channel_mode = alc880_w810_modes,
4181 .input_mux = &alc880_capture_source,
4184 .mixers = { alc880_z71v_mixer },
4185 .init_verbs = { alc880_volume_init_verbs,
4186 alc880_pin_z71v_init_verbs },
4187 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4188 .dac_nids = alc880_z71v_dac_nids,
4189 .dig_out_nid = ALC880_DIGOUT_NID,
4191 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4192 .channel_mode = alc880_2_jack_modes,
4193 .input_mux = &alc880_capture_source,
4196 .mixers = { alc880_f1734_mixer },
4197 .init_verbs = { alc880_volume_init_verbs,
4198 alc880_pin_f1734_init_verbs },
4199 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4200 .dac_nids = alc880_f1734_dac_nids,
4202 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4203 .channel_mode = alc880_2_jack_modes,
4204 .input_mux = &alc880_f1734_capture_source,
4205 .unsol_event = alc880_uniwill_p53_unsol_event,
4206 .setup = alc880_uniwill_p53_setup,
4207 .init_hook = alc_automute_amp,
4210 .mixers = { alc880_asus_mixer },
4211 .init_verbs = { alc880_volume_init_verbs,
4212 alc880_pin_asus_init_verbs,
4213 alc880_gpio1_init_verbs },
4214 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4215 .dac_nids = alc880_asus_dac_nids,
4216 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4217 .channel_mode = alc880_asus_modes,
4219 .input_mux = &alc880_capture_source,
4221 [ALC880_ASUS_DIG] = {
4222 .mixers = { alc880_asus_mixer },
4223 .init_verbs = { alc880_volume_init_verbs,
4224 alc880_pin_asus_init_verbs,
4225 alc880_gpio1_init_verbs },
4226 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4227 .dac_nids = alc880_asus_dac_nids,
4228 .dig_out_nid = ALC880_DIGOUT_NID,
4229 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4230 .channel_mode = alc880_asus_modes,
4232 .input_mux = &alc880_capture_source,
4234 [ALC880_ASUS_DIG2] = {
4235 .mixers = { alc880_asus_mixer },
4236 .init_verbs = { alc880_volume_init_verbs,
4237 alc880_pin_asus_init_verbs,
4238 alc880_gpio2_init_verbs }, /* use GPIO2 */
4239 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4240 .dac_nids = alc880_asus_dac_nids,
4241 .dig_out_nid = ALC880_DIGOUT_NID,
4242 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4243 .channel_mode = alc880_asus_modes,
4245 .input_mux = &alc880_capture_source,
4247 [ALC880_ASUS_W1V] = {
4248 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4249 .init_verbs = { alc880_volume_init_verbs,
4250 alc880_pin_asus_init_verbs,
4251 alc880_gpio1_init_verbs },
4252 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4253 .dac_nids = alc880_asus_dac_nids,
4254 .dig_out_nid = ALC880_DIGOUT_NID,
4255 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4256 .channel_mode = alc880_asus_modes,
4258 .input_mux = &alc880_capture_source,
4260 [ALC880_UNIWILL_DIG] = {
4261 .mixers = { alc880_asus_mixer },
4262 .init_verbs = { alc880_volume_init_verbs,
4263 alc880_pin_asus_init_verbs },
4264 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4265 .dac_nids = alc880_asus_dac_nids,
4266 .dig_out_nid = ALC880_DIGOUT_NID,
4267 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4268 .channel_mode = alc880_asus_modes,
4270 .input_mux = &alc880_capture_source,
4272 [ALC880_UNIWILL] = {
4273 .mixers = { alc880_uniwill_mixer },
4274 .init_verbs = { alc880_volume_init_verbs,
4275 alc880_uniwill_init_verbs },
4276 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4277 .dac_nids = alc880_asus_dac_nids,
4278 .dig_out_nid = ALC880_DIGOUT_NID,
4279 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4280 .channel_mode = alc880_threestack_modes,
4282 .input_mux = &alc880_capture_source,
4283 .unsol_event = alc880_uniwill_unsol_event,
4284 .setup = alc880_uniwill_setup,
4285 .init_hook = alc880_uniwill_init_hook,
4287 [ALC880_UNIWILL_P53] = {
4288 .mixers = { alc880_uniwill_p53_mixer },
4289 .init_verbs = { alc880_volume_init_verbs,
4290 alc880_uniwill_p53_init_verbs },
4291 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4292 .dac_nids = alc880_asus_dac_nids,
4293 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4294 .channel_mode = alc880_threestack_modes,
4295 .input_mux = &alc880_capture_source,
4296 .unsol_event = alc880_uniwill_p53_unsol_event,
4297 .setup = alc880_uniwill_p53_setup,
4298 .init_hook = alc_automute_amp,
4300 [ALC880_FUJITSU] = {
4301 .mixers = { alc880_fujitsu_mixer },
4302 .init_verbs = { alc880_volume_init_verbs,
4303 alc880_uniwill_p53_init_verbs,
4304 alc880_beep_init_verbs },
4305 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4306 .dac_nids = alc880_dac_nids,
4307 .dig_out_nid = ALC880_DIGOUT_NID,
4308 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4309 .channel_mode = alc880_2_jack_modes,
4310 .input_mux = &alc880_capture_source,
4311 .unsol_event = alc880_uniwill_p53_unsol_event,
4312 .setup = alc880_uniwill_p53_setup,
4313 .init_hook = alc_automute_amp,
4316 .mixers = { alc880_three_stack_mixer },
4317 .init_verbs = { alc880_volume_init_verbs,
4318 alc880_pin_clevo_init_verbs },
4319 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4320 .dac_nids = alc880_dac_nids,
4322 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4323 .channel_mode = alc880_threestack_modes,
4325 .input_mux = &alc880_capture_source,
4328 .mixers = { alc880_lg_mixer },
4329 .init_verbs = { alc880_volume_init_verbs,
4330 alc880_lg_init_verbs },
4331 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4332 .dac_nids = alc880_lg_dac_nids,
4333 .dig_out_nid = ALC880_DIGOUT_NID,
4334 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4335 .channel_mode = alc880_lg_ch_modes,
4337 .input_mux = &alc880_lg_capture_source,
4338 .unsol_event = alc_automute_amp_unsol_event,
4339 .setup = alc880_lg_setup,
4340 .init_hook = alc_automute_amp,
4341 #ifdef CONFIG_SND_HDA_POWER_SAVE
4342 .loopbacks = alc880_lg_loopbacks,
4346 .mixers = { alc880_lg_lw_mixer },
4347 .init_verbs = { alc880_volume_init_verbs,
4348 alc880_lg_lw_init_verbs },
4349 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4350 .dac_nids = alc880_dac_nids,
4351 .dig_out_nid = ALC880_DIGOUT_NID,
4352 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4353 .channel_mode = alc880_lg_lw_modes,
4354 .input_mux = &alc880_lg_lw_capture_source,
4355 .unsol_event = alc_automute_amp_unsol_event,
4356 .setup = alc880_lg_lw_setup,
4357 .init_hook = alc_automute_amp,
4359 [ALC880_MEDION_RIM] = {
4360 .mixers = { alc880_medion_rim_mixer },
4361 .init_verbs = { alc880_volume_init_verbs,
4362 alc880_medion_rim_init_verbs,
4363 alc_gpio2_init_verbs },
4364 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4365 .dac_nids = alc880_dac_nids,
4366 .dig_out_nid = ALC880_DIGOUT_NID,
4367 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4368 .channel_mode = alc880_2_jack_modes,
4369 .input_mux = &alc880_medion_rim_capture_source,
4370 .unsol_event = alc880_medion_rim_unsol_event,
4371 .setup = alc880_medion_rim_setup,
4372 .init_hook = alc880_medion_rim_automute,
4374 #ifdef CONFIG_SND_DEBUG
4376 .mixers = { alc880_test_mixer },
4377 .init_verbs = { alc880_test_init_verbs },
4378 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4379 .dac_nids = alc880_test_dac_nids,
4380 .dig_out_nid = ALC880_DIGOUT_NID,
4381 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4382 .channel_mode = alc880_test_modes,
4383 .input_mux = &alc880_test_capture_source,
4389 * Automatic parse of I/O pins from the BIOS configuration
4394 ALC_CTL_WIDGET_MUTE,
4397 static struct snd_kcontrol_new alc880_control_templates[] = {
4398 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4399 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4400 HDA_BIND_MUTE(NULL, 0, 0, 0),
4403 /* add dynamic controls */
4404 static int add_control(struct alc_spec *spec, int type, const char *name,
4407 struct snd_kcontrol_new *knew;
4409 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4410 knew = snd_array_new(&spec->kctls);
4413 *knew = alc880_control_templates[type];
4414 knew->name = kstrdup(name, GFP_KERNEL);
4417 if (get_amp_nid_(val))
4418 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4419 knew->private_value = val;
4423 static int add_control_with_pfx(struct alc_spec *spec, int type,
4424 const char *pfx, const char *dir,
4425 const char *sfx, unsigned long val)
4428 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4429 return add_control(spec, type, name, val);
4432 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4433 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4434 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4435 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4437 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4438 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4439 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4440 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4441 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4442 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4443 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4444 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4445 #define ALC880_PIN_CD_NID 0x1c
4447 /* fill in the dac_nids table from the parsed pin configuration */
4448 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4449 const struct auto_pin_cfg *cfg)
4455 memset(assigned, 0, sizeof(assigned));
4456 spec->multiout.dac_nids = spec->private_dac_nids;
4458 /* check the pins hardwired to audio widget */
4459 for (i = 0; i < cfg->line_outs; i++) {
4460 nid = cfg->line_out_pins[i];
4461 if (alc880_is_fixed_pin(nid)) {
4462 int idx = alc880_fixed_pin_idx(nid);
4463 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4467 /* left pins can be connect to any audio widget */
4468 for (i = 0; i < cfg->line_outs; i++) {
4469 nid = cfg->line_out_pins[i];
4470 if (alc880_is_fixed_pin(nid))
4472 /* search for an empty channel */
4473 for (j = 0; j < cfg->line_outs; j++) {
4475 spec->multiout.dac_nids[i] =
4476 alc880_idx_to_dac(j);
4482 spec->multiout.num_dacs = cfg->line_outs;
4486 /* add playback controls from the parsed DAC table */
4487 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4488 const struct auto_pin_cfg *cfg)
4490 static const char *chname[4] = {
4491 "Front", "Surround", NULL /*CLFE*/, "Side"
4496 for (i = 0; i < cfg->line_outs; i++) {
4497 if (!spec->multiout.dac_nids[i])
4499 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4502 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4504 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4508 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4510 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4514 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4516 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4520 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4522 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4528 if (cfg->line_outs == 1 &&
4529 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4533 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4534 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4538 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4539 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4548 /* add playback controls for speaker and HP outputs */
4549 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4558 if (alc880_is_fixed_pin(pin)) {
4559 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4560 /* specify the DAC as the extra output */
4561 if (!spec->multiout.hp_nid)
4562 spec->multiout.hp_nid = nid;
4564 spec->multiout.extra_out_nid[0] = nid;
4565 /* control HP volume/switch on the output mixer amp */
4566 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4567 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4568 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4571 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4572 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4575 } else if (alc880_is_multi_pin(pin)) {
4576 /* set manual connection */
4577 /* we have only a switch on HP-out PIN */
4578 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4579 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4586 /* create input playback/capture controls for the given pin */
4587 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4588 const char *ctlname,
4589 int idx, hda_nid_t mix_nid)
4593 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4594 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4597 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4598 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4604 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4606 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4607 return (pincap & AC_PINCAP_IN) != 0;
4610 /* create playback/capture controls for input pins */
4611 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4612 const struct auto_pin_cfg *cfg,
4614 hda_nid_t cap1, hda_nid_t cap2)
4616 struct alc_spec *spec = codec->spec;
4617 struct hda_input_mux *imux = &spec->private_imux[0];
4620 for (i = 0; i < AUTO_PIN_LAST; i++) {
4623 pin = cfg->input_pins[i];
4624 if (!alc_is_input_pin(codec, pin))
4628 idx = get_connection_index(codec, mixer, pin);
4630 err = new_analog_input(spec, pin,
4631 auto_pin_cfg_labels[i],
4640 idx = get_connection_index(codec, cap1, pin);
4641 if (idx < 0 && cap2)
4642 idx = get_connection_index(codec, cap2, pin);
4644 imux->items[imux->num_items].label =
4645 auto_pin_cfg_labels[i];
4646 imux->items[imux->num_items].index = idx;
4653 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4654 const struct auto_pin_cfg *cfg)
4656 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4659 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4660 unsigned int pin_type)
4662 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4665 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4669 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4670 hda_nid_t nid, int pin_type,
4673 alc_set_pin_output(codec, nid, pin_type);
4674 /* need the manual connection? */
4675 if (alc880_is_multi_pin(nid)) {
4676 struct alc_spec *spec = codec->spec;
4677 int idx = alc880_multi_pin_idx(nid);
4678 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4679 AC_VERB_SET_CONNECT_SEL,
4680 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4684 static int get_pin_type(int line_out_type)
4686 if (line_out_type == AUTO_PIN_HP_OUT)
4692 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4694 struct alc_spec *spec = codec->spec;
4697 for (i = 0; i < spec->autocfg.line_outs; i++) {
4698 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4699 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4700 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4704 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4706 struct alc_spec *spec = codec->spec;
4709 pin = spec->autocfg.speaker_pins[0];
4710 if (pin) /* connect to front */
4711 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4712 pin = spec->autocfg.hp_pins[0];
4713 if (pin) /* connect to front */
4714 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4717 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4719 struct alc_spec *spec = codec->spec;
4722 for (i = 0; i < AUTO_PIN_LAST; i++) {
4723 hda_nid_t nid = spec->autocfg.input_pins[i];
4724 if (alc_is_input_pin(codec, nid)) {
4725 alc_set_input_pin(codec, nid, i);
4726 if (nid != ALC880_PIN_CD_NID &&
4727 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4728 snd_hda_codec_write(codec, nid, 0,
4729 AC_VERB_SET_AMP_GAIN_MUTE,
4735 /* parse the BIOS configuration and set up the alc_spec */
4736 /* return 1 if successful, 0 if the proper config is not found,
4737 * or a negative error code
4739 static int alc880_parse_auto_config(struct hda_codec *codec)
4741 struct alc_spec *spec = codec->spec;
4743 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4745 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4749 if (!spec->autocfg.line_outs)
4750 return 0; /* can't find valid BIOS pin config */
4752 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4755 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4758 err = alc880_auto_create_extra_out(spec,
4759 spec->autocfg.speaker_pins[0],
4763 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4767 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4771 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4773 /* check multiple SPDIF-out (for recent codecs) */
4774 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4776 err = snd_hda_get_connections(codec,
4777 spec->autocfg.dig_out_pins[i],
4782 spec->multiout.dig_out_nid = dig_nid;
4784 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4785 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4787 spec->slave_dig_outs[i - 1] = dig_nid;
4790 if (spec->autocfg.dig_in_pin)
4791 spec->dig_in_nid = ALC880_DIGIN_NID;
4793 if (spec->kctls.list)
4794 add_mixer(spec, spec->kctls.list);
4796 add_verb(spec, alc880_volume_init_verbs);
4798 spec->num_mux_defs = 1;
4799 spec->input_mux = &spec->private_imux[0];
4801 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4806 /* additional initialization for auto-configuration model */
4807 static void alc880_auto_init(struct hda_codec *codec)
4809 struct alc_spec *spec = codec->spec;
4810 alc880_auto_init_multi_out(codec);
4811 alc880_auto_init_extra_out(codec);
4812 alc880_auto_init_analog_input(codec);
4813 if (spec->unsol_event)
4814 alc_inithook(codec);
4817 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4818 * one of two digital mic pins, e.g. on ALC272
4820 static void fixup_automic_adc(struct hda_codec *codec)
4822 struct alc_spec *spec = codec->spec;
4825 for (i = 0; i < spec->num_adc_nids; i++) {
4826 hda_nid_t cap = spec->capsrc_nids ?
4827 spec->capsrc_nids[i] : spec->adc_nids[i];
4830 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4833 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4836 spec->int_mic.mux_idx = iidx;
4837 spec->ext_mic.mux_idx = eidx;
4838 if (spec->capsrc_nids)
4839 spec->capsrc_nids += i;
4840 spec->adc_nids += i;
4841 spec->num_adc_nids = 1;
4844 snd_printd(KERN_INFO "hda_codec: %s: "
4845 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4846 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4847 spec->auto_mic = 0; /* disable auto-mic to be sure */
4850 static void set_capture_mixer(struct hda_codec *codec)
4852 struct alc_spec *spec = codec->spec;
4853 static struct snd_kcontrol_new *caps[2][3] = {
4854 { alc_capture_mixer_nosrc1,
4855 alc_capture_mixer_nosrc2,
4856 alc_capture_mixer_nosrc3 },
4857 { alc_capture_mixer1,
4859 alc_capture_mixer3 },
4861 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4863 if (spec->auto_mic) {
4865 fixup_automic_adc(codec);
4866 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4870 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4874 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4875 #define set_beep_amp(spec, nid, idx, dir) \
4876 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4878 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4882 * OK, here we have finally the patch for ALC880
4885 static int patch_alc880(struct hda_codec *codec)
4887 struct alc_spec *spec;
4891 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4897 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4900 if (board_config < 0) {
4901 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4903 board_config = ALC880_AUTO;
4906 if (board_config == ALC880_AUTO) {
4907 /* automatic parse from the BIOS config */
4908 err = alc880_parse_auto_config(codec);
4914 "hda_codec: Cannot set up configuration "
4915 "from BIOS. Using 3-stack mode...\n");
4916 board_config = ALC880_3ST;
4920 err = snd_hda_attach_beep_device(codec, 0x1);
4926 if (board_config != ALC880_AUTO)
4927 setup_preset(codec, &alc880_presets[board_config]);
4929 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4930 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4931 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4933 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4934 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4936 if (!spec->adc_nids && spec->input_mux) {
4937 /* check whether NID 0x07 is valid */
4938 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4940 wcap = get_wcaps_type(wcap);
4941 if (wcap != AC_WID_AUD_IN) {
4942 spec->adc_nids = alc880_adc_nids_alt;
4943 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4945 spec->adc_nids = alc880_adc_nids;
4946 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4949 set_capture_mixer(codec);
4950 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4952 spec->vmaster_nid = 0x0c;
4954 codec->patch_ops = alc_patch_ops;
4955 if (board_config == ALC880_AUTO)
4956 spec->init_hook = alc880_auto_init;
4957 #ifdef CONFIG_SND_HDA_POWER_SAVE
4958 if (!spec->loopback.amplist)
4959 spec->loopback.amplist = alc880_loopbacks;
4961 codec->proc_widget_hook = print_realtek_coef;
4971 static hda_nid_t alc260_dac_nids[1] = {
4976 static hda_nid_t alc260_adc_nids[1] = {
4981 static hda_nid_t alc260_adc_nids_alt[1] = {
4986 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4987 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4989 static hda_nid_t alc260_dual_adc_nids[2] = {
4994 #define ALC260_DIGOUT_NID 0x03
4995 #define ALC260_DIGIN_NID 0x06
4997 static struct hda_input_mux alc260_capture_source = {
5001 { "Front Mic", 0x1 },
5007 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5008 * headphone jack and the internal CD lines since these are the only pins at
5009 * which audio can appear. For flexibility, also allow the option of
5010 * recording the mixer output on the second ADC (ADC0 doesn't have a
5011 * connection to the mixer output).
5013 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5017 { "Mic/Line", 0x0 },
5019 { "Headphone", 0x2 },
5025 { "Mic/Line", 0x0 },
5027 { "Headphone", 0x2 },
5034 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5035 * the Fujitsu S702x, but jacks are marked differently.
5037 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5044 { "Headphone", 0x5 },
5053 { "Headphone", 0x6 },
5059 /* Maxdata Favorit 100XS */
5060 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5064 { "Line/Mic", 0x0 },
5071 { "Line/Mic", 0x0 },
5079 * This is just place-holder, so there's something for alc_build_pcms to look
5080 * at when it calculates the maximum number of channels. ALC260 has no mixer
5081 * element which allows changing the channel mode, so the verb list is
5084 static struct hda_channel_mode alc260_modes[1] = {
5089 /* Mixer combinations
5091 * basic: base_output + input + pc_beep + capture
5092 * HP: base_output + input + capture_alt
5093 * HP_3013: hp_3013 + input + capture
5094 * fujitsu: fujitsu + capture
5095 * acer: acer + capture
5098 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5099 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5100 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5101 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5102 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5103 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5104 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5108 static struct snd_kcontrol_new alc260_input_mixer[] = {
5109 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5110 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5111 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5112 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5114 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5115 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5116 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5120 /* update HP, line and mono out pins according to the master switch */
5121 static void alc260_hp_master_update(struct hda_codec *codec,
5122 hda_nid_t hp, hda_nid_t line,
5125 struct alc_spec *spec = codec->spec;
5126 unsigned int val = spec->master_sw ? PIN_HP : 0;
5127 /* change HP and line-out pins */
5128 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5130 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5132 /* mono (speaker) depending on the HP jack sense */
5133 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5134 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5138 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5139 struct snd_ctl_elem_value *ucontrol)
5141 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5142 struct alc_spec *spec = codec->spec;
5143 *ucontrol->value.integer.value = spec->master_sw;
5147 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5148 struct snd_ctl_elem_value *ucontrol)
5150 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5151 struct alc_spec *spec = codec->spec;
5152 int val = !!*ucontrol->value.integer.value;
5153 hda_nid_t hp, line, mono;
5155 if (val == spec->master_sw)
5157 spec->master_sw = val;
5158 hp = (kcontrol->private_value >> 16) & 0xff;
5159 line = (kcontrol->private_value >> 8) & 0xff;
5160 mono = kcontrol->private_value & 0xff;
5161 alc260_hp_master_update(codec, hp, line, mono);
5165 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5167 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5168 .name = "Master Playback Switch",
5169 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5170 .info = snd_ctl_boolean_mono_info,
5171 .get = alc260_hp_master_sw_get,
5172 .put = alc260_hp_master_sw_put,
5173 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5175 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5176 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5177 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5178 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5179 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5181 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5185 static struct hda_verb alc260_hp_unsol_verbs[] = {
5186 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5190 static void alc260_hp_automute(struct hda_codec *codec)
5192 struct alc_spec *spec = codec->spec;
5194 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5195 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5198 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5200 if ((res >> 26) == ALC880_HP_EVENT)
5201 alc260_hp_automute(codec);
5204 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5206 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5207 .name = "Master Playback Switch",
5208 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5209 .info = snd_ctl_boolean_mono_info,
5210 .get = alc260_hp_master_sw_get,
5211 .put = alc260_hp_master_sw_put,
5212 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5214 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5215 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5216 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5217 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5218 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5219 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5220 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5221 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5225 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5226 .ops = &snd_hda_bind_vol,
5228 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5229 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5230 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5235 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5236 .ops = &snd_hda_bind_sw,
5238 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5239 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5244 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5245 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5246 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5247 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5248 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5252 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5257 static void alc260_hp_3013_automute(struct hda_codec *codec)
5259 struct alc_spec *spec = codec->spec;
5261 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5262 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5265 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5268 if ((res >> 26) == ALC880_HP_EVENT)
5269 alc260_hp_3013_automute(codec);
5272 static void alc260_hp_3012_automute(struct hda_codec *codec)
5274 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5276 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5278 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5280 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5284 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5287 if ((res >> 26) == ALC880_HP_EVENT)
5288 alc260_hp_3012_automute(codec);
5291 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5292 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5294 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5295 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5296 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5297 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5298 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5299 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5300 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5301 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5302 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5303 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5304 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5308 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5309 * versions of the ALC260 don't act on requests to enable mic bias from NID
5310 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5311 * datasheet doesn't mention this restriction. At this stage it's not clear
5312 * whether this behaviour is intentional or is a hardware bug in chip
5313 * revisions available in early 2006. Therefore for now allow the
5314 * "Headphone Jack Mode" control to span all choices, but if it turns out
5315 * that the lack of mic bias for this NID is intentional we could change the
5316 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5318 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5319 * don't appear to make the mic bias available from the "line" jack, even
5320 * though the NID used for this jack (0x14) can supply it. The theory is
5321 * that perhaps Acer have included blocking capacitors between the ALC260
5322 * and the output jack. If this turns out to be the case for all such
5323 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5324 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5326 * The C20x Tablet series have a mono internal speaker which is controlled
5327 * via the chip's Mono sum widget and pin complex, so include the necessary
5328 * controls for such models. On models without a "mono speaker" the control
5329 * won't do anything.
5331 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5332 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5333 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5334 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5335 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5337 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5339 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5340 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5342 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5343 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5344 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5345 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5346 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5350 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5352 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5353 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5354 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5355 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5356 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5357 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5358 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5362 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5363 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5365 static struct snd_kcontrol_new alc260_will_mixer[] = {
5366 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5367 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5369 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5370 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5371 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5372 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5373 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5374 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5375 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5379 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5380 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5382 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5383 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5384 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5386 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5387 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5388 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5389 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5390 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5391 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5392 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5397 * initialization verbs
5399 static struct hda_verb alc260_init_verbs[] = {
5400 /* Line In pin widget for input */
5401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5402 /* CD pin widget for input */
5403 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5404 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5405 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5406 /* Mic2 (front panel) pin widget for input and vref at 80% */
5407 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5408 /* LINE-2 is used for line-out in rear */
5409 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5410 /* select line-out */
5411 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5413 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5415 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5417 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5418 /* mute capture amp left and right */
5419 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5420 /* set connection select to line in (default select for this ADC) */
5421 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5422 /* mute capture amp left and right */
5423 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5424 /* set connection select to line in (default select for this ADC) */
5425 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5426 /* set vol=0 Line-Out mixer amp left and right */
5427 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5428 /* unmute pin widget amp left and right (no gain on this amp) */
5429 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5430 /* set vol=0 HP mixer amp left and right */
5431 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5432 /* unmute pin widget amp left and right (no gain on this amp) */
5433 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5434 /* set vol=0 Mono mixer amp left and right */
5435 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5436 /* unmute pin widget amp left and right (no gain on this amp) */
5437 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5438 /* unmute LINE-2 out pin */
5439 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5440 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5443 /* mute analog inputs */
5444 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5447 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5448 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5449 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5450 /* mute Front out path */
5451 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5452 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5453 /* mute Headphone out path */
5454 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5455 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5456 /* mute Mono out path */
5457 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5458 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5462 #if 0 /* should be identical with alc260_init_verbs? */
5463 static struct hda_verb alc260_hp_init_verbs[] = {
5464 /* Headphone and output */
5465 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5467 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5468 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5469 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5470 /* Mic2 (front panel) pin widget for input and vref at 80% */
5471 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5472 /* Line In pin widget for input */
5473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5474 /* Line-2 pin widget for output */
5475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5476 /* CD pin widget for input */
5477 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5478 /* unmute amp left and right */
5479 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5480 /* set connection select to line in (default select for this ADC) */
5481 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5482 /* unmute Line-Out mixer amp left and right (volume = 0) */
5483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5484 /* mute pin widget amp left and right (no gain on this amp) */
5485 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5486 /* unmute HP mixer amp left and right (volume = 0) */
5487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5488 /* mute pin widget amp left and right (no gain on this amp) */
5489 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5490 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5493 /* mute analog inputs */
5494 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5497 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5499 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5500 /* Unmute Front out path */
5501 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5502 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5503 /* Unmute Headphone out path */
5504 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5505 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5506 /* Unmute Mono out path */
5507 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5508 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5513 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5514 /* Line out and output */
5515 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5517 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5518 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5519 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5520 /* Mic2 (front panel) pin widget for input and vref at 80% */
5521 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5522 /* Line In pin widget for input */
5523 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5524 /* Headphone pin widget for output */
5525 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5526 /* CD pin widget for input */
5527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5528 /* unmute amp left and right */
5529 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5530 /* set connection select to line in (default select for this ADC) */
5531 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5532 /* unmute Line-Out mixer amp left and right (volume = 0) */
5533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5534 /* mute pin widget amp left and right (no gain on this amp) */
5535 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5536 /* unmute HP mixer amp left and right (volume = 0) */
5537 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5538 /* mute pin widget amp left and right (no gain on this amp) */
5539 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5540 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5543 /* mute analog inputs */
5544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5549 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5550 /* Unmute Front out path */
5551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5552 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5553 /* Unmute Headphone out path */
5554 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5555 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5556 /* Unmute Mono out path */
5557 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5558 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5562 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5563 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5564 * audio = 0x16, internal speaker = 0x10.
5566 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5567 /* Disable all GPIOs */
5568 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5569 /* Internal speaker is connected to headphone pin */
5570 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5571 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5572 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5573 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5574 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5575 /* Ensure all other unused pins are disabled and muted. */
5576 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5577 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5578 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5579 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5580 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5581 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5583 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5585 /* Disable digital (SPDIF) pins */
5586 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5587 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5589 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5590 * when acting as an output.
5592 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5594 /* Start with output sum widgets muted and their output gains at min */
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5596 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5597 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5599 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5601 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5602 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5603 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5605 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5606 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5607 /* Unmute Line1 pin widget output buffer since it starts as an output.
5608 * If the pin mode is changed by the user the pin mode control will
5609 * take care of enabling the pin's input/output buffers as needed.
5610 * Therefore there's no need to enable the input buffer at this
5613 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5614 /* Unmute input buffer of pin widget used for Line-in (no equiv
5617 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5619 /* Mute capture amp left and right */
5620 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5621 /* Set ADC connection select to match default mixer setting - line
5624 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5626 /* Do the same for the second ADC: mute capture input amp and
5627 * set ADC connection to line in (on mic1 pin)
5629 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5630 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5632 /* Mute all inputs to mixer widget (even unconnected ones) */
5633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5640 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5645 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5646 * similar laptops (adapted from Fujitsu init verbs).
5648 static struct hda_verb alc260_acer_init_verbs[] = {
5649 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5650 * the headphone jack. Turn this on and rely on the standard mute
5651 * methods whenever the user wants to turn these outputs off.
5653 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5654 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5655 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5656 /* Internal speaker/Headphone jack is connected to Line-out pin */
5657 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5658 /* Internal microphone/Mic jack is connected to Mic1 pin */
5659 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5660 /* Line In jack is connected to Line1 pin */
5661 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5662 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5663 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5664 /* Ensure all other unused pins are disabled and muted. */
5665 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5666 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5667 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5668 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5671 /* Disable digital (SPDIF) pins */
5672 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5673 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5675 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5676 * bus when acting as outputs.
5678 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5679 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5681 /* Start with output sum widgets muted and their output gains at min */
5682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5683 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5684 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5685 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5686 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5687 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5688 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5689 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5690 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5692 /* Unmute Line-out pin widget amp left and right
5693 * (no equiv mixer ctrl)
5695 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5696 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5697 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5698 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5699 * inputs. If the pin mode is changed by the user the pin mode control
5700 * will take care of enabling the pin's input/output buffers as needed.
5701 * Therefore there's no need to enable the input buffer at this
5704 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5705 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5707 /* Mute capture amp left and right */
5708 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5709 /* Set ADC connection select to match default mixer setting - mic
5712 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5714 /* Do similar with the second ADC: mute capture input amp and
5715 * set ADC connection to mic to match ALSA's default state.
5717 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5718 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5720 /* Mute all inputs to mixer widget (even unconnected ones) */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5725 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5727 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5728 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5733 /* Initialisation sequence for Maxdata Favorit 100XS
5734 * (adapted from Acer init verbs).
5736 static struct hda_verb alc260_favorit100_init_verbs[] = {
5737 /* GPIO 0 enables the output jack.
5738 * Turn this on and rely on the standard mute
5739 * methods whenever the user wants to turn these outputs off.
5741 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5742 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5743 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5744 /* Line/Mic input jack is connected to Mic1 pin */
5745 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5746 /* Ensure all other unused pins are disabled and muted. */
5747 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5748 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5749 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5750 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5751 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5752 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5757 /* Disable digital (SPDIF) pins */
5758 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5759 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5761 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5762 * bus when acting as outputs.
5764 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5765 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5767 /* Start with output sum widgets muted and their output gains at min */
5768 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5769 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5770 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5771 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5772 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5773 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5774 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5775 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5776 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5778 /* Unmute Line-out pin widget amp left and right
5779 * (no equiv mixer ctrl)
5781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5782 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5783 * inputs. If the pin mode is changed by the user the pin mode control
5784 * will take care of enabling the pin's input/output buffers as needed.
5785 * Therefore there's no need to enable the input buffer at this
5788 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5790 /* Mute capture amp left and right */
5791 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5792 /* Set ADC connection select to match default mixer setting - mic
5795 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5797 /* Do similar with the second ADC: mute capture input amp and
5798 * set ADC connection to mic to match ALSA's default state.
5800 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5801 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5803 /* Mute all inputs to mixer widget (even unconnected ones) */
5804 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5805 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5806 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5807 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5808 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5809 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5810 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5811 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5816 static struct hda_verb alc260_will_verbs[] = {
5817 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5818 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5819 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5820 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5821 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5822 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5826 static struct hda_verb alc260_replacer_672v_verbs[] = {
5827 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5828 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5829 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5831 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5832 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5833 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5835 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5839 /* toggle speaker-output according to the hp-jack state */
5840 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5842 unsigned int present;
5844 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5845 present = snd_hda_jack_detect(codec, 0x0f);
5847 snd_hda_codec_write_cache(codec, 0x01, 0,
5848 AC_VERB_SET_GPIO_DATA, 1);
5849 snd_hda_codec_write_cache(codec, 0x0f, 0,
5850 AC_VERB_SET_PIN_WIDGET_CONTROL,
5853 snd_hda_codec_write_cache(codec, 0x01, 0,
5854 AC_VERB_SET_GPIO_DATA, 0);
5855 snd_hda_codec_write_cache(codec, 0x0f, 0,
5856 AC_VERB_SET_PIN_WIDGET_CONTROL,
5861 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5864 if ((res >> 26) == ALC880_HP_EVENT)
5865 alc260_replacer_672v_automute(codec);
5868 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5869 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5870 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5871 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5872 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5873 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5875 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5876 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5877 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5878 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5882 /* Test configuration for debugging, modelled after the ALC880 test
5885 #ifdef CONFIG_SND_DEBUG
5886 static hda_nid_t alc260_test_dac_nids[1] = {
5889 static hda_nid_t alc260_test_adc_nids[2] = {
5892 /* For testing the ALC260, each input MUX needs its own definition since
5893 * the signal assignments are different. This assumes that the first ADC
5896 static struct hda_input_mux alc260_test_capture_sources[2] = {
5900 { "MIC1 pin", 0x0 },
5901 { "MIC2 pin", 0x1 },
5902 { "LINE1 pin", 0x2 },
5903 { "LINE2 pin", 0x3 },
5905 { "LINE-OUT pin", 0x5 },
5906 { "HP-OUT pin", 0x6 },
5912 { "MIC1 pin", 0x0 },
5913 { "MIC2 pin", 0x1 },
5914 { "LINE1 pin", 0x2 },
5915 { "LINE2 pin", 0x3 },
5918 { "LINE-OUT pin", 0x6 },
5919 { "HP-OUT pin", 0x7 },
5923 static struct snd_kcontrol_new alc260_test_mixer[] = {
5924 /* Output driver widgets */
5925 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5926 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5927 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5928 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5929 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5930 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5932 /* Modes for retasking pin widgets
5933 * Note: the ALC260 doesn't seem to act on requests to enable mic
5934 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5935 * mention this restriction. At this stage it's not clear whether
5936 * this behaviour is intentional or is a hardware bug in chip
5937 * revisions available at least up until early 2006. Therefore for
5938 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5939 * choices, but if it turns out that the lack of mic bias for these
5940 * NIDs is intentional we could change their modes from
5941 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5943 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5944 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5945 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5946 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5947 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5948 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5950 /* Loopback mixer controls */
5951 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5952 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5953 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5954 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5955 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5956 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5957 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5958 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5959 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5960 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5961 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5962 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5963 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5964 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5966 /* Controls for GPIO pins, assuming they are configured as outputs */
5967 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5968 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5969 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5970 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5972 /* Switches to allow the digital IO pins to be enabled. The datasheet
5973 * is ambigious as to which NID is which; testing on laptops which
5974 * make this output available should provide clarification.
5976 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5977 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5979 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5980 * this output to turn on an external amplifier.
5982 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5983 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5987 static struct hda_verb alc260_test_init_verbs[] = {
5988 /* Enable all GPIOs as outputs with an initial value of 0 */
5989 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5990 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5991 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5993 /* Enable retasking pins as output, initially without power amp */
5994 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5995 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5996 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5997 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5998 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5999 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6001 /* Disable digital (SPDIF) pins initially, but users can enable
6002 * them via a mixer switch. In the case of SPDIF-out, this initverb
6003 * payload also sets the generation to 0, output to be in "consumer"
6004 * PCM format, copyright asserted, no pre-emphasis and no validity
6007 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6008 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6010 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6011 * OUT1 sum bus when acting as an output.
6013 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6014 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6015 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6016 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6018 /* Start with output sum widgets muted and their output gains at min */
6019 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6020 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6021 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6022 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6023 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6024 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6025 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6026 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6027 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6029 /* Unmute retasking pin widget output buffers since the default
6030 * state appears to be output. As the pin mode is changed by the
6031 * user the pin mode control will take care of enabling the pin's
6032 * input/output buffers as needed.
6034 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6035 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6036 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6037 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6038 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6039 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6040 /* Also unmute the mono-out pin widget */
6041 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6043 /* Mute capture amp left and right */
6044 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6045 /* Set ADC connection select to match default mixer setting (mic1
6048 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6050 /* Do the same for the second ADC: mute capture input amp and
6051 * set ADC connection to mic1 pin
6053 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6054 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6056 /* Mute all inputs to mixer widget (even unconnected ones) */
6057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6063 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6064 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6070 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6071 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6073 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6074 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6077 * for BIOS auto-configuration
6080 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6081 const char *pfx, int *vol_bits)
6084 unsigned long vol_val, sw_val;
6087 if (nid >= 0x0f && nid < 0x11) {
6088 nid_vol = nid - 0x7;
6089 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6090 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6091 } else if (nid == 0x11) {
6092 nid_vol = nid - 0x7;
6093 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6094 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6095 } else if (nid >= 0x12 && nid <= 0x15) {
6097 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6098 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6102 if (!(*vol_bits & (1 << nid_vol))) {
6103 /* first control for the volume widget */
6104 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6107 *vol_bits |= (1 << nid_vol);
6109 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6115 /* add playback controls from the parsed DAC table */
6116 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6117 const struct auto_pin_cfg *cfg)
6123 spec->multiout.num_dacs = 1;
6124 spec->multiout.dac_nids = spec->private_dac_nids;
6125 spec->multiout.dac_nids[0] = 0x02;
6127 nid = cfg->line_out_pins[0];
6130 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6132 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6136 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6141 nid = cfg->speaker_pins[0];
6143 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6148 nid = cfg->hp_pins[0];
6150 err = alc260_add_playback_controls(spec, nid, "Headphone",
6158 /* create playback/capture controls for input pins */
6159 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6160 const struct auto_pin_cfg *cfg)
6162 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6165 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6166 hda_nid_t nid, int pin_type,
6169 alc_set_pin_output(codec, nid, pin_type);
6170 /* need the manual connection? */
6172 int idx = nid - 0x12;
6173 snd_hda_codec_write(codec, idx + 0x0b, 0,
6174 AC_VERB_SET_CONNECT_SEL, sel_idx);
6178 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6180 struct alc_spec *spec = codec->spec;
6183 nid = spec->autocfg.line_out_pins[0];
6185 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6186 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6189 nid = spec->autocfg.speaker_pins[0];
6191 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6193 nid = spec->autocfg.hp_pins[0];
6195 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6198 #define ALC260_PIN_CD_NID 0x16
6199 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6201 struct alc_spec *spec = codec->spec;
6204 for (i = 0; i < AUTO_PIN_LAST; i++) {
6205 hda_nid_t nid = spec->autocfg.input_pins[i];
6207 alc_set_input_pin(codec, nid, i);
6208 if (nid != ALC260_PIN_CD_NID &&
6209 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6210 snd_hda_codec_write(codec, nid, 0,
6211 AC_VERB_SET_AMP_GAIN_MUTE,
6218 * generic initialization of ADC, input mixers and output mixers
6220 static struct hda_verb alc260_volume_init_verbs[] = {
6222 * Unmute ADC0-1 and set the default input to mic-in
6224 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6225 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6226 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6227 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6229 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6231 * Note: PASD motherboards uses the Line In 2 as the input for
6232 * front panel mic (mic 2)
6234 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6235 /* mute analog inputs */
6236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6239 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6240 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6243 * Set up output mixers (0x08 - 0x0a)
6245 /* set vol=0 to output mixers */
6246 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6247 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6248 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6249 /* set up input amps for analog loopback */
6250 /* Amp Indices: DAC = 0, mixer = 1 */
6251 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6252 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6253 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6254 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6255 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6256 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6261 static int alc260_parse_auto_config(struct hda_codec *codec)
6263 struct alc_spec *spec = codec->spec;
6265 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6267 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6271 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6274 if (!spec->kctls.list)
6275 return 0; /* can't find valid BIOS pin config */
6276 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6280 spec->multiout.max_channels = 2;
6282 if (spec->autocfg.dig_outs)
6283 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6284 if (spec->kctls.list)
6285 add_mixer(spec, spec->kctls.list);
6287 add_verb(spec, alc260_volume_init_verbs);
6289 spec->num_mux_defs = 1;
6290 spec->input_mux = &spec->private_imux[0];
6292 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6297 /* additional initialization for auto-configuration model */
6298 static void alc260_auto_init(struct hda_codec *codec)
6300 struct alc_spec *spec = codec->spec;
6301 alc260_auto_init_multi_out(codec);
6302 alc260_auto_init_analog_input(codec);
6303 if (spec->unsol_event)
6304 alc_inithook(codec);
6307 #ifdef CONFIG_SND_HDA_POWER_SAVE
6308 static struct hda_amp_list alc260_loopbacks[] = {
6309 { 0x07, HDA_INPUT, 0 },
6310 { 0x07, HDA_INPUT, 1 },
6311 { 0x07, HDA_INPUT, 2 },
6312 { 0x07, HDA_INPUT, 3 },
6313 { 0x07, HDA_INPUT, 4 },
6319 * ALC260 configurations
6321 static const char *alc260_models[ALC260_MODEL_LAST] = {
6322 [ALC260_BASIC] = "basic",
6324 [ALC260_HP_3013] = "hp-3013",
6325 [ALC260_HP_DC7600] = "hp-dc7600",
6326 [ALC260_FUJITSU_S702X] = "fujitsu",
6327 [ALC260_ACER] = "acer",
6328 [ALC260_WILL] = "will",
6329 [ALC260_REPLACER_672V] = "replacer",
6330 [ALC260_FAVORIT100] = "favorit100",
6331 #ifdef CONFIG_SND_DEBUG
6332 [ALC260_TEST] = "test",
6334 [ALC260_AUTO] = "auto",
6337 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6338 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6339 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6340 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6341 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6342 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6343 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6344 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6345 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6346 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6347 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6348 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6349 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6350 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6351 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6352 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6353 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6354 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6355 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6356 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6357 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6361 static struct alc_config_preset alc260_presets[] = {
6363 .mixers = { alc260_base_output_mixer,
6364 alc260_input_mixer },
6365 .init_verbs = { alc260_init_verbs },
6366 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6367 .dac_nids = alc260_dac_nids,
6368 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6369 .adc_nids = alc260_adc_nids,
6370 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6371 .channel_mode = alc260_modes,
6372 .input_mux = &alc260_capture_source,
6375 .mixers = { alc260_hp_output_mixer,
6376 alc260_input_mixer },
6377 .init_verbs = { alc260_init_verbs,
6378 alc260_hp_unsol_verbs },
6379 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6380 .dac_nids = alc260_dac_nids,
6381 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6382 .adc_nids = alc260_adc_nids_alt,
6383 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6384 .channel_mode = alc260_modes,
6385 .input_mux = &alc260_capture_source,
6386 .unsol_event = alc260_hp_unsol_event,
6387 .init_hook = alc260_hp_automute,
6389 [ALC260_HP_DC7600] = {
6390 .mixers = { alc260_hp_dc7600_mixer,
6391 alc260_input_mixer },
6392 .init_verbs = { alc260_init_verbs,
6393 alc260_hp_dc7600_verbs },
6394 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6395 .dac_nids = alc260_dac_nids,
6396 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6397 .adc_nids = alc260_adc_nids_alt,
6398 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6399 .channel_mode = alc260_modes,
6400 .input_mux = &alc260_capture_source,
6401 .unsol_event = alc260_hp_3012_unsol_event,
6402 .init_hook = alc260_hp_3012_automute,
6404 [ALC260_HP_3013] = {
6405 .mixers = { alc260_hp_3013_mixer,
6406 alc260_input_mixer },
6407 .init_verbs = { alc260_hp_3013_init_verbs,
6408 alc260_hp_3013_unsol_verbs },
6409 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6410 .dac_nids = alc260_dac_nids,
6411 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6412 .adc_nids = alc260_adc_nids_alt,
6413 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6414 .channel_mode = alc260_modes,
6415 .input_mux = &alc260_capture_source,
6416 .unsol_event = alc260_hp_3013_unsol_event,
6417 .init_hook = alc260_hp_3013_automute,
6419 [ALC260_FUJITSU_S702X] = {
6420 .mixers = { alc260_fujitsu_mixer },
6421 .init_verbs = { alc260_fujitsu_init_verbs },
6422 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6423 .dac_nids = alc260_dac_nids,
6424 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6425 .adc_nids = alc260_dual_adc_nids,
6426 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6427 .channel_mode = alc260_modes,
6428 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6429 .input_mux = alc260_fujitsu_capture_sources,
6432 .mixers = { alc260_acer_mixer },
6433 .init_verbs = { alc260_acer_init_verbs },
6434 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6435 .dac_nids = alc260_dac_nids,
6436 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6437 .adc_nids = alc260_dual_adc_nids,
6438 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6439 .channel_mode = alc260_modes,
6440 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6441 .input_mux = alc260_acer_capture_sources,
6443 [ALC260_FAVORIT100] = {
6444 .mixers = { alc260_favorit100_mixer },
6445 .init_verbs = { alc260_favorit100_init_verbs },
6446 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6447 .dac_nids = alc260_dac_nids,
6448 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6449 .adc_nids = alc260_dual_adc_nids,
6450 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6451 .channel_mode = alc260_modes,
6452 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6453 .input_mux = alc260_favorit100_capture_sources,
6456 .mixers = { alc260_will_mixer },
6457 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6458 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6459 .dac_nids = alc260_dac_nids,
6460 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6461 .adc_nids = alc260_adc_nids,
6462 .dig_out_nid = ALC260_DIGOUT_NID,
6463 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6464 .channel_mode = alc260_modes,
6465 .input_mux = &alc260_capture_source,
6467 [ALC260_REPLACER_672V] = {
6468 .mixers = { alc260_replacer_672v_mixer },
6469 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6470 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6471 .dac_nids = alc260_dac_nids,
6472 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6473 .adc_nids = alc260_adc_nids,
6474 .dig_out_nid = ALC260_DIGOUT_NID,
6475 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6476 .channel_mode = alc260_modes,
6477 .input_mux = &alc260_capture_source,
6478 .unsol_event = alc260_replacer_672v_unsol_event,
6479 .init_hook = alc260_replacer_672v_automute,
6481 #ifdef CONFIG_SND_DEBUG
6483 .mixers = { alc260_test_mixer },
6484 .init_verbs = { alc260_test_init_verbs },
6485 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6486 .dac_nids = alc260_test_dac_nids,
6487 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6488 .adc_nids = alc260_test_adc_nids,
6489 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6490 .channel_mode = alc260_modes,
6491 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6492 .input_mux = alc260_test_capture_sources,
6497 static int patch_alc260(struct hda_codec *codec)
6499 struct alc_spec *spec;
6500 int err, board_config;
6502 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6508 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6511 if (board_config < 0) {
6512 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6514 board_config = ALC260_AUTO;
6517 if (board_config == ALC260_AUTO) {
6518 /* automatic parse from the BIOS config */
6519 err = alc260_parse_auto_config(codec);
6525 "hda_codec: Cannot set up configuration "
6526 "from BIOS. Using base mode...\n");
6527 board_config = ALC260_BASIC;
6531 err = snd_hda_attach_beep_device(codec, 0x1);
6537 if (board_config != ALC260_AUTO)
6538 setup_preset(codec, &alc260_presets[board_config]);
6540 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6541 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6543 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6544 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6546 if (!spec->adc_nids && spec->input_mux) {
6547 /* check whether NID 0x04 is valid */
6548 unsigned int wcap = get_wcaps(codec, 0x04);
6549 wcap = get_wcaps_type(wcap);
6551 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6552 spec->adc_nids = alc260_adc_nids_alt;
6553 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6555 spec->adc_nids = alc260_adc_nids;
6556 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6559 set_capture_mixer(codec);
6560 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6562 spec->vmaster_nid = 0x08;
6564 codec->patch_ops = alc_patch_ops;
6565 if (board_config == ALC260_AUTO)
6566 spec->init_hook = alc260_auto_init;
6567 #ifdef CONFIG_SND_HDA_POWER_SAVE
6568 if (!spec->loopback.amplist)
6569 spec->loopback.amplist = alc260_loopbacks;
6571 codec->proc_widget_hook = print_realtek_coef;
6578 * ALC882/883/885/888/889 support
6580 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6581 * configuration. Each pin widget can choose any input DACs and a mixer.
6582 * Each ADC is connected from a mixer of all inputs. This makes possible
6583 * 6-channel independent captures.
6585 * In addition, an independent DAC for the multi-playback (not used in this
6588 #define ALC882_DIGOUT_NID 0x06
6589 #define ALC882_DIGIN_NID 0x0a
6590 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6591 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6592 #define ALC1200_DIGOUT_NID 0x10
6595 static struct hda_channel_mode alc882_ch_modes[1] = {
6600 static hda_nid_t alc882_dac_nids[4] = {
6601 /* front, rear, clfe, rear_surr */
6602 0x02, 0x03, 0x04, 0x05
6604 #define alc883_dac_nids alc882_dac_nids
6607 #define alc882_adc_nids alc880_adc_nids
6608 #define alc882_adc_nids_alt alc880_adc_nids_alt
6609 #define alc883_adc_nids alc882_adc_nids_alt
6610 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6611 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6612 #define alc889_adc_nids alc880_adc_nids
6614 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6615 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6616 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6617 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6618 #define alc889_capsrc_nids alc882_capsrc_nids
6621 /* FIXME: should be a matrix-type input source selection */
6623 static struct hda_input_mux alc882_capture_source = {
6627 { "Front Mic", 0x1 },
6633 #define alc883_capture_source alc882_capture_source
6635 static struct hda_input_mux alc889_capture_source = {
6638 { "Front Mic", 0x0 },
6644 static struct hda_input_mux mb5_capture_source = {
6653 static struct hda_input_mux alc883_3stack_6ch_intel = {
6657 { "Front Mic", 0x0 },
6663 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6671 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6681 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6689 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6693 { "Front Mic", 0x1 },
6698 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6706 static struct hda_input_mux alc889A_mb31_capture_source = {
6710 /* Front Mic (0x01) unused */
6712 /* Line 2 (0x03) unused */
6713 /* CD (0x04) unused? */
6720 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6727 static struct hda_verb alc882_3ST_ch2_init[] = {
6728 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6729 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6730 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6731 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6738 static struct hda_verb alc882_3ST_ch4_init[] = {
6739 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6740 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6741 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6742 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6743 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6750 static struct hda_verb alc882_3ST_ch6_init[] = {
6751 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6752 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6753 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6754 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6755 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6756 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6760 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6761 { 2, alc882_3ST_ch2_init },
6762 { 4, alc882_3ST_ch4_init },
6763 { 6, alc882_3ST_ch6_init },
6766 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6771 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6772 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6773 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6774 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6775 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6776 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6783 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6784 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6785 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6786 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6787 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6788 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6789 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6796 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6797 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6798 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6799 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6800 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6801 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6802 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6803 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6807 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6808 { 2, alc883_3ST_ch2_clevo_init },
6809 { 4, alc883_3ST_ch4_clevo_init },
6810 { 6, alc883_3ST_ch6_clevo_init },
6817 static struct hda_verb alc882_sixstack_ch6_init[] = {
6818 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6819 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6820 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6821 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6828 static struct hda_verb alc882_sixstack_ch8_init[] = {
6829 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6830 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6831 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6832 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6836 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6837 { 6, alc882_sixstack_ch6_init },
6838 { 8, alc882_sixstack_ch8_init },
6842 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6848 static struct hda_verb alc885_mbp_ch2_init[] = {
6849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6850 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6851 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6858 static struct hda_verb alc885_mbp_ch4_init[] = {
6859 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6860 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6861 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6862 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6863 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6867 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6868 { 2, alc885_mbp_ch2_init },
6869 { 4, alc885_mbp_ch4_init },
6874 * Speakers/Woofer/HP = Front
6877 static struct hda_verb alc885_mb5_ch2_init[] = {
6878 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6885 * Speakers/HP = Front
6889 static struct hda_verb alc885_mb5_ch6_init[] = {
6890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6892 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6896 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6897 { 2, alc885_mb5_ch2_init },
6898 { 6, alc885_mb5_ch6_init },
6905 static struct hda_verb alc883_4ST_ch2_init[] = {
6906 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6907 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6908 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6909 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6910 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6911 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6918 static struct hda_verb alc883_4ST_ch4_init[] = {
6919 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6920 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6921 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6922 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6923 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6924 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6925 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6932 static struct hda_verb alc883_4ST_ch6_init[] = {
6933 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6934 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6935 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6936 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6937 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6938 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6939 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6940 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6947 static struct hda_verb alc883_4ST_ch8_init[] = {
6948 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6949 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6950 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6951 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6952 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6953 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6954 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6955 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6956 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6960 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6961 { 2, alc883_4ST_ch2_init },
6962 { 4, alc883_4ST_ch4_init },
6963 { 6, alc883_4ST_ch6_init },
6964 { 8, alc883_4ST_ch8_init },
6971 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6972 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6973 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6974 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6975 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6982 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6983 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6984 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6985 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6986 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6987 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6994 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6995 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6996 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6997 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6998 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6999 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7000 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7004 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7005 { 2, alc883_3ST_ch2_intel_init },
7006 { 4, alc883_3ST_ch4_intel_init },
7007 { 6, alc883_3ST_ch6_intel_init },
7013 static struct hda_verb alc889_ch2_intel_init[] = {
7014 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7015 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7016 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7017 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7018 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7019 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7026 static struct hda_verb alc889_ch6_intel_init[] = {
7027 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7028 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7029 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7030 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7031 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7032 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7039 static struct hda_verb alc889_ch8_intel_init[] = {
7040 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7041 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7042 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7043 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7044 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7045 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7046 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7050 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7051 { 2, alc889_ch2_intel_init },
7052 { 6, alc889_ch6_intel_init },
7053 { 8, alc889_ch8_intel_init },
7059 static struct hda_verb alc883_sixstack_ch6_init[] = {
7060 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7061 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7062 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7063 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7070 static struct hda_verb alc883_sixstack_ch8_init[] = {
7071 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7072 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7073 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7074 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7078 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7079 { 6, alc883_sixstack_ch6_init },
7080 { 8, alc883_sixstack_ch8_init },
7084 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7085 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7087 static struct snd_kcontrol_new alc882_base_mixer[] = {
7088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7090 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7091 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7092 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7093 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7094 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7095 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7096 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7097 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7099 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7100 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7102 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7104 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7106 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7107 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7108 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7112 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7113 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7114 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7115 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7116 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7118 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7119 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7120 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7121 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7122 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7123 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7127 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7128 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7129 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7130 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7131 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7132 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7133 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7134 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7135 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7136 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7137 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7139 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7140 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7141 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7145 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7146 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7147 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7148 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7149 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7150 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7151 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7153 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7154 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7159 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7160 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7161 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7162 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7163 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7165 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7167 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7172 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7173 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7174 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7177 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7182 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7183 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7184 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7185 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7189 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7190 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7192 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7193 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7194 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7195 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7196 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7201 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7202 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7205 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7209 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7210 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7211 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7212 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7213 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7214 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7216 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7218 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7223 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7225 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7226 .name = "Channel Mode",
7227 .info = alc_ch_mode_info,
7228 .get = alc_ch_mode_get,
7229 .put = alc_ch_mode_put,
7234 static struct hda_verb alc882_base_init_verbs[] = {
7235 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7236 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7237 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7238 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7240 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7241 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7246 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7248 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7249 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7250 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7252 /* mute analog input loopbacks */
7253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7256 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7257 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7259 /* Front Pin: output 0 (0x0c) */
7260 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7261 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7262 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7263 /* Rear Pin: output 1 (0x0d) */
7264 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7266 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7267 /* CLFE Pin: output 2 (0x0e) */
7268 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7269 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7270 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7271 /* Side Pin: output 3 (0x0f) */
7272 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7273 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7274 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7275 /* Mic (rear) pin: input vref at 80% */
7276 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7277 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7278 /* Front Mic pin: input vref at 80% */
7279 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7280 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7281 /* Line In pin: input */
7282 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7283 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7284 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7285 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7286 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7287 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7288 /* CD pin widget for input */
7289 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7291 /* FIXME: use matrix-type input source selection */
7292 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7303 /* ADC2: mute amp left and right */
7304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7305 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7306 /* ADC3: mute amp left and right */
7307 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7308 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7313 static struct hda_verb alc882_adc1_init_verbs[] = {
7314 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7319 /* ADC1: mute amp left and right */
7320 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7321 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7325 static struct hda_verb alc882_eapd_verbs[] = {
7326 /* change to EAPD mode */
7327 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7328 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7332 static struct hda_verb alc889_eapd_verbs[] = {
7333 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7334 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7338 static struct hda_verb alc_hp15_unsol_verbs[] = {
7339 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7344 static struct hda_verb alc885_init_verbs[] = {
7345 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7350 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7351 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7352 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7358 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7360 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7362 /* mute analog input loopbacks */
7363 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7364 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7365 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7367 /* Front HP Pin: output 0 (0x0c) */
7368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7370 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7371 /* Front Pin: output 0 (0x0c) */
7372 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7373 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7374 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7375 /* Rear Pin: output 1 (0x0d) */
7376 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7377 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7378 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7379 /* CLFE Pin: output 2 (0x0e) */
7380 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7381 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7382 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7383 /* Side Pin: output 3 (0x0f) */
7384 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7385 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7386 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7387 /* Mic (rear) pin: input vref at 80% */
7388 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7389 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7390 /* Front Mic pin: input vref at 80% */
7391 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7392 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7393 /* Line In pin: input */
7394 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7395 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7397 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7407 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7408 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7410 /* ADC2: mute amp left and right */
7411 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7412 /* ADC3: mute amp left and right */
7413 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7418 static struct hda_verb alc885_init_input_verbs[] = {
7419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7426 /* Unmute Selector 24h and set the default input to front mic */
7427 static struct hda_verb alc889_init_input_verbs[] = {
7428 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7429 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7434 #define alc883_init_verbs alc882_base_init_verbs
7437 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7438 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7439 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7440 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7441 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7442 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7443 /* FIXME: this looks suspicious...
7444 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7445 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7450 static struct hda_verb alc882_macpro_init_verbs[] = {
7451 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7453 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7455 /* Front Pin: output 0 (0x0c) */
7456 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7457 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7458 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7459 /* Front Mic pin: input vref at 80% */
7460 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7461 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7462 /* Speaker: output */
7463 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7464 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7465 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7466 /* Headphone output (output 0 - 0x0c) */
7467 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7468 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7469 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7471 /* FIXME: use matrix-type input source selection */
7472 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7473 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7476 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7477 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7480 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7481 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7482 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7485 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7486 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7487 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7488 /* ADC1: mute amp left and right */
7489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7490 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7491 /* ADC2: mute amp left and right */
7492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7493 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7494 /* ADC3: mute amp left and right */
7495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7496 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7502 static struct hda_verb alc885_mb5_init_verbs[] = {
7504 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7505 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7506 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7507 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7512 /* Surround mixer */
7513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7514 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7515 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7517 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7518 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7519 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7521 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7522 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7523 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7524 /* Front Pin (0x0c) */
7525 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7526 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7527 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7528 /* LFE Pin (0x0e) */
7529 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7530 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7531 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7533 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7534 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7535 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7536 /* Front Mic pin: input vref at 80% */
7537 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7538 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7540 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7545 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7546 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7550 /* Macbook Pro rev3 */
7551 static struct hda_verb alc885_mbp3_init_verbs[] = {
7552 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7557 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7558 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7559 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7561 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7562 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7563 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7564 /* Front Pin: output 0 (0x0c) */
7565 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7566 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7567 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7568 /* HP Pin: output 0 (0x0e) */
7569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7570 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7571 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7572 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7573 /* Mic (rear) pin: input vref at 80% */
7574 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7575 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7576 /* Front Mic pin: input vref at 80% */
7577 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7578 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7579 /* Line In pin: use output 1 when in LineOut mode */
7580 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7582 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7584 /* FIXME: use matrix-type input source selection */
7585 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7586 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7587 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7588 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7589 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7590 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7594 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7595 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7598 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7601 /* ADC1: mute amp left and right */
7602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7603 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7604 /* ADC2: mute amp left and right */
7605 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7606 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7607 /* ADC3: mute amp left and right */
7608 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7609 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7615 static struct hda_verb alc885_imac91_init_verbs[] = {
7616 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7621 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7624 /* HP Pin: output 0 (0x0c) */
7625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7626 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7627 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7628 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7629 /* Internal Speakers: output 0 (0x0d) */
7630 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7631 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7632 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7633 /* Mic (rear) pin: input vref at 80% */
7634 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7635 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7636 /* Front Mic pin: input vref at 80% */
7637 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7639 /* Line In pin: use output 1 when in LineOut mode */
7640 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7642 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7644 /* FIXME: use matrix-type input source selection */
7645 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7646 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7648 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7649 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7650 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7661 /* ADC1: mute amp left and right */
7662 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7663 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7664 /* ADC2: mute amp left and right */
7665 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7666 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7667 /* ADC3: mute amp left and right */
7668 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7669 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7674 /* iMac 24 mixer. */
7675 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7676 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7677 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7681 /* iMac 24 init verbs. */
7682 static struct hda_verb alc885_imac24_init_verbs[] = {
7683 /* Internal speakers: output 0 (0x0c) */
7684 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7685 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7686 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7687 /* Internal speakers: output 0 (0x0c) */
7688 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7689 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7690 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7691 /* Headphone: output 0 (0x0c) */
7692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7693 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7694 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7695 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7696 /* Front Mic: input vref at 80% */
7697 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7698 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7702 /* Toggle speaker-output according to the hp-jack state */
7703 static void alc885_imac24_setup(struct hda_codec *codec)
7705 struct alc_spec *spec = codec->spec;
7707 spec->autocfg.hp_pins[0] = 0x14;
7708 spec->autocfg.speaker_pins[0] = 0x18;
7709 spec->autocfg.speaker_pins[1] = 0x1a;
7712 static void alc885_mbp3_setup(struct hda_codec *codec)
7714 struct alc_spec *spec = codec->spec;
7716 spec->autocfg.hp_pins[0] = 0x15;
7717 spec->autocfg.speaker_pins[0] = 0x14;
7720 static void alc885_imac91_automute(struct hda_codec *codec)
7722 unsigned int present;
7724 present = snd_hda_codec_read(codec, 0x14, 0,
7725 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7726 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7727 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7728 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7729 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7733 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7736 /* Headphone insertion or removal. */
7737 if ((res >> 26) == ALC880_HP_EVENT)
7738 alc885_imac91_automute(codec);
7741 static struct hda_verb alc882_targa_verbs[] = {
7742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7745 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7746 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7748 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7749 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7750 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7752 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7756 /* toggle speaker-output according to the hp-jack state */
7757 static void alc882_targa_automute(struct hda_codec *codec)
7759 struct alc_spec *spec = codec->spec;
7760 alc_automute_amp(codec);
7761 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7762 spec->jack_present ? 1 : 3);
7765 static void alc882_targa_setup(struct hda_codec *codec)
7767 struct alc_spec *spec = codec->spec;
7769 spec->autocfg.hp_pins[0] = 0x14;
7770 spec->autocfg.speaker_pins[0] = 0x1b;
7773 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7775 if ((res >> 26) == ALC880_HP_EVENT)
7776 alc882_targa_automute(codec);
7779 static struct hda_verb alc882_asus_a7j_verbs[] = {
7780 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7781 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7784 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7785 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7787 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7788 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7789 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7791 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7792 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7793 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7797 static struct hda_verb alc882_asus_a7m_verbs[] = {
7798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7803 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7805 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7806 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7807 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7809 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7810 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7811 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7815 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7817 unsigned int gpiostate, gpiomask, gpiodir;
7819 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7820 AC_VERB_GET_GPIO_DATA, 0);
7823 gpiostate |= (1 << pin);
7825 gpiostate &= ~(1 << pin);
7827 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7828 AC_VERB_GET_GPIO_MASK, 0);
7829 gpiomask |= (1 << pin);
7831 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7832 AC_VERB_GET_GPIO_DIRECTION, 0);
7833 gpiodir |= (1 << pin);
7836 snd_hda_codec_write(codec, codec->afg, 0,
7837 AC_VERB_SET_GPIO_MASK, gpiomask);
7838 snd_hda_codec_write(codec, codec->afg, 0,
7839 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7843 snd_hda_codec_write(codec, codec->afg, 0,
7844 AC_VERB_SET_GPIO_DATA, gpiostate);
7847 /* set up GPIO at initialization */
7848 static void alc885_macpro_init_hook(struct hda_codec *codec)
7850 alc882_gpio_mute(codec, 0, 0);
7851 alc882_gpio_mute(codec, 1, 0);
7854 /* set up GPIO and update auto-muting at initialization */
7855 static void alc885_imac24_init_hook(struct hda_codec *codec)
7857 alc885_macpro_init_hook(codec);
7858 alc_automute_amp(codec);
7862 * generic initialization of ADC, input mixers and output mixers
7864 static struct hda_verb alc883_auto_init_verbs[] = {
7866 * Unmute ADC0-2 and set the default input to mic-in
7868 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7869 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7870 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7871 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7873 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7875 * Note: PASD motherboards uses the Line In 2 as the input for
7876 * front panel mic (mic 2)
7878 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7883 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7886 * Set up output mixers (0x0c - 0x0f)
7888 /* set vol=0 to output mixers */
7889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7892 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7893 /* set up input amps for analog loopback */
7894 /* Amp Indices: DAC = 0, mixer = 1 */
7895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7896 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7897 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7898 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7899 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7900 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7901 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7902 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7903 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7904 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7906 /* FIXME: use matrix-type input source selection */
7907 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7909 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7910 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7911 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7912 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7916 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7922 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7923 static struct hda_verb alc889A_mb31_ch2_init[] = {
7924 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7925 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7926 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7927 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7931 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7932 static struct hda_verb alc889A_mb31_ch4_init[] = {
7933 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7934 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7935 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7936 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7940 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7941 static struct hda_verb alc889A_mb31_ch5_init[] = {
7942 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7943 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7944 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7945 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7949 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7950 static struct hda_verb alc889A_mb31_ch6_init[] = {
7951 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7952 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7958 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7959 { 2, alc889A_mb31_ch2_init },
7960 { 4, alc889A_mb31_ch4_init },
7961 { 5, alc889A_mb31_ch5_init },
7962 { 6, alc889A_mb31_ch6_init },
7965 static struct hda_verb alc883_medion_eapd_verbs[] = {
7966 /* eanable EAPD on medion laptop */
7967 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7968 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7972 #define alc883_base_mixer alc882_base_mixer
7974 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7975 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7976 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7977 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7978 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7979 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7980 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7981 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7983 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7986 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7987 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7991 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7992 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7993 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7995 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7997 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7999 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8000 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8001 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8005 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8006 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8007 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8009 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8013 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8015 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8019 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8020 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8021 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8022 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8023 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8024 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8025 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8026 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8028 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8029 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8030 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8031 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8032 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8036 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8037 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8038 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8039 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8040 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8041 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8042 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8043 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8044 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8045 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8046 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8047 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8049 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8050 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8052 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8053 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8054 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8055 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8059 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8060 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8061 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8062 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8063 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8064 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8066 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8067 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8068 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8069 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8070 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8071 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8072 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8073 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8074 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8076 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8077 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8079 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8083 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8084 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8085 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8086 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8087 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8088 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8090 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8091 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8092 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8093 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8094 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8095 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8096 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8097 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8100 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8103 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8107 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8108 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8109 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8110 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8111 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8112 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8113 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8114 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8115 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8117 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8118 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8119 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8120 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8122 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8123 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8125 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8126 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8130 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8131 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8132 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8134 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8135 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8136 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8137 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8138 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8139 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8140 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8151 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8152 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8153 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8155 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8156 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8157 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8159 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8160 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8161 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8162 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8163 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8167 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8168 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8169 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8172 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8176 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8177 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8178 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8179 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8180 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8181 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8183 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8188 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8189 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8190 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8192 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8193 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8196 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8197 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8201 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8202 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8204 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8205 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8206 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8208 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8209 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8210 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8214 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8216 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8221 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8226 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8229 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8230 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8231 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8232 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8233 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8234 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8236 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8241 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8244 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8245 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8246 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8247 0x0d, 1, 0x0, HDA_OUTPUT),
8248 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8249 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8250 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8252 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8253 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8254 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8255 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8256 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8257 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8258 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8259 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8260 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8261 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8262 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8266 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8268 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8269 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8270 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8271 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8272 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8274 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8275 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8276 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8277 /* Output switches */
8278 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8279 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8280 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8282 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8283 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8285 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8287 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8288 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8292 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8293 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8294 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8295 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8297 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8302 static struct hda_bind_ctls alc883_bind_cap_vol = {
8303 .ops = &snd_hda_bind_vol,
8305 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8306 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8311 static struct hda_bind_ctls alc883_bind_cap_switch = {
8312 .ops = &snd_hda_bind_sw,
8314 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8315 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8320 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8321 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8322 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8323 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8324 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8325 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8327 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8332 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8333 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8334 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8336 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8337 /* .name = "Capture Source", */
8338 .name = "Input Source",
8340 .info = alc_mux_enum_info,
8341 .get = alc_mux_enum_get,
8342 .put = alc_mux_enum_put,
8347 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8349 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8350 .name = "Channel Mode",
8351 .info = alc_ch_mode_info,
8352 .get = alc_ch_mode_get,
8353 .put = alc_ch_mode_put,
8358 /* toggle speaker-output according to the hp-jack state */
8359 static void alc883_mitac_setup(struct hda_codec *codec)
8361 struct alc_spec *spec = codec->spec;
8363 spec->autocfg.hp_pins[0] = 0x15;
8364 spec->autocfg.speaker_pins[0] = 0x14;
8365 spec->autocfg.speaker_pins[1] = 0x17;
8368 /* auto-toggle front mic */
8370 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8372 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8374 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8378 static struct hda_verb alc883_mitac_verbs[] = {
8380 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8381 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8383 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8384 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8386 /* enable unsolicited event */
8387 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8388 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8393 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8395 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8398 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8400 /* enable unsolicited event */
8402 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8403 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8409 static struct hda_verb alc883_clevo_m720_verbs[] = {
8411 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8414 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8415 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8417 /* enable unsolicited event */
8418 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8419 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8424 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8426 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8427 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8429 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8430 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8432 /* enable unsolicited event */
8433 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8438 static struct hda_verb alc883_targa_verbs[] = {
8439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8440 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8443 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8445 /* Connect Line-Out side jack (SPDIF) to Side */
8446 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8447 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8448 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8449 /* Connect Mic jack to CLFE */
8450 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8451 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8452 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8453 /* Connect Line-in jack to Surround */
8454 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8455 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8456 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8457 /* Connect HP out jack to Front */
8458 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8459 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8460 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8462 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8467 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8468 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8469 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8470 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8474 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8475 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8476 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8477 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8478 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8482 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8483 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8484 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8485 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8486 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8487 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8491 static struct hda_verb alc883_haier_w66_verbs[] = {
8492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8497 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8498 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8499 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8500 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8504 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8507 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8508 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8509 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8510 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8511 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8512 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8516 static struct hda_verb alc888_6st_dell_verbs[] = {
8517 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8521 static struct hda_verb alc883_vaiott_verbs[] = {
8523 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8524 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8526 /* enable unsolicited event */
8527 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8532 static void alc888_3st_hp_setup(struct hda_codec *codec)
8534 struct alc_spec *spec = codec->spec;
8536 spec->autocfg.hp_pins[0] = 0x1b;
8537 spec->autocfg.speaker_pins[0] = 0x14;
8538 spec->autocfg.speaker_pins[1] = 0x16;
8539 spec->autocfg.speaker_pins[2] = 0x18;
8542 static struct hda_verb alc888_3st_hp_verbs[] = {
8543 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8544 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8545 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8546 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8553 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8554 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8555 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8556 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8557 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8564 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8565 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8566 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8567 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8568 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8569 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8576 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8577 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8578 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8579 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8580 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8581 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8582 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8586 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8587 { 2, alc888_3st_hp_2ch_init },
8588 { 4, alc888_3st_hp_4ch_init },
8589 { 6, alc888_3st_hp_6ch_init },
8592 /* toggle front-jack and RCA according to the hp-jack state */
8593 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8595 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
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, 0x15, HDA_OUTPUT, 0,
8600 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8603 /* toggle RCA according to the front-jack state */
8604 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8606 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8608 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8609 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8612 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8615 if ((res >> 26) == ALC880_HP_EVENT)
8616 alc888_lenovo_ms7195_front_automute(codec);
8617 if ((res >> 26) == ALC880_FRONT_EVENT)
8618 alc888_lenovo_ms7195_rca_automute(codec);
8621 static struct hda_verb alc883_medion_md2_verbs[] = {
8622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8627 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8631 /* toggle speaker-output according to the hp-jack state */
8632 static void alc883_medion_md2_setup(struct hda_codec *codec)
8634 struct alc_spec *spec = codec->spec;
8636 spec->autocfg.hp_pins[0] = 0x14;
8637 spec->autocfg.speaker_pins[0] = 0x15;
8640 /* toggle speaker-output according to the hp-jack state */
8641 #define alc883_targa_init_hook alc882_targa_init_hook
8642 #define alc883_targa_unsol_event alc882_targa_unsol_event
8644 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8646 unsigned int present;
8648 present = snd_hda_jack_detect(codec, 0x18);
8649 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8650 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8653 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8655 struct alc_spec *spec = codec->spec;
8657 spec->autocfg.hp_pins[0] = 0x15;
8658 spec->autocfg.speaker_pins[0] = 0x14;
8661 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8663 alc_automute_amp(codec);
8664 alc883_clevo_m720_mic_automute(codec);
8667 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8670 switch (res >> 26) {
8671 case ALC880_MIC_EVENT:
8672 alc883_clevo_m720_mic_automute(codec);
8675 alc_automute_amp_unsol_event(codec, res);
8680 /* toggle speaker-output according to the hp-jack state */
8681 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8683 struct alc_spec *spec = codec->spec;
8685 spec->autocfg.hp_pins[0] = 0x14;
8686 spec->autocfg.speaker_pins[0] = 0x15;
8689 static void alc883_haier_w66_setup(struct hda_codec *codec)
8691 struct alc_spec *spec = codec->spec;
8693 spec->autocfg.hp_pins[0] = 0x1b;
8694 spec->autocfg.speaker_pins[0] = 0x14;
8697 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8699 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8701 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8702 HDA_AMP_MUTE, bits);
8705 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8707 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8709 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8710 HDA_AMP_MUTE, bits);
8711 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8712 HDA_AMP_MUTE, bits);
8715 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8718 if ((res >> 26) == ALC880_HP_EVENT)
8719 alc883_lenovo_101e_all_automute(codec);
8720 if ((res >> 26) == ALC880_FRONT_EVENT)
8721 alc883_lenovo_101e_ispeaker_automute(codec);
8724 /* toggle speaker-output according to the hp-jack state */
8725 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8727 struct alc_spec *spec = codec->spec;
8729 spec->autocfg.hp_pins[0] = 0x14;
8730 spec->autocfg.speaker_pins[0] = 0x15;
8731 spec->autocfg.speaker_pins[1] = 0x16;
8734 static struct hda_verb alc883_acer_eapd_verbs[] = {
8735 /* HP Pin: output 0 (0x0c) */
8736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8737 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8738 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8739 /* Front Pin: output 0 (0x0c) */
8740 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8741 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8742 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8743 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8744 /* eanable EAPD on medion laptop */
8745 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8746 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8747 /* enable unsolicited event */
8748 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8752 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8753 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8754 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8755 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8759 static void alc888_6st_dell_setup(struct hda_codec *codec)
8761 struct alc_spec *spec = codec->spec;
8763 spec->autocfg.hp_pins[0] = 0x1b;
8764 spec->autocfg.speaker_pins[0] = 0x14;
8765 spec->autocfg.speaker_pins[1] = 0x15;
8766 spec->autocfg.speaker_pins[2] = 0x16;
8767 spec->autocfg.speaker_pins[3] = 0x17;
8770 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8772 struct alc_spec *spec = codec->spec;
8774 spec->autocfg.hp_pins[0] = 0x1b;
8775 spec->autocfg.speaker_pins[0] = 0x14;
8776 spec->autocfg.speaker_pins[1] = 0x15;
8777 spec->autocfg.speaker_pins[2] = 0x16;
8778 spec->autocfg.speaker_pins[3] = 0x17;
8779 spec->autocfg.speaker_pins[4] = 0x1a;
8782 static void alc883_vaiott_setup(struct hda_codec *codec)
8784 struct alc_spec *spec = codec->spec;
8786 spec->autocfg.hp_pins[0] = 0x15;
8787 spec->autocfg.speaker_pins[0] = 0x14;
8788 spec->autocfg.speaker_pins[1] = 0x17;
8791 static struct hda_verb alc888_asus_m90v_verbs[] = {
8792 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8793 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8794 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8795 /* enable unsolicited event */
8796 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8797 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8801 static void alc883_mode2_setup(struct hda_codec *codec)
8803 struct alc_spec *spec = codec->spec;
8805 spec->autocfg.hp_pins[0] = 0x1b;
8806 spec->autocfg.speaker_pins[0] = 0x14;
8807 spec->autocfg.speaker_pins[1] = 0x15;
8808 spec->autocfg.speaker_pins[2] = 0x16;
8809 spec->ext_mic.pin = 0x18;
8810 spec->int_mic.pin = 0x19;
8811 spec->ext_mic.mux_idx = 0;
8812 spec->int_mic.mux_idx = 1;
8816 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8817 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8818 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8820 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8821 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8822 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8823 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8824 /* enable unsolicited event */
8825 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8829 static void alc883_eee1601_inithook(struct hda_codec *codec)
8831 struct alc_spec *spec = codec->spec;
8833 spec->autocfg.hp_pins[0] = 0x14;
8834 spec->autocfg.speaker_pins[0] = 0x1b;
8835 alc_automute_pin(codec);
8838 static struct hda_verb alc889A_mb31_verbs[] = {
8839 /* Init rear pin (used as headphone output) */
8840 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8841 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8842 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8843 /* Init line pin (used as output in 4ch and 6ch mode) */
8844 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8845 /* Init line 2 pin (used as headphone out by default) */
8846 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8847 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8851 /* Mute speakers according to the headphone jack state */
8852 static void alc889A_mb31_automute(struct hda_codec *codec)
8854 unsigned int present;
8856 /* Mute only in 2ch or 4ch mode */
8857 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8859 present = snd_hda_jack_detect(codec, 0x15);
8860 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8861 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8862 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8863 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8867 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8869 if ((res >> 26) == ALC880_HP_EVENT)
8870 alc889A_mb31_automute(codec);
8874 #ifdef CONFIG_SND_HDA_POWER_SAVE
8875 #define alc882_loopbacks alc880_loopbacks
8878 /* pcm configuration: identical with ALC880 */
8879 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8880 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8881 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8882 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8884 static hda_nid_t alc883_slave_dig_outs[] = {
8885 ALC1200_DIGOUT_NID, 0,
8888 static hda_nid_t alc1200_slave_dig_outs[] = {
8889 ALC883_DIGOUT_NID, 0,
8893 * configuration and preset
8895 static const char *alc882_models[ALC882_MODEL_LAST] = {
8896 [ALC882_3ST_DIG] = "3stack-dig",
8897 [ALC882_6ST_DIG] = "6stack-dig",
8898 [ALC882_ARIMA] = "arima",
8899 [ALC882_W2JC] = "w2jc",
8900 [ALC882_TARGA] = "targa",
8901 [ALC882_ASUS_A7J] = "asus-a7j",
8902 [ALC882_ASUS_A7M] = "asus-a7m",
8903 [ALC885_MACPRO] = "macpro",
8904 [ALC885_MB5] = "mb5",
8905 [ALC885_MBP3] = "mbp3",
8906 [ALC885_IMAC24] = "imac24",
8907 [ALC885_IMAC91] = "imac91",
8908 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8909 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8910 [ALC883_3ST_6ch] = "3stack-6ch",
8911 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8912 [ALC883_TARGA_DIG] = "targa-dig",
8913 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8914 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8915 [ALC883_ACER] = "acer",
8916 [ALC883_ACER_ASPIRE] = "acer-aspire",
8917 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8918 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8919 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8920 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8921 [ALC883_MEDION] = "medion",
8922 [ALC883_MEDION_MD2] = "medion-md2",
8923 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8924 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8925 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8926 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8927 [ALC888_LENOVO_SKY] = "lenovo-sky",
8928 [ALC883_HAIER_W66] = "haier-w66",
8929 [ALC888_3ST_HP] = "3stack-hp",
8930 [ALC888_6ST_DELL] = "6stack-dell",
8931 [ALC883_MITAC] = "mitac",
8932 [ALC883_CLEVO_M540R] = "clevo-m540r",
8933 [ALC883_CLEVO_M720] = "clevo-m720",
8934 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8935 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8936 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8937 [ALC889A_INTEL] = "intel-alc889a",
8938 [ALC889_INTEL] = "intel-x58",
8939 [ALC1200_ASUS_P5Q] = "asus-p5q",
8940 [ALC889A_MB31] = "mb31",
8941 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8942 [ALC882_AUTO] = "auto",
8945 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8946 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8948 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8949 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8950 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8951 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8952 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8953 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8954 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8955 ALC888_ACER_ASPIRE_4930G),
8956 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8957 ALC888_ACER_ASPIRE_4930G),
8958 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8959 ALC888_ACER_ASPIRE_8930G),
8960 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8961 ALC888_ACER_ASPIRE_8930G),
8962 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8963 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8964 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8965 ALC888_ACER_ASPIRE_6530G),
8966 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8967 ALC888_ACER_ASPIRE_6530G),
8968 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8969 ALC888_ACER_ASPIRE_7730G),
8970 /* default Acer -- disabled as it causes more problems.
8971 * model=auto should work fine now
8973 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8975 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8977 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8978 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8979 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8980 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8981 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8982 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8984 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8985 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8986 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8987 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8988 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8989 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8990 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8991 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8992 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8993 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8994 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8996 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8997 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8998 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8999 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9000 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9001 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9002 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9003 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9004 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9006 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9007 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9008 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9009 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9010 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
9011 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9012 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9013 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9014 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9015 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9016 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9017 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9018 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9019 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9020 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9021 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9022 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9023 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9024 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9025 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9026 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9027 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9028 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9029 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9030 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9031 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9032 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9033 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9034 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9036 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9037 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9038 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9039 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9040 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9041 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9042 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9043 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9044 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9045 ALC883_FUJITSU_PI2515),
9046 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9047 ALC888_FUJITSU_XA3530),
9048 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9049 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9050 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9051 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9052 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9053 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9054 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9055 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9056 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9058 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9059 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9060 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9061 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9062 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9063 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9064 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9069 /* codec SSID table for Intel Mac */
9070 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9071 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9072 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9073 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9074 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9075 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9076 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9077 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9078 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9079 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9080 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9081 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9082 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9083 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9084 * so apparently no perfect solution yet
9086 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9087 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9091 static struct alc_config_preset alc882_presets[] = {
9092 [ALC882_3ST_DIG] = {
9093 .mixers = { alc882_base_mixer },
9094 .init_verbs = { alc882_base_init_verbs,
9095 alc882_adc1_init_verbs },
9096 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9097 .dac_nids = alc882_dac_nids,
9098 .dig_out_nid = ALC882_DIGOUT_NID,
9099 .dig_in_nid = ALC882_DIGIN_NID,
9100 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9101 .channel_mode = alc882_ch_modes,
9103 .input_mux = &alc882_capture_source,
9105 [ALC882_6ST_DIG] = {
9106 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9107 .init_verbs = { alc882_base_init_verbs,
9108 alc882_adc1_init_verbs },
9109 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9110 .dac_nids = alc882_dac_nids,
9111 .dig_out_nid = ALC882_DIGOUT_NID,
9112 .dig_in_nid = ALC882_DIGIN_NID,
9113 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9114 .channel_mode = alc882_sixstack_modes,
9115 .input_mux = &alc882_capture_source,
9118 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9119 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9120 alc882_eapd_verbs },
9121 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9122 .dac_nids = alc882_dac_nids,
9123 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9124 .channel_mode = alc882_sixstack_modes,
9125 .input_mux = &alc882_capture_source,
9128 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9129 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9130 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9131 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9132 .dac_nids = alc882_dac_nids,
9133 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9134 .channel_mode = alc880_threestack_modes,
9136 .input_mux = &alc882_capture_source,
9137 .dig_out_nid = ALC882_DIGOUT_NID,
9140 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9141 .init_verbs = { alc885_mbp3_init_verbs,
9142 alc880_gpio1_init_verbs },
9144 .dac_nids = alc882_dac_nids,
9146 .channel_mode = alc885_mbp_4ch_modes,
9147 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9148 .input_mux = &alc882_capture_source,
9149 .dig_out_nid = ALC882_DIGOUT_NID,
9150 .dig_in_nid = ALC882_DIGIN_NID,
9151 .unsol_event = alc_automute_amp_unsol_event,
9152 .setup = alc885_mbp3_setup,
9153 .init_hook = alc_automute_amp,
9156 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9157 .init_verbs = { alc885_mb5_init_verbs,
9158 alc880_gpio1_init_verbs },
9159 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9160 .dac_nids = alc882_dac_nids,
9161 .channel_mode = alc885_mb5_6ch_modes,
9162 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9163 .input_mux = &mb5_capture_source,
9164 .dig_out_nid = ALC882_DIGOUT_NID,
9165 .dig_in_nid = ALC882_DIGIN_NID,
9168 .mixers = { alc882_macpro_mixer },
9169 .init_verbs = { alc882_macpro_init_verbs },
9170 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9171 .dac_nids = alc882_dac_nids,
9172 .dig_out_nid = ALC882_DIGOUT_NID,
9173 .dig_in_nid = ALC882_DIGIN_NID,
9174 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9175 .channel_mode = alc882_ch_modes,
9176 .input_mux = &alc882_capture_source,
9177 .init_hook = alc885_macpro_init_hook,
9180 .mixers = { alc885_imac24_mixer },
9181 .init_verbs = { alc885_imac24_init_verbs },
9182 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9183 .dac_nids = alc882_dac_nids,
9184 .dig_out_nid = ALC882_DIGOUT_NID,
9185 .dig_in_nid = ALC882_DIGIN_NID,
9186 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9187 .channel_mode = alc882_ch_modes,
9188 .input_mux = &alc882_capture_source,
9189 .unsol_event = alc_automute_amp_unsol_event,
9190 .setup = alc885_imac24_setup,
9191 .init_hook = alc885_imac24_init_hook,
9194 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9195 .init_verbs = { alc885_imac91_init_verbs,
9196 alc880_gpio1_init_verbs },
9197 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9198 .dac_nids = alc882_dac_nids,
9199 .channel_mode = alc885_mbp_4ch_modes,
9200 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9201 .input_mux = &alc882_capture_source,
9202 .dig_out_nid = ALC882_DIGOUT_NID,
9203 .dig_in_nid = ALC882_DIGIN_NID,
9204 .unsol_event = alc885_imac91_unsol_event,
9205 .init_hook = alc885_imac91_automute,
9208 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9209 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9210 alc880_gpio3_init_verbs, alc882_targa_verbs},
9211 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9212 .dac_nids = alc882_dac_nids,
9213 .dig_out_nid = ALC882_DIGOUT_NID,
9214 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9215 .adc_nids = alc882_adc_nids,
9216 .capsrc_nids = alc882_capsrc_nids,
9217 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9218 .channel_mode = alc882_3ST_6ch_modes,
9220 .input_mux = &alc882_capture_source,
9221 .unsol_event = alc882_targa_unsol_event,
9222 .setup = alc882_targa_setup,
9223 .init_hook = alc882_targa_automute,
9225 [ALC882_ASUS_A7J] = {
9226 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9227 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9228 alc882_asus_a7j_verbs},
9229 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9230 .dac_nids = alc882_dac_nids,
9231 .dig_out_nid = ALC882_DIGOUT_NID,
9232 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9233 .adc_nids = alc882_adc_nids,
9234 .capsrc_nids = alc882_capsrc_nids,
9235 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9236 .channel_mode = alc882_3ST_6ch_modes,
9238 .input_mux = &alc882_capture_source,
9240 [ALC882_ASUS_A7M] = {
9241 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9242 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9243 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9244 alc882_asus_a7m_verbs },
9245 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9246 .dac_nids = alc882_dac_nids,
9247 .dig_out_nid = ALC882_DIGOUT_NID,
9248 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9249 .channel_mode = alc880_threestack_modes,
9251 .input_mux = &alc882_capture_source,
9253 [ALC883_3ST_2ch_DIG] = {
9254 .mixers = { alc883_3ST_2ch_mixer },
9255 .init_verbs = { alc883_init_verbs },
9256 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9257 .dac_nids = alc883_dac_nids,
9258 .dig_out_nid = ALC883_DIGOUT_NID,
9259 .dig_in_nid = ALC883_DIGIN_NID,
9260 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9261 .channel_mode = alc883_3ST_2ch_modes,
9262 .input_mux = &alc883_capture_source,
9264 [ALC883_3ST_6ch_DIG] = {
9265 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9266 .init_verbs = { alc883_init_verbs },
9267 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9268 .dac_nids = alc883_dac_nids,
9269 .dig_out_nid = ALC883_DIGOUT_NID,
9270 .dig_in_nid = ALC883_DIGIN_NID,
9271 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9272 .channel_mode = alc883_3ST_6ch_modes,
9274 .input_mux = &alc883_capture_source,
9276 [ALC883_3ST_6ch] = {
9277 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9278 .init_verbs = { alc883_init_verbs },
9279 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9280 .dac_nids = alc883_dac_nids,
9281 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9282 .channel_mode = alc883_3ST_6ch_modes,
9284 .input_mux = &alc883_capture_source,
9286 [ALC883_3ST_6ch_INTEL] = {
9287 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9288 .init_verbs = { alc883_init_verbs },
9289 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9290 .dac_nids = alc883_dac_nids,
9291 .dig_out_nid = ALC883_DIGOUT_NID,
9292 .dig_in_nid = ALC883_DIGIN_NID,
9293 .slave_dig_outs = alc883_slave_dig_outs,
9294 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9295 .channel_mode = alc883_3ST_6ch_intel_modes,
9297 .input_mux = &alc883_3stack_6ch_intel,
9300 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9301 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9302 alc_hp15_unsol_verbs },
9303 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9304 .dac_nids = alc883_dac_nids,
9305 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9306 .adc_nids = alc889_adc_nids,
9307 .dig_out_nid = ALC883_DIGOUT_NID,
9308 .dig_in_nid = ALC883_DIGIN_NID,
9309 .slave_dig_outs = alc883_slave_dig_outs,
9310 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9311 .channel_mode = alc889_8ch_intel_modes,
9312 .capsrc_nids = alc889_capsrc_nids,
9313 .input_mux = &alc889_capture_source,
9314 .setup = alc889_automute_setup,
9315 .init_hook = alc_automute_amp,
9316 .unsol_event = alc_automute_amp_unsol_event,
9320 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9321 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9322 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9323 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9324 .dac_nids = alc883_dac_nids,
9325 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9326 .adc_nids = alc889_adc_nids,
9327 .dig_out_nid = ALC883_DIGOUT_NID,
9328 .dig_in_nid = ALC883_DIGIN_NID,
9329 .slave_dig_outs = alc883_slave_dig_outs,
9330 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9331 .channel_mode = alc889_8ch_intel_modes,
9332 .capsrc_nids = alc889_capsrc_nids,
9333 .input_mux = &alc889_capture_source,
9334 .setup = alc889_automute_setup,
9335 .init_hook = alc889_intel_init_hook,
9336 .unsol_event = alc_automute_amp_unsol_event,
9339 [ALC883_6ST_DIG] = {
9340 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9341 .init_verbs = { alc883_init_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,
9350 [ALC883_TARGA_DIG] = {
9351 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9352 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9353 alc883_targa_verbs},
9354 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9355 .dac_nids = alc883_dac_nids,
9356 .dig_out_nid = ALC883_DIGOUT_NID,
9357 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9358 .channel_mode = alc883_3ST_6ch_modes,
9360 .input_mux = &alc883_capture_source,
9361 .unsol_event = alc883_targa_unsol_event,
9362 .setup = alc882_targa_setup,
9363 .init_hook = alc882_targa_automute,
9365 [ALC883_TARGA_2ch_DIG] = {
9366 .mixers = { alc883_targa_2ch_mixer},
9367 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9368 alc883_targa_verbs},
9369 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9370 .dac_nids = alc883_dac_nids,
9371 .adc_nids = alc883_adc_nids_alt,
9372 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9373 .dig_out_nid = ALC883_DIGOUT_NID,
9374 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9375 .channel_mode = alc883_3ST_2ch_modes,
9376 .input_mux = &alc883_capture_source,
9377 .unsol_event = alc883_targa_unsol_event,
9378 .setup = alc882_targa_setup,
9379 .init_hook = alc882_targa_automute,
9381 [ALC883_TARGA_8ch_DIG] = {
9382 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9383 alc883_chmode_mixer },
9384 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9385 alc883_targa_verbs },
9386 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9387 .dac_nids = alc883_dac_nids,
9388 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9389 .adc_nids = alc883_adc_nids_rev,
9390 .capsrc_nids = alc883_capsrc_nids_rev,
9391 .dig_out_nid = ALC883_DIGOUT_NID,
9392 .dig_in_nid = ALC883_DIGIN_NID,
9393 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9394 .channel_mode = alc883_4ST_8ch_modes,
9396 .input_mux = &alc883_capture_source,
9397 .unsol_event = alc883_targa_unsol_event,
9398 .setup = alc882_targa_setup,
9399 .init_hook = alc882_targa_automute,
9402 .mixers = { alc883_base_mixer },
9403 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9404 * and the headphone jack. Turn this on and rely on the
9405 * standard mute methods whenever the user wants to turn
9406 * these outputs off.
9408 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9409 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9410 .dac_nids = alc883_dac_nids,
9411 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9412 .channel_mode = alc883_3ST_2ch_modes,
9413 .input_mux = &alc883_capture_source,
9415 [ALC883_ACER_ASPIRE] = {
9416 .mixers = { alc883_acer_aspire_mixer },
9417 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9418 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9419 .dac_nids = alc883_dac_nids,
9420 .dig_out_nid = ALC883_DIGOUT_NID,
9421 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9422 .channel_mode = alc883_3ST_2ch_modes,
9423 .input_mux = &alc883_capture_source,
9424 .unsol_event = alc_automute_amp_unsol_event,
9425 .setup = alc883_acer_aspire_setup,
9426 .init_hook = alc_automute_amp,
9428 [ALC888_ACER_ASPIRE_4930G] = {
9429 .mixers = { alc888_base_mixer,
9430 alc883_chmode_mixer },
9431 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9432 alc888_acer_aspire_4930g_verbs },
9433 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9434 .dac_nids = alc883_dac_nids,
9435 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9436 .adc_nids = alc883_adc_nids_rev,
9437 .capsrc_nids = alc883_capsrc_nids_rev,
9438 .dig_out_nid = ALC883_DIGOUT_NID,
9439 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9440 .channel_mode = alc883_3ST_6ch_modes,
9443 ARRAY_SIZE(alc888_2_capture_sources),
9444 .input_mux = alc888_2_capture_sources,
9445 .unsol_event = alc_automute_amp_unsol_event,
9446 .setup = alc888_acer_aspire_4930g_setup,
9447 .init_hook = alc_automute_amp,
9449 [ALC888_ACER_ASPIRE_6530G] = {
9450 .mixers = { alc888_acer_aspire_6530_mixer },
9451 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9452 alc888_acer_aspire_6530g_verbs },
9453 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9454 .dac_nids = alc883_dac_nids,
9455 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9456 .adc_nids = alc883_adc_nids_rev,
9457 .capsrc_nids = alc883_capsrc_nids_rev,
9458 .dig_out_nid = ALC883_DIGOUT_NID,
9459 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9460 .channel_mode = alc883_3ST_2ch_modes,
9462 ARRAY_SIZE(alc888_2_capture_sources),
9463 .input_mux = alc888_acer_aspire_6530_sources,
9464 .unsol_event = alc_automute_amp_unsol_event,
9465 .setup = alc888_acer_aspire_6530g_setup,
9466 .init_hook = alc_automute_amp,
9468 [ALC888_ACER_ASPIRE_8930G] = {
9469 .mixers = { alc888_base_mixer,
9470 alc883_chmode_mixer },
9471 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9472 alc889_acer_aspire_8930g_verbs },
9473 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9474 .dac_nids = alc883_dac_nids,
9475 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9476 .adc_nids = alc889_adc_nids,
9477 .capsrc_nids = alc889_capsrc_nids,
9478 .dig_out_nid = ALC883_DIGOUT_NID,
9479 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9480 .channel_mode = alc883_3ST_6ch_modes,
9482 .const_channel_count = 6,
9484 ARRAY_SIZE(alc889_capture_sources),
9485 .input_mux = alc889_capture_sources,
9486 .unsol_event = alc_automute_amp_unsol_event,
9487 .setup = alc889_acer_aspire_8930g_setup,
9488 .init_hook = alc_automute_amp,
9490 [ALC888_ACER_ASPIRE_7730G] = {
9491 .mixers = { alc883_3ST_6ch_mixer,
9492 alc883_chmode_mixer },
9493 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9494 alc888_acer_aspire_7730G_verbs },
9495 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9496 .dac_nids = alc883_dac_nids,
9497 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9498 .adc_nids = alc883_adc_nids_rev,
9499 .capsrc_nids = alc883_capsrc_nids_rev,
9500 .dig_out_nid = ALC883_DIGOUT_NID,
9501 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9502 .channel_mode = alc883_3ST_6ch_modes,
9504 .const_channel_count = 6,
9505 .input_mux = &alc883_capture_source,
9506 .unsol_event = alc_automute_amp_unsol_event,
9507 .setup = alc888_acer_aspire_6530g_setup,
9508 .init_hook = alc_automute_amp,
9511 .mixers = { alc883_fivestack_mixer,
9512 alc883_chmode_mixer },
9513 .init_verbs = { alc883_init_verbs,
9514 alc883_medion_eapd_verbs },
9515 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9516 .dac_nids = alc883_dac_nids,
9517 .adc_nids = alc883_adc_nids_alt,
9518 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9519 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9520 .channel_mode = alc883_sixstack_modes,
9521 .input_mux = &alc883_capture_source,
9523 [ALC883_MEDION_MD2] = {
9524 .mixers = { alc883_medion_md2_mixer},
9525 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9527 .dac_nids = alc883_dac_nids,
9528 .dig_out_nid = ALC883_DIGOUT_NID,
9529 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9530 .channel_mode = alc883_3ST_2ch_modes,
9531 .input_mux = &alc883_capture_source,
9532 .unsol_event = alc_automute_amp_unsol_event,
9533 .setup = alc883_medion_md2_setup,
9534 .init_hook = alc_automute_amp,
9536 [ALC883_LAPTOP_EAPD] = {
9537 .mixers = { alc883_base_mixer },
9538 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9539 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9540 .dac_nids = alc883_dac_nids,
9541 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9542 .channel_mode = alc883_3ST_2ch_modes,
9543 .input_mux = &alc883_capture_source,
9545 [ALC883_CLEVO_M540R] = {
9546 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9547 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9548 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9549 .dac_nids = alc883_dac_nids,
9550 .dig_out_nid = ALC883_DIGOUT_NID,
9551 .dig_in_nid = ALC883_DIGIN_NID,
9552 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9553 .channel_mode = alc883_3ST_6ch_clevo_modes,
9555 .input_mux = &alc883_capture_source,
9556 /* This machine has the hardware HP auto-muting, thus
9557 * we need no software mute via unsol event
9560 [ALC883_CLEVO_M720] = {
9561 .mixers = { alc883_clevo_m720_mixer },
9562 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9563 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9564 .dac_nids = alc883_dac_nids,
9565 .dig_out_nid = ALC883_DIGOUT_NID,
9566 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9567 .channel_mode = alc883_3ST_2ch_modes,
9568 .input_mux = &alc883_capture_source,
9569 .unsol_event = alc883_clevo_m720_unsol_event,
9570 .setup = alc883_clevo_m720_setup,
9571 .init_hook = alc883_clevo_m720_init_hook,
9573 [ALC883_LENOVO_101E_2ch] = {
9574 .mixers = { alc883_lenovo_101e_2ch_mixer},
9575 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9576 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9577 .dac_nids = alc883_dac_nids,
9578 .adc_nids = alc883_adc_nids_alt,
9579 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9580 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9581 .channel_mode = alc883_3ST_2ch_modes,
9582 .input_mux = &alc883_lenovo_101e_capture_source,
9583 .unsol_event = alc883_lenovo_101e_unsol_event,
9584 .init_hook = alc883_lenovo_101e_all_automute,
9586 [ALC883_LENOVO_NB0763] = {
9587 .mixers = { alc883_lenovo_nb0763_mixer },
9588 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9589 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9590 .dac_nids = alc883_dac_nids,
9591 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9592 .channel_mode = alc883_3ST_2ch_modes,
9594 .input_mux = &alc883_lenovo_nb0763_capture_source,
9595 .unsol_event = alc_automute_amp_unsol_event,
9596 .setup = alc883_medion_md2_setup,
9597 .init_hook = alc_automute_amp,
9599 [ALC888_LENOVO_MS7195_DIG] = {
9600 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9601 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9602 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9603 .dac_nids = alc883_dac_nids,
9604 .dig_out_nid = ALC883_DIGOUT_NID,
9605 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9606 .channel_mode = alc883_3ST_6ch_modes,
9608 .input_mux = &alc883_capture_source,
9609 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9610 .init_hook = alc888_lenovo_ms7195_front_automute,
9612 [ALC883_HAIER_W66] = {
9613 .mixers = { alc883_targa_2ch_mixer},
9614 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9615 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9616 .dac_nids = alc883_dac_nids,
9617 .dig_out_nid = ALC883_DIGOUT_NID,
9618 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9619 .channel_mode = alc883_3ST_2ch_modes,
9620 .input_mux = &alc883_capture_source,
9621 .unsol_event = alc_automute_amp_unsol_event,
9622 .setup = alc883_haier_w66_setup,
9623 .init_hook = alc_automute_amp,
9626 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9627 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9628 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9629 .dac_nids = alc883_dac_nids,
9630 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9631 .channel_mode = alc888_3st_hp_modes,
9633 .input_mux = &alc883_capture_source,
9634 .unsol_event = alc_automute_amp_unsol_event,
9635 .setup = alc888_3st_hp_setup,
9636 .init_hook = alc_automute_amp,
9638 [ALC888_6ST_DELL] = {
9639 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9640 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9641 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9642 .dac_nids = alc883_dac_nids,
9643 .dig_out_nid = ALC883_DIGOUT_NID,
9644 .dig_in_nid = ALC883_DIGIN_NID,
9645 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9646 .channel_mode = alc883_sixstack_modes,
9647 .input_mux = &alc883_capture_source,
9648 .unsol_event = alc_automute_amp_unsol_event,
9649 .setup = alc888_6st_dell_setup,
9650 .init_hook = alc_automute_amp,
9653 .mixers = { alc883_mitac_mixer },
9654 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9655 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9656 .dac_nids = alc883_dac_nids,
9657 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9658 .channel_mode = alc883_3ST_2ch_modes,
9659 .input_mux = &alc883_capture_source,
9660 .unsol_event = alc_automute_amp_unsol_event,
9661 .setup = alc883_mitac_setup,
9662 .init_hook = alc_automute_amp,
9664 [ALC883_FUJITSU_PI2515] = {
9665 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9666 .init_verbs = { alc883_init_verbs,
9667 alc883_2ch_fujitsu_pi2515_verbs},
9668 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9669 .dac_nids = alc883_dac_nids,
9670 .dig_out_nid = ALC883_DIGOUT_NID,
9671 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9672 .channel_mode = alc883_3ST_2ch_modes,
9673 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9674 .unsol_event = alc_automute_amp_unsol_event,
9675 .setup = alc883_2ch_fujitsu_pi2515_setup,
9676 .init_hook = alc_automute_amp,
9678 [ALC888_FUJITSU_XA3530] = {
9679 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9680 .init_verbs = { alc883_init_verbs,
9681 alc888_fujitsu_xa3530_verbs },
9682 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9683 .dac_nids = alc883_dac_nids,
9684 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9685 .adc_nids = alc883_adc_nids_rev,
9686 .capsrc_nids = alc883_capsrc_nids_rev,
9687 .dig_out_nid = ALC883_DIGOUT_NID,
9688 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9689 .channel_mode = alc888_4ST_8ch_intel_modes,
9691 ARRAY_SIZE(alc888_2_capture_sources),
9692 .input_mux = alc888_2_capture_sources,
9693 .unsol_event = alc_automute_amp_unsol_event,
9694 .setup = alc888_fujitsu_xa3530_setup,
9695 .init_hook = alc_automute_amp,
9697 [ALC888_LENOVO_SKY] = {
9698 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9699 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9700 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9701 .dac_nids = alc883_dac_nids,
9702 .dig_out_nid = ALC883_DIGOUT_NID,
9703 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9704 .channel_mode = alc883_sixstack_modes,
9706 .input_mux = &alc883_lenovo_sky_capture_source,
9707 .unsol_event = alc_automute_amp_unsol_event,
9708 .setup = alc888_lenovo_sky_setup,
9709 .init_hook = alc_automute_amp,
9711 [ALC888_ASUS_M90V] = {
9712 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9713 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9714 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9715 .dac_nids = alc883_dac_nids,
9716 .dig_out_nid = ALC883_DIGOUT_NID,
9717 .dig_in_nid = ALC883_DIGIN_NID,
9718 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9719 .channel_mode = alc883_3ST_6ch_modes,
9721 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9722 .unsol_event = alc_sku_unsol_event,
9723 .setup = alc883_mode2_setup,
9724 .init_hook = alc_inithook,
9726 [ALC888_ASUS_EEE1601] = {
9727 .mixers = { alc883_asus_eee1601_mixer },
9728 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9729 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9730 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9731 .dac_nids = alc883_dac_nids,
9732 .dig_out_nid = ALC883_DIGOUT_NID,
9733 .dig_in_nid = ALC883_DIGIN_NID,
9734 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9735 .channel_mode = alc883_3ST_2ch_modes,
9737 .input_mux = &alc883_asus_eee1601_capture_source,
9738 .unsol_event = alc_sku_unsol_event,
9739 .init_hook = alc883_eee1601_inithook,
9741 [ALC1200_ASUS_P5Q] = {
9742 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9743 .init_verbs = { alc883_init_verbs },
9744 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9745 .dac_nids = alc883_dac_nids,
9746 .dig_out_nid = ALC1200_DIGOUT_NID,
9747 .dig_in_nid = ALC883_DIGIN_NID,
9748 .slave_dig_outs = alc1200_slave_dig_outs,
9749 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9750 .channel_mode = alc883_sixstack_modes,
9751 .input_mux = &alc883_capture_source,
9754 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9755 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9756 alc880_gpio1_init_verbs },
9757 .adc_nids = alc883_adc_nids,
9758 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9759 .dac_nids = alc883_dac_nids,
9760 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9761 .channel_mode = alc889A_mb31_6ch_modes,
9762 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9763 .input_mux = &alc889A_mb31_capture_source,
9764 .dig_out_nid = ALC883_DIGOUT_NID,
9765 .unsol_event = alc889A_mb31_unsol_event,
9766 .init_hook = alc889A_mb31_automute,
9768 [ALC883_SONY_VAIO_TT] = {
9769 .mixers = { alc883_vaiott_mixer },
9770 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9771 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9772 .dac_nids = alc883_dac_nids,
9773 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9774 .channel_mode = alc883_3ST_2ch_modes,
9775 .input_mux = &alc883_capture_source,
9776 .unsol_event = alc_automute_amp_unsol_event,
9777 .setup = alc883_vaiott_setup,
9778 .init_hook = alc_automute_amp,
9787 PINFIX_ABIT_AW9D_MAX
9790 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9791 { 0x15, 0x01080104 }, /* side */
9792 { 0x16, 0x01011012 }, /* rear */
9793 { 0x17, 0x01016011 }, /* clfe */
9797 static const struct alc_fixup alc882_fixups[] = {
9798 [PINFIX_ABIT_AW9D_MAX] = {
9799 .pins = alc882_abit_aw9d_pinfix
9803 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9804 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9809 * BIOS auto configuration
9811 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9812 const struct auto_pin_cfg *cfg)
9814 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9817 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9818 hda_nid_t nid, int pin_type,
9822 struct alc_spec *spec = codec->spec;
9825 alc_set_pin_output(codec, nid, pin_type);
9826 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9829 idx = spec->multiout.dac_nids[dac_idx] - 2;
9830 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9834 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9836 struct alc_spec *spec = codec->spec;
9839 for (i = 0; i <= HDA_SIDE; i++) {
9840 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9841 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9843 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9848 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9850 struct alc_spec *spec = codec->spec;
9853 pin = spec->autocfg.hp_pins[0];
9854 if (pin) /* connect to front */
9856 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9857 pin = spec->autocfg.speaker_pins[0];
9859 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9862 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9864 struct alc_spec *spec = codec->spec;
9867 for (i = 0; i < AUTO_PIN_LAST; i++) {
9868 hda_nid_t nid = spec->autocfg.input_pins[i];
9871 alc_set_input_pin(codec, nid, i);
9872 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9873 snd_hda_codec_write(codec, nid, 0,
9874 AC_VERB_SET_AMP_GAIN_MUTE,
9879 static void alc882_auto_init_input_src(struct hda_codec *codec)
9881 struct alc_spec *spec = codec->spec;
9884 for (c = 0; c < spec->num_adc_nids; c++) {
9885 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9886 hda_nid_t nid = spec->capsrc_nids[c];
9887 unsigned int mux_idx;
9888 const struct hda_input_mux *imux;
9889 int conns, mute, idx, item;
9891 conns = snd_hda_get_connections(codec, nid, conn_list,
9892 ARRAY_SIZE(conn_list));
9895 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9896 imux = &spec->input_mux[mux_idx];
9897 for (idx = 0; idx < conns; idx++) {
9898 /* if the current connection is the selected one,
9899 * unmute it as default - otherwise mute it
9901 mute = AMP_IN_MUTE(idx);
9902 for (item = 0; item < imux->num_items; item++) {
9903 if (imux->items[item].index == idx) {
9904 if (spec->cur_mux[c] == item)
9905 mute = AMP_IN_UNMUTE(idx);
9909 /* check if we have a selector or mixer
9910 * we could check for the widget type instead, but
9911 * just check for Amp-In presence (in case of mixer
9912 * without amp-in there is something wrong, this
9913 * function shouldn't be used or capsrc nid is wrong)
9915 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9916 snd_hda_codec_write(codec, nid, 0,
9917 AC_VERB_SET_AMP_GAIN_MUTE,
9919 else if (mute != AMP_IN_MUTE(idx))
9920 snd_hda_codec_write(codec, nid, 0,
9921 AC_VERB_SET_CONNECT_SEL,
9927 /* add mic boosts if needed */
9928 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9930 struct alc_spec *spec = codec->spec;
9934 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9935 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9936 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9938 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9942 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9943 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9944 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9946 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9953 /* almost identical with ALC880 parser... */
9954 static int alc882_parse_auto_config(struct hda_codec *codec)
9956 struct alc_spec *spec = codec->spec;
9957 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9960 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9964 if (!spec->autocfg.line_outs)
9965 return 0; /* can't find valid BIOS pin config */
9967 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9970 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9973 err = alc880_auto_create_extra_out(spec,
9974 spec->autocfg.speaker_pins[0],
9978 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9982 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9986 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9988 /* check multiple SPDIF-out (for recent codecs) */
9989 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9991 err = snd_hda_get_connections(codec,
9992 spec->autocfg.dig_out_pins[i],
9997 spec->multiout.dig_out_nid = dig_nid;
9999 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10000 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10002 spec->slave_dig_outs[i - 1] = dig_nid;
10005 if (spec->autocfg.dig_in_pin)
10006 spec->dig_in_nid = ALC880_DIGIN_NID;
10008 if (spec->kctls.list)
10009 add_mixer(spec, spec->kctls.list);
10011 add_verb(spec, alc883_auto_init_verbs);
10012 /* if ADC 0x07 is available, initialize it, too */
10013 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10014 add_verb(spec, alc882_adc1_init_verbs);
10016 spec->num_mux_defs = 1;
10017 spec->input_mux = &spec->private_imux[0];
10019 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10021 err = alc_auto_add_mic_boost(codec);
10025 return 1; /* config found */
10028 /* additional initialization for auto-configuration model */
10029 static void alc882_auto_init(struct hda_codec *codec)
10031 struct alc_spec *spec = codec->spec;
10032 alc882_auto_init_multi_out(codec);
10033 alc882_auto_init_hp_out(codec);
10034 alc882_auto_init_analog_input(codec);
10035 alc882_auto_init_input_src(codec);
10036 if (spec->unsol_event)
10037 alc_inithook(codec);
10040 static int patch_alc882(struct hda_codec *codec)
10042 struct alc_spec *spec;
10043 int err, board_config;
10045 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10049 codec->spec = spec;
10051 switch (codec->vendor_id) {
10056 /* ALC883 and variants */
10057 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10061 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10065 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10066 board_config = snd_hda_check_board_codec_sid_config(codec,
10067 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10069 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10070 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10072 board_config = ALC882_AUTO;
10075 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10077 if (board_config == ALC882_AUTO) {
10078 /* automatic parse from the BIOS config */
10079 err = alc882_parse_auto_config(codec);
10085 "hda_codec: Cannot set up configuration "
10086 "from BIOS. Using base mode...\n");
10087 board_config = ALC882_3ST_DIG;
10091 err = snd_hda_attach_beep_device(codec, 0x1);
10097 if (board_config != ALC882_AUTO)
10098 setup_preset(codec, &alc882_presets[board_config]);
10100 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10101 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10102 /* FIXME: setup DAC5 */
10103 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10104 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10106 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10107 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10109 if (codec->vendor_id == 0x10ec0888)
10110 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10112 if (!spec->adc_nids && spec->input_mux) {
10114 spec->num_adc_nids = 0;
10115 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10116 const struct hda_input_mux *imux = spec->input_mux;
10118 hda_nid_t items[16];
10119 hda_nid_t nid = alc882_adc_nids[i];
10120 unsigned int wcap = get_wcaps(codec, nid);
10122 wcap = get_wcaps_type(wcap);
10123 if (wcap != AC_WID_AUD_IN)
10125 spec->private_adc_nids[spec->num_adc_nids] = nid;
10126 err = snd_hda_get_connections(codec, nid, &cap, 1);
10129 err = snd_hda_get_connections(codec, cap, items,
10130 ARRAY_SIZE(items));
10133 for (j = 0; j < imux->num_items; j++)
10134 if (imux->items[j].index >= err)
10136 if (j < imux->num_items)
10138 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10139 spec->num_adc_nids++;
10141 spec->adc_nids = spec->private_adc_nids;
10142 spec->capsrc_nids = spec->private_capsrc_nids;
10145 set_capture_mixer(codec);
10146 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10148 spec->vmaster_nid = 0x0c;
10150 codec->patch_ops = alc_patch_ops;
10151 if (board_config == ALC882_AUTO)
10152 spec->init_hook = alc882_auto_init;
10153 #ifdef CONFIG_SND_HDA_POWER_SAVE
10154 if (!spec->loopback.amplist)
10155 spec->loopback.amplist = alc882_loopbacks;
10157 codec->proc_widget_hook = print_realtek_coef;
10167 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10168 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10170 #define alc262_dac_nids alc260_dac_nids
10171 #define alc262_adc_nids alc882_adc_nids
10172 #define alc262_adc_nids_alt alc882_adc_nids_alt
10173 #define alc262_capsrc_nids alc882_capsrc_nids
10174 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10176 #define alc262_modes alc260_modes
10177 #define alc262_capture_source alc882_capture_source
10179 static hda_nid_t alc262_dmic_adc_nids[1] = {
10184 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10186 static struct snd_kcontrol_new alc262_base_mixer[] = {
10187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10188 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10189 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10190 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10191 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10192 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10195 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10196 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10197 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10198 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10199 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10200 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10201 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10202 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10206 /* update HP, line and mono-out pins according to the master switch */
10207 static void alc262_hp_master_update(struct hda_codec *codec)
10209 struct alc_spec *spec = codec->spec;
10210 int val = spec->master_sw;
10212 /* HP & line-out */
10213 snd_hda_codec_write_cache(codec, 0x1b, 0,
10214 AC_VERB_SET_PIN_WIDGET_CONTROL,
10216 snd_hda_codec_write_cache(codec, 0x15, 0,
10217 AC_VERB_SET_PIN_WIDGET_CONTROL,
10219 /* mono (speaker) depending on the HP jack sense */
10220 val = val && !spec->jack_present;
10221 snd_hda_codec_write_cache(codec, 0x16, 0,
10222 AC_VERB_SET_PIN_WIDGET_CONTROL,
10223 val ? PIN_OUT : 0);
10226 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10228 struct alc_spec *spec = codec->spec;
10230 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10231 alc262_hp_master_update(codec);
10234 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10236 if ((res >> 26) != ALC880_HP_EVENT)
10238 alc262_hp_bpc_automute(codec);
10241 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10243 struct alc_spec *spec = codec->spec;
10245 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10246 alc262_hp_master_update(codec);
10249 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10252 if ((res >> 26) != ALC880_HP_EVENT)
10254 alc262_hp_wildwest_automute(codec);
10257 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10259 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10260 struct snd_ctl_elem_value *ucontrol)
10262 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10263 struct alc_spec *spec = codec->spec;
10264 int val = !!*ucontrol->value.integer.value;
10266 if (val == spec->master_sw)
10268 spec->master_sw = val;
10269 alc262_hp_master_update(codec);
10273 #define ALC262_HP_MASTER_SWITCH \
10275 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10276 .name = "Master Playback Switch", \
10277 .info = snd_ctl_boolean_mono_info, \
10278 .get = alc262_hp_master_sw_get, \
10279 .put = alc262_hp_master_sw_put, \
10282 .iface = NID_MAPPING, \
10283 .name = "Master Playback Switch", \
10284 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10288 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10289 ALC262_HP_MASTER_SWITCH,
10290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10291 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10293 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10295 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10299 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10300 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10301 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10302 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10303 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10304 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10305 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10306 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10307 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10308 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10312 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10313 ALC262_HP_MASTER_SWITCH,
10314 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10315 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10316 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10317 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10318 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10320 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10322 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10323 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10324 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10325 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10326 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10327 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10328 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10332 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10333 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10334 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10335 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10339 /* mute/unmute internal speaker according to the hp jack and mute state */
10340 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10342 struct alc_spec *spec = codec->spec;
10344 spec->autocfg.hp_pins[0] = 0x15;
10345 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10348 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10349 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10350 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10351 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10355 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10359 static struct hda_verb alc262_hp_t5735_verbs[] = {
10360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10363 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10367 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10368 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10369 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10371 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10372 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10373 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10377 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10378 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10379 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10380 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10381 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10382 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10383 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10386 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10391 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10398 /* bind hp and internal speaker mute (with plug check) as master switch */
10399 static void alc262_hippo_master_update(struct hda_codec *codec)
10401 struct alc_spec *spec = codec->spec;
10402 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10403 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10404 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10408 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10409 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10410 HDA_AMP_MUTE, mute);
10411 /* mute internal speaker per jack sense */
10412 if (spec->jack_present)
10413 mute = HDA_AMP_MUTE;
10415 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10416 HDA_AMP_MUTE, mute);
10417 if (speaker_nid && speaker_nid != line_nid)
10418 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10419 HDA_AMP_MUTE, mute);
10422 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10424 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10425 struct snd_ctl_elem_value *ucontrol)
10427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10428 struct alc_spec *spec = codec->spec;
10429 int val = !!*ucontrol->value.integer.value;
10431 if (val == spec->master_sw)
10433 spec->master_sw = val;
10434 alc262_hippo_master_update(codec);
10438 #define ALC262_HIPPO_MASTER_SWITCH \
10440 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10441 .name = "Master Playback Switch", \
10442 .info = snd_ctl_boolean_mono_info, \
10443 .get = alc262_hippo_master_sw_get, \
10444 .put = alc262_hippo_master_sw_put, \
10447 .iface = NID_MAPPING, \
10448 .name = "Master Playback Switch", \
10449 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10450 (SUBDEV_SPEAKER(0) << 16), \
10453 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10454 ALC262_HIPPO_MASTER_SWITCH,
10455 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10456 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10457 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10458 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10459 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10460 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10462 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10463 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10464 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10465 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10466 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10470 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10471 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10472 ALC262_HIPPO_MASTER_SWITCH,
10473 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10474 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10475 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10476 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10477 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10478 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10479 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10480 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10481 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10482 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10486 /* mute/unmute internal speaker according to the hp jack and mute state */
10487 static void alc262_hippo_automute(struct hda_codec *codec)
10489 struct alc_spec *spec = codec->spec;
10490 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10492 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10493 alc262_hippo_master_update(codec);
10496 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10498 if ((res >> 26) != ALC880_HP_EVENT)
10500 alc262_hippo_automute(codec);
10503 static void alc262_hippo_setup(struct hda_codec *codec)
10505 struct alc_spec *spec = codec->spec;
10507 spec->autocfg.hp_pins[0] = 0x15;
10508 spec->autocfg.speaker_pins[0] = 0x14;
10511 static void alc262_hippo1_setup(struct hda_codec *codec)
10513 struct alc_spec *spec = codec->spec;
10515 spec->autocfg.hp_pins[0] = 0x1b;
10516 spec->autocfg.speaker_pins[0] = 0x14;
10520 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10521 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10522 ALC262_HIPPO_MASTER_SWITCH,
10523 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10524 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10525 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10526 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10530 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10531 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10532 ALC262_HIPPO_MASTER_SWITCH,
10533 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10534 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10535 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10536 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10537 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10541 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10542 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10543 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10544 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10545 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10546 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10547 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10548 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10549 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10550 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10551 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10552 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10553 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10557 static struct hda_verb alc262_tyan_verbs[] = {
10558 /* Headphone automute */
10559 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10560 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10561 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10563 /* P11 AUX_IN, white 4-pin connector */
10564 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10565 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10566 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10567 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10572 /* unsolicited event for HP jack sensing */
10573 static void alc262_tyan_setup(struct hda_codec *codec)
10575 struct alc_spec *spec = codec->spec;
10577 spec->autocfg.hp_pins[0] = 0x1b;
10578 spec->autocfg.speaker_pins[0] = 0x15;
10582 #define alc262_capture_mixer alc882_capture_mixer
10583 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10586 * generic initialization of ADC, input mixers and output mixers
10588 static struct hda_verb alc262_init_verbs[] = {
10590 * Unmute ADC0-2 and set the default input to mic-in
10592 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10593 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10594 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10596 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10599 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10601 * Note: PASD motherboards uses the Line In 2 as the input for
10602 * front panel mic (mic 2)
10604 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10605 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10606 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10612 * Set up output mixers (0x0c - 0x0e)
10614 /* set vol=0 to output mixers */
10615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10617 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10618 /* set up input amps for analog loopback */
10619 /* Amp Indices: DAC = 0, mixer = 1 */
10620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10624 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10629 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10630 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10631 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10632 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10634 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10636 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10637 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10640 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10643 /* FIXME: use matrix-type input source selection */
10644 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10645 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10648 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10649 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10664 static struct hda_verb alc262_eapd_verbs[] = {
10665 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10666 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10670 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10671 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10672 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10673 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10675 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10676 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10680 static struct hda_verb alc262_sony_unsol_verbs[] = {
10681 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10682 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10683 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10685 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10686 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10690 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10691 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10692 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10695 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10699 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10700 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10701 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10702 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10703 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10704 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10705 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10706 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10707 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10711 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10713 struct alc_spec *spec = codec->spec;
10715 spec->autocfg.hp_pins[0] = 0x15;
10716 spec->autocfg.speaker_pins[0] = 0x14;
10717 spec->ext_mic.pin = 0x18;
10718 spec->ext_mic.mux_idx = 0;
10719 spec->int_mic.pin = 0x12;
10720 spec->int_mic.mux_idx = 9;
10721 spec->auto_mic = 1;
10727 * 0x16 = internal speaker
10728 * 0x18 = external mic
10731 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10732 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10733 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10737 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10739 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10740 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10744 static struct hda_verb alc262_nec_verbs[] = {
10745 /* Unmute Speaker */
10746 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10749 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10752 /* External mic to headphone */
10753 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10754 /* External mic to speaker */
10755 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10761 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10762 * 0x1b = port replicator headphone out
10765 #define ALC_HP_EVENT 0x37
10767 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10768 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10769 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10770 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10771 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10775 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10776 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10777 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10781 static struct hda_input_mux alc262_fujitsu_capture_source = {
10785 { "Int Mic", 0x1 },
10790 static struct hda_input_mux alc262_HP_capture_source = {
10794 { "Front Mic", 0x1 },
10801 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10805 { "Front Mic", 0x2 },
10811 /* mute/unmute internal speaker according to the hp jacks and mute state */
10812 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10814 struct alc_spec *spec = codec->spec;
10817 if (force || !spec->sense_updated) {
10818 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10819 snd_hda_jack_detect(codec, 0x1b);
10820 spec->sense_updated = 1;
10822 /* unmute internal speaker only if both HPs are unplugged and
10823 * master switch is on
10825 if (spec->jack_present)
10826 mute = HDA_AMP_MUTE;
10828 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10829 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10830 HDA_AMP_MUTE, mute);
10833 /* unsolicited event for HP jack sensing */
10834 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10837 if ((res >> 26) != ALC_HP_EVENT)
10839 alc262_fujitsu_automute(codec, 1);
10842 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10844 alc262_fujitsu_automute(codec, 1);
10847 /* bind volumes of both NID 0x0c and 0x0d */
10848 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10849 .ops = &snd_hda_bind_vol,
10851 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10852 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10857 /* mute/unmute internal speaker according to the hp jack and mute state */
10858 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10860 struct alc_spec *spec = codec->spec;
10863 if (force || !spec->sense_updated) {
10864 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10865 spec->sense_updated = 1;
10867 if (spec->jack_present) {
10868 /* mute internal speaker */
10869 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10870 HDA_AMP_MUTE, HDA_AMP_MUTE);
10871 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10872 HDA_AMP_MUTE, HDA_AMP_MUTE);
10874 /* unmute internal speaker if necessary */
10875 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10876 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10877 HDA_AMP_MUTE, mute);
10878 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10879 HDA_AMP_MUTE, mute);
10883 /* unsolicited event for HP jack sensing */
10884 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10887 if ((res >> 26) != ALC_HP_EVENT)
10889 alc262_lenovo_3000_automute(codec, 1);
10892 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10893 int dir, int idx, long *valp)
10897 for (i = 0; i < 2; i++, valp++)
10898 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10900 *valp ? 0 : HDA_AMP_MUTE);
10904 /* bind hp and internal speaker mute (with plug check) */
10905 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10906 struct snd_ctl_elem_value *ucontrol)
10908 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10909 long *valp = ucontrol->value.integer.value;
10912 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10913 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10915 alc262_fujitsu_automute(codec, 0);
10919 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10920 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10922 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10923 .name = "Master Playback Switch",
10924 .subdevice = HDA_SUBDEV_AMP_FLAG,
10925 .info = snd_hda_mixer_amp_switch_info,
10926 .get = snd_hda_mixer_amp_switch_get,
10927 .put = alc262_fujitsu_master_sw_put,
10928 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10931 .iface = NID_MAPPING,
10932 .name = "Master Playback Switch",
10933 .private_value = 0x1b,
10935 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10936 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10937 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10939 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10940 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10941 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10942 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10946 /* bind hp and internal speaker mute (with plug check) */
10947 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10948 struct snd_ctl_elem_value *ucontrol)
10950 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10951 long *valp = ucontrol->value.integer.value;
10954 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10956 alc262_lenovo_3000_automute(codec, 0);
10960 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10961 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10963 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10964 .name = "Master Playback Switch",
10965 .subdevice = HDA_SUBDEV_AMP_FLAG,
10966 .info = snd_hda_mixer_amp_switch_info,
10967 .get = snd_hda_mixer_amp_switch_get,
10968 .put = alc262_lenovo_3000_master_sw_put,
10969 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10973 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10976 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10977 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10978 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10982 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10983 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10984 ALC262_HIPPO_MASTER_SWITCH,
10985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10986 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10987 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10988 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10989 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10990 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10994 /* additional init verbs for Benq laptops */
10995 static struct hda_verb alc262_EAPD_verbs[] = {
10996 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10997 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11001 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11002 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11003 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11005 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11006 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11010 /* Samsung Q1 Ultra Vista model setup */
11011 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11012 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11013 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11016 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11017 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11021 static struct hda_verb alc262_ultra_verbs[] = {
11023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11027 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11028 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11030 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11033 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11034 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11035 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11036 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11038 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11040 /* ADC, choose mic */
11041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11042 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11043 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11044 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11045 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11049 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11050 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11054 /* mute/unmute internal speaker according to the hp jack and mute state */
11055 static void alc262_ultra_automute(struct hda_codec *codec)
11057 struct alc_spec *spec = codec->spec;
11061 /* auto-mute only when HP is used as HP */
11062 if (!spec->cur_mux[0]) {
11063 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11064 if (spec->jack_present)
11065 mute = HDA_AMP_MUTE;
11067 /* mute/unmute internal speaker */
11068 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11069 HDA_AMP_MUTE, mute);
11070 /* mute/unmute HP */
11071 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11072 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11075 /* unsolicited event for HP jack sensing */
11076 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11079 if ((res >> 26) != ALC880_HP_EVENT)
11081 alc262_ultra_automute(codec);
11084 static struct hda_input_mux alc262_ultra_capture_source = {
11088 { "Headphone", 0x7 },
11092 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11093 struct snd_ctl_elem_value *ucontrol)
11095 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11096 struct alc_spec *spec = codec->spec;
11099 ret = alc_mux_enum_put(kcontrol, ucontrol);
11102 /* reprogram the HP pin as mic or HP according to the input source */
11103 snd_hda_codec_write_cache(codec, 0x15, 0,
11104 AC_VERB_SET_PIN_WIDGET_CONTROL,
11105 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11106 alc262_ultra_automute(codec); /* mute/unmute HP */
11110 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11111 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11112 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11114 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11115 .name = "Capture Source",
11116 .info = alc_mux_enum_info,
11117 .get = alc_mux_enum_get,
11118 .put = alc262_ultra_mux_enum_put,
11121 .iface = NID_MAPPING,
11122 .name = "Capture Source",
11123 .private_value = 0x15,
11128 /* We use two mixers depending on the output pin; 0x16 is a mono output
11129 * and thus it's bound with a different mixer.
11130 * This function returns which mixer amp should be used.
11132 static int alc262_check_volbit(hda_nid_t nid)
11136 else if (nid == 0x16)
11142 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11143 const char *pfx, int *vbits)
11148 vbit = alc262_check_volbit(nid);
11151 if (*vbits & vbit) /* a volume control for this mixer already there */
11155 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11157 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11158 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11161 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11169 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11171 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11172 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11175 /* add playback controls from the parsed DAC table */
11176 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11177 const struct auto_pin_cfg *cfg)
11183 spec->multiout.num_dacs = 1; /* only use one dac */
11184 spec->multiout.dac_nids = spec->private_dac_nids;
11185 spec->multiout.dac_nids[0] = 2;
11187 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11189 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11193 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11196 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11199 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11203 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11204 alc262_check_volbit(cfg->speaker_pins[0]) |
11205 alc262_check_volbit(cfg->hp_pins[0]);
11206 if (vbits == 1 || vbits == 2)
11207 pfx = "Master"; /* only one mixer is used */
11208 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11213 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11216 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11220 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11227 #define alc262_auto_create_input_ctls \
11228 alc880_auto_create_input_ctls
11231 * generic initialization of ADC, input mixers and output mixers
11233 static struct hda_verb alc262_volume_init_verbs[] = {
11235 * Unmute ADC0-2 and set the default input to mic-in
11237 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11239 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11241 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11242 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11244 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11246 * Note: PASD motherboards uses the Line In 2 as the input for
11247 * front panel mic (mic 2)
11249 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11257 * Set up output mixers (0x0c - 0x0f)
11259 /* set vol=0 to output mixers */
11260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11264 /* set up input amps for analog loopback */
11265 /* Amp Indices: DAC = 0, mixer = 1 */
11266 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11268 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11269 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11270 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11271 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11273 /* FIXME: use matrix-type input source selection */
11274 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11275 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11294 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11296 * Unmute ADC0-2 and set the default input to mic-in
11298 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11299 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11300 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11301 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11302 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11303 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11305 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11307 * Note: PASD motherboards uses the Line In 2 as the input for
11308 * front panel mic (mic 2)
11310 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11311 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11312 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11313 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11320 * Set up output mixers (0x0c - 0x0e)
11322 /* set vol=0 to output mixers */
11323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11324 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11325 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11327 /* set up input amps for analog loopback */
11328 /* Amp Indices: DAC = 0, mixer = 1 */
11329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11336 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11337 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11338 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11340 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11341 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11343 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11344 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11346 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11347 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11348 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11349 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11350 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11353 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11354 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11355 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11356 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11357 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11360 /* FIXME: use matrix-type input source selection */
11361 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11362 /* Input mixer1: only unmute Mic */
11363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11390 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11391 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11393 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11398 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11400 * Unmute ADC0-2 and set the default input to mic-in
11402 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11403 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11404 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11405 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11406 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11407 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11409 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11411 * Note: PASD motherboards uses the Line In 2 as the input for front
11412 * panel mic (mic 2)
11414 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11421 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11422 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11424 * Set up output mixers (0x0c - 0x0e)
11426 /* set vol=0 to output mixers */
11427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11429 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11431 /* set up input amps for analog loopback */
11432 /* Amp Indices: DAC = 0, mixer = 1 */
11433 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11435 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11436 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11437 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11441 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11442 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11443 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11444 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11445 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11446 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11447 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11449 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11450 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11452 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11453 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11455 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11456 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11457 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11458 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11459 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11460 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11462 /* FIXME: use matrix-type input source selection */
11463 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11464 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11465 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11467 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11468 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11470 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11473 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11478 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11485 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11486 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11487 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11489 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11494 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11500 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11502 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11503 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11505 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11506 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11507 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11512 #ifdef CONFIG_SND_HDA_POWER_SAVE
11513 #define alc262_loopbacks alc880_loopbacks
11516 /* pcm configuration: identical with ALC880 */
11517 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11518 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11519 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11520 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11523 * BIOS auto configuration
11525 static int alc262_parse_auto_config(struct hda_codec *codec)
11527 struct alc_spec *spec = codec->spec;
11529 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11531 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11535 if (!spec->autocfg.line_outs) {
11536 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11537 spec->multiout.max_channels = 2;
11538 spec->no_analog = 1;
11541 return 0; /* can't find valid BIOS pin config */
11543 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11546 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11550 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11553 if (spec->autocfg.dig_outs) {
11554 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11555 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11557 if (spec->autocfg.dig_in_pin)
11558 spec->dig_in_nid = ALC262_DIGIN_NID;
11560 if (spec->kctls.list)
11561 add_mixer(spec, spec->kctls.list);
11563 add_verb(spec, alc262_volume_init_verbs);
11564 spec->num_mux_defs = 1;
11565 spec->input_mux = &spec->private_imux[0];
11567 err = alc_auto_add_mic_boost(codec);
11571 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11576 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11577 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11578 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11579 #define alc262_auto_init_input_src alc882_auto_init_input_src
11582 /* init callback for auto-configuration model -- overriding the default init */
11583 static void alc262_auto_init(struct hda_codec *codec)
11585 struct alc_spec *spec = codec->spec;
11586 alc262_auto_init_multi_out(codec);
11587 alc262_auto_init_hp_out(codec);
11588 alc262_auto_init_analog_input(codec);
11589 alc262_auto_init_input_src(codec);
11590 if (spec->unsol_event)
11591 alc_inithook(codec);
11595 * configuration and preset
11597 static const char *alc262_models[ALC262_MODEL_LAST] = {
11598 [ALC262_BASIC] = "basic",
11599 [ALC262_HIPPO] = "hippo",
11600 [ALC262_HIPPO_1] = "hippo_1",
11601 [ALC262_FUJITSU] = "fujitsu",
11602 [ALC262_HP_BPC] = "hp-bpc",
11603 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11604 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11605 [ALC262_HP_RP5700] = "hp-rp5700",
11606 [ALC262_BENQ_ED8] = "benq",
11607 [ALC262_BENQ_T31] = "benq-t31",
11608 [ALC262_SONY_ASSAMD] = "sony-assamd",
11609 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11610 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11611 [ALC262_ULTRA] = "ultra",
11612 [ALC262_LENOVO_3000] = "lenovo-3000",
11613 [ALC262_NEC] = "nec",
11614 [ALC262_TYAN] = "tyan",
11615 [ALC262_AUTO] = "auto",
11618 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11619 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11620 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11621 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11623 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11625 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11627 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11628 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11629 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11630 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11631 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11632 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11633 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11634 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11635 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11636 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11637 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11638 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11639 ALC262_HP_TC_T5735),
11640 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11641 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11642 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11643 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11644 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11645 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11646 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11647 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11648 #if 0 /* disable the quirk since model=auto works better in recent versions */
11649 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11650 ALC262_SONY_ASSAMD),
11652 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11653 ALC262_TOSHIBA_RX1),
11654 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11655 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11656 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11657 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11658 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11660 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11661 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11662 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11663 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11664 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11668 static struct alc_config_preset alc262_presets[] = {
11670 .mixers = { alc262_base_mixer },
11671 .init_verbs = { alc262_init_verbs },
11672 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11673 .dac_nids = alc262_dac_nids,
11675 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11676 .channel_mode = alc262_modes,
11677 .input_mux = &alc262_capture_source,
11680 .mixers = { alc262_hippo_mixer },
11681 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11682 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11683 .dac_nids = alc262_dac_nids,
11685 .dig_out_nid = ALC262_DIGOUT_NID,
11686 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11687 .channel_mode = alc262_modes,
11688 .input_mux = &alc262_capture_source,
11689 .unsol_event = alc262_hippo_unsol_event,
11690 .setup = alc262_hippo_setup,
11691 .init_hook = alc262_hippo_automute,
11693 [ALC262_HIPPO_1] = {
11694 .mixers = { alc262_hippo1_mixer },
11695 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11696 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11697 .dac_nids = alc262_dac_nids,
11699 .dig_out_nid = ALC262_DIGOUT_NID,
11700 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11701 .channel_mode = alc262_modes,
11702 .input_mux = &alc262_capture_source,
11703 .unsol_event = alc262_hippo_unsol_event,
11704 .setup = alc262_hippo1_setup,
11705 .init_hook = alc262_hippo_automute,
11707 [ALC262_FUJITSU] = {
11708 .mixers = { alc262_fujitsu_mixer },
11709 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11710 alc262_fujitsu_unsol_verbs },
11711 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11712 .dac_nids = alc262_dac_nids,
11714 .dig_out_nid = ALC262_DIGOUT_NID,
11715 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11716 .channel_mode = alc262_modes,
11717 .input_mux = &alc262_fujitsu_capture_source,
11718 .unsol_event = alc262_fujitsu_unsol_event,
11719 .init_hook = alc262_fujitsu_init_hook,
11721 [ALC262_HP_BPC] = {
11722 .mixers = { alc262_HP_BPC_mixer },
11723 .init_verbs = { alc262_HP_BPC_init_verbs },
11724 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11725 .dac_nids = alc262_dac_nids,
11727 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11728 .channel_mode = alc262_modes,
11729 .input_mux = &alc262_HP_capture_source,
11730 .unsol_event = alc262_hp_bpc_unsol_event,
11731 .init_hook = alc262_hp_bpc_automute,
11733 [ALC262_HP_BPC_D7000_WF] = {
11734 .mixers = { alc262_HP_BPC_WildWest_mixer },
11735 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11736 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11737 .dac_nids = alc262_dac_nids,
11739 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11740 .channel_mode = alc262_modes,
11741 .input_mux = &alc262_HP_D7000_capture_source,
11742 .unsol_event = alc262_hp_wildwest_unsol_event,
11743 .init_hook = alc262_hp_wildwest_automute,
11745 [ALC262_HP_BPC_D7000_WL] = {
11746 .mixers = { alc262_HP_BPC_WildWest_mixer,
11747 alc262_HP_BPC_WildWest_option_mixer },
11748 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11749 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11750 .dac_nids = alc262_dac_nids,
11752 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11753 .channel_mode = alc262_modes,
11754 .input_mux = &alc262_HP_D7000_capture_source,
11755 .unsol_event = alc262_hp_wildwest_unsol_event,
11756 .init_hook = alc262_hp_wildwest_automute,
11758 [ALC262_HP_TC_T5735] = {
11759 .mixers = { alc262_hp_t5735_mixer },
11760 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11761 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11762 .dac_nids = alc262_dac_nids,
11764 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11765 .channel_mode = alc262_modes,
11766 .input_mux = &alc262_capture_source,
11767 .unsol_event = alc_automute_amp_unsol_event,
11768 .setup = alc262_hp_t5735_setup,
11769 .init_hook = alc_automute_amp,
11771 [ALC262_HP_RP5700] = {
11772 .mixers = { alc262_hp_rp5700_mixer },
11773 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11774 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11775 .dac_nids = alc262_dac_nids,
11776 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11777 .channel_mode = alc262_modes,
11778 .input_mux = &alc262_hp_rp5700_capture_source,
11780 [ALC262_BENQ_ED8] = {
11781 .mixers = { alc262_base_mixer },
11782 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11783 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11784 .dac_nids = alc262_dac_nids,
11786 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11787 .channel_mode = alc262_modes,
11788 .input_mux = &alc262_capture_source,
11790 [ALC262_SONY_ASSAMD] = {
11791 .mixers = { alc262_sony_mixer },
11792 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11793 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11794 .dac_nids = alc262_dac_nids,
11796 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11797 .channel_mode = alc262_modes,
11798 .input_mux = &alc262_capture_source,
11799 .unsol_event = alc262_hippo_unsol_event,
11800 .setup = alc262_hippo_setup,
11801 .init_hook = alc262_hippo_automute,
11803 [ALC262_BENQ_T31] = {
11804 .mixers = { alc262_benq_t31_mixer },
11805 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11806 alc_hp15_unsol_verbs },
11807 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11808 .dac_nids = alc262_dac_nids,
11810 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11811 .channel_mode = alc262_modes,
11812 .input_mux = &alc262_capture_source,
11813 .unsol_event = alc262_hippo_unsol_event,
11814 .setup = alc262_hippo_setup,
11815 .init_hook = alc262_hippo_automute,
11818 .mixers = { alc262_ultra_mixer },
11819 .cap_mixer = alc262_ultra_capture_mixer,
11820 .init_verbs = { alc262_ultra_verbs },
11821 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11822 .dac_nids = alc262_dac_nids,
11823 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11824 .channel_mode = alc262_modes,
11825 .input_mux = &alc262_ultra_capture_source,
11826 .adc_nids = alc262_adc_nids, /* ADC0 */
11827 .capsrc_nids = alc262_capsrc_nids,
11828 .num_adc_nids = 1, /* single ADC */
11829 .unsol_event = alc262_ultra_unsol_event,
11830 .init_hook = alc262_ultra_automute,
11832 [ALC262_LENOVO_3000] = {
11833 .mixers = { alc262_lenovo_3000_mixer },
11834 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11835 alc262_lenovo_3000_unsol_verbs },
11836 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11837 .dac_nids = alc262_dac_nids,
11839 .dig_out_nid = ALC262_DIGOUT_NID,
11840 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11841 .channel_mode = alc262_modes,
11842 .input_mux = &alc262_fujitsu_capture_source,
11843 .unsol_event = alc262_lenovo_3000_unsol_event,
11846 .mixers = { alc262_nec_mixer },
11847 .init_verbs = { alc262_nec_verbs },
11848 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11849 .dac_nids = alc262_dac_nids,
11851 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11852 .channel_mode = alc262_modes,
11853 .input_mux = &alc262_capture_source,
11855 [ALC262_TOSHIBA_S06] = {
11856 .mixers = { alc262_toshiba_s06_mixer },
11857 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11858 alc262_eapd_verbs },
11859 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11860 .capsrc_nids = alc262_dmic_capsrc_nids,
11861 .dac_nids = alc262_dac_nids,
11862 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11863 .num_adc_nids = 1, /* single ADC */
11864 .dig_out_nid = ALC262_DIGOUT_NID,
11865 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11866 .channel_mode = alc262_modes,
11867 .unsol_event = alc_sku_unsol_event,
11868 .setup = alc262_toshiba_s06_setup,
11869 .init_hook = alc_inithook,
11871 [ALC262_TOSHIBA_RX1] = {
11872 .mixers = { alc262_toshiba_rx1_mixer },
11873 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11874 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11875 .dac_nids = alc262_dac_nids,
11877 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11878 .channel_mode = alc262_modes,
11879 .input_mux = &alc262_capture_source,
11880 .unsol_event = alc262_hippo_unsol_event,
11881 .setup = alc262_hippo_setup,
11882 .init_hook = alc262_hippo_automute,
11885 .mixers = { alc262_tyan_mixer },
11886 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11887 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11888 .dac_nids = alc262_dac_nids,
11890 .dig_out_nid = ALC262_DIGOUT_NID,
11891 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11892 .channel_mode = alc262_modes,
11893 .input_mux = &alc262_capture_source,
11894 .unsol_event = alc_automute_amp_unsol_event,
11895 .setup = alc262_tyan_setup,
11896 .init_hook = alc_automute_amp,
11900 static int patch_alc262(struct hda_codec *codec)
11902 struct alc_spec *spec;
11906 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11910 codec->spec = spec;
11912 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11917 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11918 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11919 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11920 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11924 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11926 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11930 if (board_config < 0) {
11931 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11933 board_config = ALC262_AUTO;
11936 if (board_config == ALC262_AUTO) {
11937 /* automatic parse from the BIOS config */
11938 err = alc262_parse_auto_config(codec);
11944 "hda_codec: Cannot set up configuration "
11945 "from BIOS. Using base mode...\n");
11946 board_config = ALC262_BASIC;
11950 if (!spec->no_analog) {
11951 err = snd_hda_attach_beep_device(codec, 0x1);
11958 if (board_config != ALC262_AUTO)
11959 setup_preset(codec, &alc262_presets[board_config]);
11961 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11962 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11964 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11965 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11967 if (!spec->adc_nids && spec->input_mux) {
11969 /* check whether the digital-mic has to be supported */
11970 for (i = 0; i < spec->input_mux->num_items; i++) {
11971 if (spec->input_mux->items[i].index >= 9)
11974 if (i < spec->input_mux->num_items) {
11975 /* use only ADC0 */
11976 spec->adc_nids = alc262_dmic_adc_nids;
11977 spec->num_adc_nids = 1;
11978 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11980 /* all analog inputs */
11981 /* check whether NID 0x07 is valid */
11982 unsigned int wcap = get_wcaps(codec, 0x07);
11985 wcap = get_wcaps_type(wcap);
11986 if (wcap != AC_WID_AUD_IN) {
11987 spec->adc_nids = alc262_adc_nids_alt;
11988 spec->num_adc_nids =
11989 ARRAY_SIZE(alc262_adc_nids_alt);
11990 spec->capsrc_nids = alc262_capsrc_nids_alt;
11992 spec->adc_nids = alc262_adc_nids;
11993 spec->num_adc_nids =
11994 ARRAY_SIZE(alc262_adc_nids);
11995 spec->capsrc_nids = alc262_capsrc_nids;
11999 if (!spec->cap_mixer && !spec->no_analog)
12000 set_capture_mixer(codec);
12001 if (!spec->no_analog)
12002 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12004 spec->vmaster_nid = 0x0c;
12006 codec->patch_ops = alc_patch_ops;
12007 if (board_config == ALC262_AUTO)
12008 spec->init_hook = alc262_auto_init;
12009 #ifdef CONFIG_SND_HDA_POWER_SAVE
12010 if (!spec->loopback.amplist)
12011 spec->loopback.amplist = alc262_loopbacks;
12013 codec->proc_widget_hook = print_realtek_coef;
12019 * ALC268 channel source setting (2 channel)
12021 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12022 #define alc268_modes alc260_modes
12024 static hda_nid_t alc268_dac_nids[2] = {
12029 static hda_nid_t alc268_adc_nids[2] = {
12034 static hda_nid_t alc268_adc_nids_alt[1] = {
12039 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12041 static struct snd_kcontrol_new alc268_base_mixer[] = {
12042 /* output mixer control */
12043 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12044 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12045 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12047 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12048 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12049 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12053 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12054 /* output mixer control */
12055 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12056 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12057 ALC262_HIPPO_MASTER_SWITCH,
12058 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12059 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12060 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12064 /* bind Beep switches of both NID 0x0f and 0x10 */
12065 static struct hda_bind_ctls alc268_bind_beep_sw = {
12066 .ops = &snd_hda_bind_sw,
12068 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12069 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12074 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12075 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12076 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12080 static struct hda_verb alc268_eapd_verbs[] = {
12081 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12082 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12086 /* Toshiba specific */
12087 static struct hda_verb alc268_toshiba_verbs[] = {
12088 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12092 /* Acer specific */
12093 /* bind volumes of both NID 0x02 and 0x03 */
12094 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12095 .ops = &snd_hda_bind_vol,
12097 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12098 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12103 /* mute/unmute internal speaker according to the hp jack and mute state */
12104 static void alc268_acer_automute(struct hda_codec *codec, int force)
12106 struct alc_spec *spec = codec->spec;
12109 if (force || !spec->sense_updated) {
12110 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12111 spec->sense_updated = 1;
12113 if (spec->jack_present)
12114 mute = HDA_AMP_MUTE; /* mute internal speaker */
12115 else /* unmute internal speaker if necessary */
12116 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12117 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12118 HDA_AMP_MUTE, mute);
12122 /* bind hp and internal speaker mute (with plug check) */
12123 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12124 struct snd_ctl_elem_value *ucontrol)
12126 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12127 long *valp = ucontrol->value.integer.value;
12130 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12132 alc268_acer_automute(codec, 0);
12136 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12137 /* output mixer control */
12138 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12140 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12141 .name = "Master Playback Switch",
12142 .subdevice = HDA_SUBDEV_AMP_FLAG,
12143 .info = snd_hda_mixer_amp_switch_info,
12144 .get = snd_hda_mixer_amp_switch_get,
12145 .put = alc268_acer_master_sw_put,
12146 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12148 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12152 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12153 /* output mixer control */
12154 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12156 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12157 .name = "Master Playback Switch",
12158 .subdevice = HDA_SUBDEV_AMP_FLAG,
12159 .info = snd_hda_mixer_amp_switch_info,
12160 .get = snd_hda_mixer_amp_switch_get,
12161 .put = alc268_acer_master_sw_put,
12162 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12164 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12165 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12166 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12170 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12171 /* output mixer control */
12172 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12174 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12175 .name = "Master Playback Switch",
12176 .subdevice = HDA_SUBDEV_AMP_FLAG,
12177 .info = snd_hda_mixer_amp_switch_info,
12178 .get = snd_hda_mixer_amp_switch_get,
12179 .put = alc268_acer_master_sw_put,
12180 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12182 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12183 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12187 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12188 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12189 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12190 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12191 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12192 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12197 static struct hda_verb alc268_acer_verbs[] = {
12198 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12199 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12202 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12203 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12204 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12208 /* unsolicited event for HP jack sensing */
12209 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12210 #define alc268_toshiba_setup alc262_hippo_setup
12211 #define alc268_toshiba_automute alc262_hippo_automute
12213 static void alc268_acer_unsol_event(struct hda_codec *codec,
12216 if ((res >> 26) != ALC880_HP_EVENT)
12218 alc268_acer_automute(codec, 1);
12221 static void alc268_acer_init_hook(struct hda_codec *codec)
12223 alc268_acer_automute(codec, 1);
12226 /* toggle speaker-output according to the hp-jack state */
12227 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12229 unsigned int present;
12230 unsigned char bits;
12232 present = snd_hda_jack_detect(codec, 0x15);
12233 bits = present ? AMP_IN_MUTE(0) : 0;
12234 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12235 AMP_IN_MUTE(0), bits);
12236 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12237 AMP_IN_MUTE(0), bits);
12240 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12243 switch (res >> 26) {
12244 case ALC880_HP_EVENT:
12245 alc268_aspire_one_speaker_automute(codec);
12247 case ALC880_MIC_EVENT:
12248 alc_mic_automute(codec);
12253 static void alc268_acer_lc_setup(struct hda_codec *codec)
12255 struct alc_spec *spec = codec->spec;
12256 spec->ext_mic.pin = 0x18;
12257 spec->ext_mic.mux_idx = 0;
12258 spec->int_mic.pin = 0x12;
12259 spec->int_mic.mux_idx = 6;
12260 spec->auto_mic = 1;
12263 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12265 alc268_aspire_one_speaker_automute(codec);
12266 alc_mic_automute(codec);
12269 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12270 /* output mixer control */
12271 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12272 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12273 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12274 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12275 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12276 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12280 static struct hda_verb alc268_dell_verbs[] = {
12281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12283 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12284 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12288 /* mute/unmute internal speaker according to the hp jack and mute state */
12289 static void alc268_dell_setup(struct hda_codec *codec)
12291 struct alc_spec *spec = codec->spec;
12293 spec->autocfg.hp_pins[0] = 0x15;
12294 spec->autocfg.speaker_pins[0] = 0x14;
12295 spec->ext_mic.pin = 0x18;
12296 spec->ext_mic.mux_idx = 0;
12297 spec->int_mic.pin = 0x19;
12298 spec->int_mic.mux_idx = 1;
12299 spec->auto_mic = 1;
12302 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12303 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12304 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12305 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12306 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12307 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12308 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12309 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12310 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12314 static struct hda_verb alc267_quanta_il1_verbs[] = {
12315 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12316 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12320 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12322 struct alc_spec *spec = codec->spec;
12323 spec->autocfg.hp_pins[0] = 0x15;
12324 spec->autocfg.speaker_pins[0] = 0x14;
12325 spec->ext_mic.pin = 0x18;
12326 spec->ext_mic.mux_idx = 0;
12327 spec->int_mic.pin = 0x19;
12328 spec->int_mic.mux_idx = 1;
12329 spec->auto_mic = 1;
12333 * generic initialization of ADC, input mixers and output mixers
12335 static struct hda_verb alc268_base_init_verbs[] = {
12336 /* Unmute DAC0-1 and set vol = 0 */
12337 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12338 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12341 * Set up output mixers (0x0c - 0x0e)
12343 /* set vol=0 to output mixers */
12344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12345 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12348 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12352 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12353 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12354 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12355 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12356 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12357 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12359 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12360 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12361 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12362 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12363 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12365 /* set PCBEEP vol = 0, mute connections */
12366 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12367 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12368 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12370 /* Unmute Selector 23h,24h and set the default input to mic-in */
12372 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12374 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12381 * generic initialization of ADC, input mixers and output mixers
12383 static struct hda_verb alc268_volume_init_verbs[] = {
12384 /* set output DAC */
12385 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12386 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12388 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12389 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12390 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12391 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12392 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12395 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12396 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12398 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12399 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12401 /* set PCBEEP vol = 0, mute connections */
12402 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12403 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12404 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12409 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12410 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12411 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12415 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12416 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12417 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12422 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12423 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12424 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12425 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12426 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12431 static struct hda_input_mux alc268_capture_source = {
12435 { "Front Mic", 0x1 },
12441 static struct hda_input_mux alc268_acer_capture_source = {
12445 { "Internal Mic", 0x1 },
12450 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12454 { "Internal Mic", 0x6 },
12459 #ifdef CONFIG_SND_DEBUG
12460 static struct snd_kcontrol_new alc268_test_mixer[] = {
12461 /* Volume widgets */
12462 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12463 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12464 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12465 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12466 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12467 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12468 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12469 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12470 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12471 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12472 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12473 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12474 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12475 /* The below appears problematic on some hardwares */
12476 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12477 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12478 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12479 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12480 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12482 /* Modes for retasking pin widgets */
12483 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12484 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12485 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12486 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12488 /* Controls for GPIO pins, assuming they are configured as outputs */
12489 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12490 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12491 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12492 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12494 /* Switches to allow the digital SPDIF output pin to be enabled.
12495 * The ALC268 does not have an SPDIF input.
12497 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12499 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12500 * this output to turn on an external amplifier.
12502 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12503 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12509 /* create input playback/capture controls for the given pin */
12510 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12511 const char *ctlname, int idx)
12527 if (spec->multiout.dac_nids[0] != dac &&
12528 spec->multiout.dac_nids[1] != dac) {
12529 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12530 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12534 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12538 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12539 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12541 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12542 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12548 /* add playback controls from the parsed DAC table */
12549 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12550 const struct auto_pin_cfg *cfg)
12555 spec->multiout.dac_nids = spec->private_dac_nids;
12557 nid = cfg->line_out_pins[0];
12560 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12564 err = alc268_new_analog_output(spec, nid, name, 0);
12569 nid = cfg->speaker_pins[0];
12571 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12572 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12576 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12580 nid = cfg->hp_pins[0];
12582 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12587 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12589 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12590 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12597 /* create playback/capture controls for input pins */
12598 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12599 const struct auto_pin_cfg *cfg)
12601 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12604 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12605 hda_nid_t nid, int pin_type)
12609 alc_set_pin_output(codec, nid, pin_type);
12610 if (nid == 0x14 || nid == 0x16)
12614 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12617 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12619 struct alc_spec *spec = codec->spec;
12620 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12622 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12623 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12627 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12629 struct alc_spec *spec = codec->spec;
12632 pin = spec->autocfg.hp_pins[0];
12634 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12635 pin = spec->autocfg.speaker_pins[0];
12637 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12640 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12642 struct alc_spec *spec = codec->spec;
12643 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12644 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12645 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12646 unsigned int dac_vol1, dac_vol2;
12648 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12649 snd_hda_codec_write(codec, speaker_nid, 0,
12650 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12651 /* mute mixer inputs from 0x1d */
12652 snd_hda_codec_write(codec, 0x0f, 0,
12653 AC_VERB_SET_AMP_GAIN_MUTE,
12655 snd_hda_codec_write(codec, 0x10, 0,
12656 AC_VERB_SET_AMP_GAIN_MUTE,
12659 /* unmute mixer inputs from 0x1d */
12660 snd_hda_codec_write(codec, 0x0f, 0,
12661 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12662 snd_hda_codec_write(codec, 0x10, 0,
12663 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12666 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12667 if (line_nid == 0x14)
12668 dac_vol2 = AMP_OUT_ZERO;
12669 else if (line_nid == 0x15)
12670 dac_vol1 = AMP_OUT_ZERO;
12671 if (hp_nid == 0x14)
12672 dac_vol2 = AMP_OUT_ZERO;
12673 else if (hp_nid == 0x15)
12674 dac_vol1 = AMP_OUT_ZERO;
12675 if (line_nid != 0x16 || hp_nid != 0x16 ||
12676 spec->autocfg.line_out_pins[1] != 0x16 ||
12677 spec->autocfg.line_out_pins[2] != 0x16)
12678 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12680 snd_hda_codec_write(codec, 0x02, 0,
12681 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12682 snd_hda_codec_write(codec, 0x03, 0,
12683 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12686 /* pcm configuration: identical with ALC880 */
12687 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12688 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12689 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12690 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12693 * BIOS auto configuration
12695 static int alc268_parse_auto_config(struct hda_codec *codec)
12697 struct alc_spec *spec = codec->spec;
12699 static hda_nid_t alc268_ignore[] = { 0 };
12701 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12705 if (!spec->autocfg.line_outs) {
12706 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12707 spec->multiout.max_channels = 2;
12708 spec->no_analog = 1;
12711 return 0; /* can't find valid BIOS pin config */
12713 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12716 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12720 spec->multiout.max_channels = 2;
12723 /* digital only support output */
12724 if (spec->autocfg.dig_outs) {
12725 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12726 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12728 if (spec->kctls.list)
12729 add_mixer(spec, spec->kctls.list);
12731 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12732 add_mixer(spec, alc268_beep_mixer);
12734 add_verb(spec, alc268_volume_init_verbs);
12735 spec->num_mux_defs = 2;
12736 spec->input_mux = &spec->private_imux[0];
12738 err = alc_auto_add_mic_boost(codec);
12742 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12747 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12749 /* init callback for auto-configuration model -- overriding the default init */
12750 static void alc268_auto_init(struct hda_codec *codec)
12752 struct alc_spec *spec = codec->spec;
12753 alc268_auto_init_multi_out(codec);
12754 alc268_auto_init_hp_out(codec);
12755 alc268_auto_init_mono_speaker_out(codec);
12756 alc268_auto_init_analog_input(codec);
12757 if (spec->unsol_event)
12758 alc_inithook(codec);
12762 * configuration and preset
12764 static const char *alc268_models[ALC268_MODEL_LAST] = {
12765 [ALC267_QUANTA_IL1] = "quanta-il1",
12766 [ALC268_3ST] = "3stack",
12767 [ALC268_TOSHIBA] = "toshiba",
12768 [ALC268_ACER] = "acer",
12769 [ALC268_ACER_DMIC] = "acer-dmic",
12770 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12771 [ALC268_DELL] = "dell",
12772 [ALC268_ZEPTO] = "zepto",
12773 #ifdef CONFIG_SND_DEBUG
12774 [ALC268_TEST] = "test",
12776 [ALC268_AUTO] = "auto",
12779 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12780 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12781 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12782 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12783 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12784 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12785 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12786 ALC268_ACER_ASPIRE_ONE),
12787 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12788 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12789 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12790 /* almost compatible with toshiba but with optional digital outs;
12791 * auto-probing seems working fine
12793 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12795 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12796 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12797 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12798 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12799 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12800 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12804 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12805 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12806 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12807 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12808 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12813 static struct alc_config_preset alc268_presets[] = {
12814 [ALC267_QUANTA_IL1] = {
12815 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12816 alc268_capture_nosrc_mixer },
12817 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12818 alc267_quanta_il1_verbs },
12819 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12820 .dac_nids = alc268_dac_nids,
12821 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12822 .adc_nids = alc268_adc_nids_alt,
12824 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12825 .channel_mode = alc268_modes,
12826 .unsol_event = alc_sku_unsol_event,
12827 .setup = alc267_quanta_il1_setup,
12828 .init_hook = alc_inithook,
12831 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12832 alc268_beep_mixer },
12833 .init_verbs = { alc268_base_init_verbs },
12834 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12835 .dac_nids = alc268_dac_nids,
12836 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12837 .adc_nids = alc268_adc_nids_alt,
12838 .capsrc_nids = alc268_capsrc_nids,
12840 .dig_out_nid = ALC268_DIGOUT_NID,
12841 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12842 .channel_mode = alc268_modes,
12843 .input_mux = &alc268_capture_source,
12845 [ALC268_TOSHIBA] = {
12846 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12847 alc268_beep_mixer },
12848 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12849 alc268_toshiba_verbs },
12850 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12851 .dac_nids = alc268_dac_nids,
12852 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12853 .adc_nids = alc268_adc_nids_alt,
12854 .capsrc_nids = alc268_capsrc_nids,
12856 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12857 .channel_mode = alc268_modes,
12858 .input_mux = &alc268_capture_source,
12859 .unsol_event = alc268_toshiba_unsol_event,
12860 .setup = alc268_toshiba_setup,
12861 .init_hook = alc268_toshiba_automute,
12864 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12865 alc268_beep_mixer },
12866 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12867 alc268_acer_verbs },
12868 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12869 .dac_nids = alc268_dac_nids,
12870 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12871 .adc_nids = alc268_adc_nids_alt,
12872 .capsrc_nids = alc268_capsrc_nids,
12874 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12875 .channel_mode = alc268_modes,
12876 .input_mux = &alc268_acer_capture_source,
12877 .unsol_event = alc268_acer_unsol_event,
12878 .init_hook = alc268_acer_init_hook,
12880 [ALC268_ACER_DMIC] = {
12881 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12882 alc268_beep_mixer },
12883 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12884 alc268_acer_verbs },
12885 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12886 .dac_nids = alc268_dac_nids,
12887 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12888 .adc_nids = alc268_adc_nids_alt,
12889 .capsrc_nids = alc268_capsrc_nids,
12891 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12892 .channel_mode = alc268_modes,
12893 .input_mux = &alc268_acer_dmic_capture_source,
12894 .unsol_event = alc268_acer_unsol_event,
12895 .init_hook = alc268_acer_init_hook,
12897 [ALC268_ACER_ASPIRE_ONE] = {
12898 .mixers = { alc268_acer_aspire_one_mixer,
12900 alc268_capture_nosrc_mixer },
12901 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12902 alc268_acer_aspire_one_verbs },
12903 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12904 .dac_nids = alc268_dac_nids,
12905 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12906 .adc_nids = alc268_adc_nids_alt,
12907 .capsrc_nids = alc268_capsrc_nids,
12909 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12910 .channel_mode = alc268_modes,
12911 .unsol_event = alc268_acer_lc_unsol_event,
12912 .setup = alc268_acer_lc_setup,
12913 .init_hook = alc268_acer_lc_init_hook,
12916 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12917 alc268_capture_nosrc_mixer },
12918 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12919 alc268_dell_verbs },
12920 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12921 .dac_nids = alc268_dac_nids,
12922 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12923 .adc_nids = alc268_adc_nids_alt,
12924 .capsrc_nids = alc268_capsrc_nids,
12926 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12927 .channel_mode = alc268_modes,
12928 .unsol_event = alc_sku_unsol_event,
12929 .setup = alc268_dell_setup,
12930 .init_hook = alc_inithook,
12933 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12934 alc268_beep_mixer },
12935 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12936 alc268_toshiba_verbs },
12937 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12938 .dac_nids = alc268_dac_nids,
12939 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12940 .adc_nids = alc268_adc_nids_alt,
12941 .capsrc_nids = alc268_capsrc_nids,
12943 .dig_out_nid = ALC268_DIGOUT_NID,
12944 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12945 .channel_mode = alc268_modes,
12946 .input_mux = &alc268_capture_source,
12947 .setup = alc268_toshiba_setup,
12948 .init_hook = alc268_toshiba_automute,
12950 #ifdef CONFIG_SND_DEBUG
12952 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12953 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12954 alc268_volume_init_verbs },
12955 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12956 .dac_nids = alc268_dac_nids,
12957 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12958 .adc_nids = alc268_adc_nids_alt,
12959 .capsrc_nids = alc268_capsrc_nids,
12961 .dig_out_nid = ALC268_DIGOUT_NID,
12962 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12963 .channel_mode = alc268_modes,
12964 .input_mux = &alc268_capture_source,
12969 static int patch_alc268(struct hda_codec *codec)
12971 struct alc_spec *spec;
12973 int i, has_beep, err;
12975 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12979 codec->spec = spec;
12981 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12985 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12986 board_config = snd_hda_check_board_codec_sid_config(codec,
12987 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12989 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12990 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12992 board_config = ALC268_AUTO;
12995 if (board_config == ALC268_AUTO) {
12996 /* automatic parse from the BIOS config */
12997 err = alc268_parse_auto_config(codec);
13003 "hda_codec: Cannot set up configuration "
13004 "from BIOS. Using base mode...\n");
13005 board_config = ALC268_3ST;
13009 if (board_config != ALC268_AUTO)
13010 setup_preset(codec, &alc268_presets[board_config]);
13012 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13013 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13014 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13016 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13019 for (i = 0; i < spec->num_mixers; i++) {
13020 if (spec->mixers[i] == alc268_beep_mixer) {
13027 err = snd_hda_attach_beep_device(codec, 0x1);
13032 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13033 /* override the amp caps for beep generator */
13034 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13035 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13036 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13037 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13038 (0 << AC_AMPCAP_MUTE_SHIFT));
13041 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13042 /* check whether NID 0x07 is valid */
13043 unsigned int wcap = get_wcaps(codec, 0x07);
13046 spec->capsrc_nids = alc268_capsrc_nids;
13048 wcap = get_wcaps_type(wcap);
13049 if (spec->auto_mic ||
13050 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13051 spec->adc_nids = alc268_adc_nids_alt;
13052 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13053 if (spec->auto_mic)
13054 fixup_automic_adc(codec);
13055 if (spec->auto_mic || spec->input_mux->num_items == 1)
13056 add_mixer(spec, alc268_capture_nosrc_mixer);
13058 add_mixer(spec, alc268_capture_alt_mixer);
13060 spec->adc_nids = alc268_adc_nids;
13061 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13062 add_mixer(spec, alc268_capture_mixer);
13064 /* set default input source */
13065 for (i = 0; i < spec->num_adc_nids; i++)
13066 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13067 0, AC_VERB_SET_CONNECT_SEL,
13068 i < spec->num_mux_defs ?
13069 spec->input_mux[i].items[0].index :
13070 spec->input_mux->items[0].index);
13073 spec->vmaster_nid = 0x02;
13075 codec->patch_ops = alc_patch_ops;
13076 if (board_config == ALC268_AUTO)
13077 spec->init_hook = alc268_auto_init;
13079 codec->proc_widget_hook = print_realtek_coef;
13085 * ALC269 channel source setting (2 channel)
13087 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13089 #define alc269_dac_nids alc260_dac_nids
13091 static hda_nid_t alc269_adc_nids[1] = {
13096 static hda_nid_t alc269_capsrc_nids[1] = {
13100 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13104 #define alc269_modes alc260_modes
13105 #define alc269_capture_source alc880_lg_lw_capture_source
13107 static struct snd_kcontrol_new alc269_base_mixer[] = {
13108 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13109 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13110 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13111 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13113 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13114 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13115 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13116 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13117 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13119 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13123 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13124 /* output mixer control */
13125 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13127 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13128 .name = "Master Playback Switch",
13129 .subdevice = HDA_SUBDEV_AMP_FLAG,
13130 .info = snd_hda_mixer_amp_switch_info,
13131 .get = snd_hda_mixer_amp_switch_get,
13132 .put = alc268_acer_master_sw_put,
13133 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13138 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13139 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13140 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13144 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13145 /* output mixer control */
13146 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13148 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13149 .name = "Master Playback Switch",
13150 .subdevice = HDA_SUBDEV_AMP_FLAG,
13151 .info = snd_hda_mixer_amp_switch_info,
13152 .get = snd_hda_mixer_amp_switch_get,
13153 .put = alc268_acer_master_sw_put,
13154 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13156 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13158 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13159 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13160 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13161 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13162 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13163 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13164 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13168 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13169 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13170 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13172 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13176 /* capture mixer elements */
13177 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13178 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13179 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13180 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13185 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13187 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13188 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13189 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13190 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13191 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13192 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13193 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13197 static struct hda_verb alc269_lifebook_verbs[] = {
13198 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13199 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13200 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13202 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13203 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13204 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13205 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13206 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13207 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13211 /* toggle speaker-output according to the hp-jack state */
13212 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13214 unsigned int present;
13215 unsigned char bits;
13217 present = snd_hda_jack_detect(codec, 0x15);
13218 bits = present ? AMP_IN_MUTE(0) : 0;
13219 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13220 AMP_IN_MUTE(0), bits);
13221 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13222 AMP_IN_MUTE(0), bits);
13224 snd_hda_codec_write(codec, 0x20, 0,
13225 AC_VERB_SET_COEF_INDEX, 0x0c);
13226 snd_hda_codec_write(codec, 0x20, 0,
13227 AC_VERB_SET_PROC_COEF, 0x680);
13229 snd_hda_codec_write(codec, 0x20, 0,
13230 AC_VERB_SET_COEF_INDEX, 0x0c);
13231 snd_hda_codec_write(codec, 0x20, 0,
13232 AC_VERB_SET_PROC_COEF, 0x480);
13235 /* toggle speaker-output according to the hp-jacks state */
13236 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13238 unsigned int present;
13239 unsigned char bits;
13241 /* Check laptop headphone socket */
13242 present = snd_hda_jack_detect(codec, 0x15);
13244 /* Check port replicator headphone socket */
13245 present |= snd_hda_jack_detect(codec, 0x1a);
13247 bits = present ? AMP_IN_MUTE(0) : 0;
13248 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13249 AMP_IN_MUTE(0), bits);
13250 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13251 AMP_IN_MUTE(0), bits);
13253 snd_hda_codec_write(codec, 0x20, 0,
13254 AC_VERB_SET_COEF_INDEX, 0x0c);
13255 snd_hda_codec_write(codec, 0x20, 0,
13256 AC_VERB_SET_PROC_COEF, 0x680);
13258 snd_hda_codec_write(codec, 0x20, 0,
13259 AC_VERB_SET_COEF_INDEX, 0x0c);
13260 snd_hda_codec_write(codec, 0x20, 0,
13261 AC_VERB_SET_PROC_COEF, 0x480);
13264 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13266 unsigned int present_laptop;
13267 unsigned int present_dock;
13269 present_laptop = snd_hda_jack_detect(codec, 0x18);
13270 present_dock = snd_hda_jack_detect(codec, 0x1b);
13272 /* Laptop mic port overrides dock mic port, design decision */
13274 snd_hda_codec_write(codec, 0x23, 0,
13275 AC_VERB_SET_CONNECT_SEL, 0x3);
13276 if (present_laptop)
13277 snd_hda_codec_write(codec, 0x23, 0,
13278 AC_VERB_SET_CONNECT_SEL, 0x0);
13279 if (!present_dock && !present_laptop)
13280 snd_hda_codec_write(codec, 0x23, 0,
13281 AC_VERB_SET_CONNECT_SEL, 0x1);
13284 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13287 switch (res >> 26) {
13288 case ALC880_HP_EVENT:
13289 alc269_quanta_fl1_speaker_automute(codec);
13291 case ALC880_MIC_EVENT:
13292 alc_mic_automute(codec);
13297 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13300 if ((res >> 26) == ALC880_HP_EVENT)
13301 alc269_lifebook_speaker_automute(codec);
13302 if ((res >> 26) == ALC880_MIC_EVENT)
13303 alc269_lifebook_mic_autoswitch(codec);
13306 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13308 struct alc_spec *spec = codec->spec;
13309 spec->ext_mic.pin = 0x18;
13310 spec->ext_mic.mux_idx = 0;
13311 spec->int_mic.pin = 0x19;
13312 spec->int_mic.mux_idx = 1;
13313 spec->auto_mic = 1;
13316 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13318 alc269_quanta_fl1_speaker_automute(codec);
13319 alc_mic_automute(codec);
13322 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13324 alc269_lifebook_speaker_automute(codec);
13325 alc269_lifebook_mic_autoswitch(codec);
13328 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13329 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13330 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13331 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13332 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13333 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13334 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13335 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13339 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13340 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13341 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13342 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13343 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13344 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13345 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13349 /* toggle speaker-output according to the hp-jack state */
13350 static void alc269_speaker_automute(struct hda_codec *codec)
13352 struct alc_spec *spec = codec->spec;
13353 unsigned int nid = spec->autocfg.hp_pins[0];
13354 unsigned int present;
13355 unsigned char bits;
13357 present = snd_hda_jack_detect(codec, nid);
13358 bits = present ? AMP_IN_MUTE(0) : 0;
13359 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13360 AMP_IN_MUTE(0), bits);
13361 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13362 AMP_IN_MUTE(0), bits);
13365 /* unsolicited event for HP jack sensing */
13366 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13369 switch (res >> 26) {
13370 case ALC880_HP_EVENT:
13371 alc269_speaker_automute(codec);
13373 case ALC880_MIC_EVENT:
13374 alc_mic_automute(codec);
13379 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13381 struct alc_spec *spec = codec->spec;
13382 spec->ext_mic.pin = 0x18;
13383 spec->ext_mic.mux_idx = 0;
13384 spec->int_mic.pin = 0x12;
13385 spec->int_mic.mux_idx = 5;
13386 spec->auto_mic = 1;
13389 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13391 struct alc_spec *spec = codec->spec;
13392 spec->ext_mic.pin = 0x18;
13393 spec->ext_mic.mux_idx = 0;
13394 spec->int_mic.pin = 0x19;
13395 spec->int_mic.mux_idx = 1;
13396 spec->auto_mic = 1;
13399 static void alc269_eeepc_inithook(struct hda_codec *codec)
13401 alc269_speaker_automute(codec);
13402 alc_mic_automute(codec);
13406 * generic initialization of ADC, input mixers and output mixers
13408 static struct hda_verb alc269_init_verbs[] = {
13410 * Unmute ADC0 and set the default input to mic-in
13412 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13414 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13415 * analog-loopback mixer widget
13416 * Note: PASD motherboards uses the Line In 2 as the input for
13417 * front panel mic (mic 2)
13419 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13421 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13422 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13423 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13424 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13427 * Set up output mixers (0x0c - 0x0e)
13429 /* set vol=0 to output mixers */
13430 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13431 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13433 /* set up input amps for analog loopback */
13434 /* Amp Indices: DAC = 0, mixer = 1 */
13435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13436 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13437 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13438 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13439 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13444 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13445 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13446 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13447 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13448 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13450 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13451 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13452 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13453 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13454 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13455 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13456 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13458 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13459 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13461 /* FIXME: use matrix-type input source selection */
13462 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13463 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13464 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13465 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13467 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13470 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13471 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13475 #define alc269_auto_create_multi_out_ctls \
13476 alc268_auto_create_multi_out_ctls
13477 #define alc269_auto_create_input_ctls \
13478 alc268_auto_create_input_ctls
13480 #ifdef CONFIG_SND_HDA_POWER_SAVE
13481 #define alc269_loopbacks alc880_loopbacks
13484 /* pcm configuration: identical with ALC880 */
13485 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13486 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13487 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13488 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13490 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13494 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13495 /* NID is set in alc_build_pcms */
13497 .open = alc880_playback_pcm_open,
13498 .prepare = alc880_playback_pcm_prepare,
13499 .cleanup = alc880_playback_pcm_cleanup
13503 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13507 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13508 /* NID is set in alc_build_pcms */
13512 * BIOS auto configuration
13514 static int alc269_parse_auto_config(struct hda_codec *codec)
13516 struct alc_spec *spec = codec->spec;
13518 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13520 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13525 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13528 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13532 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13534 if (spec->autocfg.dig_outs)
13535 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13537 if (spec->kctls.list)
13538 add_mixer(spec, spec->kctls.list);
13540 add_verb(spec, alc269_init_verbs);
13541 spec->num_mux_defs = 1;
13542 spec->input_mux = &spec->private_imux[0];
13543 /* set default input source */
13544 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13545 0, AC_VERB_SET_CONNECT_SEL,
13546 spec->input_mux->items[0].index);
13548 err = alc_auto_add_mic_boost(codec);
13552 if (!spec->cap_mixer && !spec->no_analog)
13553 set_capture_mixer(codec);
13555 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13560 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13561 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13562 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13565 /* init callback for auto-configuration model -- overriding the default init */
13566 static void alc269_auto_init(struct hda_codec *codec)
13568 struct alc_spec *spec = codec->spec;
13569 alc269_auto_init_multi_out(codec);
13570 alc269_auto_init_hp_out(codec);
13571 alc269_auto_init_analog_input(codec);
13572 if (spec->unsol_event)
13573 alc_inithook(codec);
13577 * configuration and preset
13579 static const char *alc269_models[ALC269_MODEL_LAST] = {
13580 [ALC269_BASIC] = "basic",
13581 [ALC269_QUANTA_FL1] = "quanta",
13582 [ALC269_ASUS_AMIC] = "asus-amic",
13583 [ALC269_ASUS_DMIC] = "asus-dmic",
13584 [ALC269_FUJITSU] = "fujitsu",
13585 [ALC269_LIFEBOOK] = "lifebook",
13586 [ALC269_AUTO] = "auto",
13589 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13590 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13591 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13593 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13594 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13595 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13596 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13597 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13598 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13599 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13600 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13601 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13602 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13603 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13604 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13605 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13606 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13607 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13608 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13609 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13610 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13611 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13612 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13613 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13614 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13615 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13616 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13617 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13618 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13619 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13620 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13621 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13623 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13625 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13626 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13627 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13628 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13632 static struct alc_config_preset alc269_presets[] = {
13634 .mixers = { alc269_base_mixer },
13635 .init_verbs = { alc269_init_verbs },
13636 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13637 .dac_nids = alc269_dac_nids,
13639 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13640 .channel_mode = alc269_modes,
13641 .input_mux = &alc269_capture_source,
13643 [ALC269_QUANTA_FL1] = {
13644 .mixers = { alc269_quanta_fl1_mixer },
13645 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13646 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13647 .dac_nids = alc269_dac_nids,
13649 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13650 .channel_mode = alc269_modes,
13651 .input_mux = &alc269_capture_source,
13652 .unsol_event = alc269_quanta_fl1_unsol_event,
13653 .setup = alc269_quanta_fl1_setup,
13654 .init_hook = alc269_quanta_fl1_init_hook,
13656 [ALC269_ASUS_AMIC] = {
13657 .mixers = { alc269_eeepc_mixer },
13658 .cap_mixer = alc269_epc_capture_mixer,
13659 .init_verbs = { alc269_init_verbs,
13660 alc269_eeepc_amic_init_verbs },
13661 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13662 .dac_nids = alc269_dac_nids,
13664 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13665 .channel_mode = alc269_modes,
13666 .unsol_event = alc269_eeepc_unsol_event,
13667 .setup = alc269_eeepc_amic_setup,
13668 .init_hook = alc269_eeepc_inithook,
13670 [ALC269_ASUS_DMIC] = {
13671 .mixers = { alc269_eeepc_mixer },
13672 .cap_mixer = alc269_epc_capture_mixer,
13673 .init_verbs = { alc269_init_verbs,
13674 alc269_eeepc_dmic_init_verbs },
13675 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13676 .dac_nids = alc269_dac_nids,
13678 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13679 .channel_mode = alc269_modes,
13680 .unsol_event = alc269_eeepc_unsol_event,
13681 .setup = alc269_eeepc_dmic_setup,
13682 .init_hook = alc269_eeepc_inithook,
13684 [ALC269_FUJITSU] = {
13685 .mixers = { alc269_fujitsu_mixer },
13686 .cap_mixer = alc269_epc_capture_mixer,
13687 .init_verbs = { alc269_init_verbs,
13688 alc269_eeepc_dmic_init_verbs },
13689 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13690 .dac_nids = alc269_dac_nids,
13692 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13693 .channel_mode = alc269_modes,
13694 .unsol_event = alc269_eeepc_unsol_event,
13695 .setup = alc269_eeepc_dmic_setup,
13696 .init_hook = alc269_eeepc_inithook,
13698 [ALC269_LIFEBOOK] = {
13699 .mixers = { alc269_lifebook_mixer },
13700 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13701 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13702 .dac_nids = alc269_dac_nids,
13704 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13705 .channel_mode = alc269_modes,
13706 .input_mux = &alc269_capture_source,
13707 .unsol_event = alc269_lifebook_unsol_event,
13708 .init_hook = alc269_lifebook_init_hook,
13712 static int patch_alc269(struct hda_codec *codec)
13714 struct alc_spec *spec;
13718 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13722 codec->spec = spec;
13724 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13726 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13727 kfree(codec->chip_name);
13728 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13729 if (!codec->chip_name) {
13735 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13739 if (board_config < 0) {
13740 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13742 board_config = ALC269_AUTO;
13745 if (board_config == ALC269_AUTO) {
13746 /* automatic parse from the BIOS config */
13747 err = alc269_parse_auto_config(codec);
13753 "hda_codec: Cannot set up configuration "
13754 "from BIOS. Using base mode...\n");
13755 board_config = ALC269_BASIC;
13759 err = snd_hda_attach_beep_device(codec, 0x1);
13765 if (board_config != ALC269_AUTO)
13766 setup_preset(codec, &alc269_presets[board_config]);
13768 if (codec->subsystem_id == 0x17aa3bf8) {
13769 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13770 * fix the sample rate of analog I/O to 44.1kHz
13772 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13773 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13775 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13776 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13778 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13779 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13781 spec->adc_nids = alc269_adc_nids;
13782 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13783 spec->capsrc_nids = alc269_capsrc_nids;
13784 if (!spec->cap_mixer)
13785 set_capture_mixer(codec);
13786 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13788 spec->vmaster_nid = 0x02;
13790 codec->patch_ops = alc_patch_ops;
13791 if (board_config == ALC269_AUTO)
13792 spec->init_hook = alc269_auto_init;
13793 #ifdef CONFIG_SND_HDA_POWER_SAVE
13794 if (!spec->loopback.amplist)
13795 spec->loopback.amplist = alc269_loopbacks;
13797 codec->proc_widget_hook = print_realtek_coef;
13803 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13807 * set the path ways for 2 channel output
13808 * need to set the codec line out and mic 1 pin widgets to inputs
13810 static struct hda_verb alc861_threestack_ch2_init[] = {
13811 /* set pin widget 1Ah (line in) for input */
13812 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13813 /* set pin widget 18h (mic1/2) for input, for mic also enable
13816 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13818 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13820 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13821 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13827 * need to set the codec line out and mic 1 pin widgets to outputs
13829 static struct hda_verb alc861_threestack_ch6_init[] = {
13830 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13831 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13832 /* set pin widget 18h (mic1) for output (CLFE)*/
13833 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13835 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13836 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13838 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13840 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13841 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13846 static struct hda_channel_mode alc861_threestack_modes[2] = {
13847 { 2, alc861_threestack_ch2_init },
13848 { 6, alc861_threestack_ch6_init },
13850 /* Set mic1 as input and unmute the mixer */
13851 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13852 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13853 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13856 /* Set mic1 as output and mute mixer */
13857 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13858 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13859 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13863 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13864 { 2, alc861_uniwill_m31_ch2_init },
13865 { 4, alc861_uniwill_m31_ch4_init },
13868 /* Set mic1 and line-in as input and unmute the mixer */
13869 static struct hda_verb alc861_asus_ch2_init[] = {
13870 /* set pin widget 1Ah (line in) for input */
13871 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13872 /* set pin widget 18h (mic1/2) for input, for mic also enable
13875 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13877 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13879 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13880 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13884 /* Set mic1 nad line-in as output and mute mixer */
13885 static struct hda_verb alc861_asus_ch6_init[] = {
13886 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13887 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13888 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13889 /* set pin widget 18h (mic1) for output (CLFE)*/
13890 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13891 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13892 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13893 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13895 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13897 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13898 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13903 static struct hda_channel_mode alc861_asus_modes[2] = {
13904 { 2, alc861_asus_ch2_init },
13905 { 6, alc861_asus_ch6_init },
13910 static struct snd_kcontrol_new alc861_base_mixer[] = {
13911 /* output mixer control */
13912 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13913 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13914 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13915 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13916 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13918 /*Input mixer control */
13919 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13920 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13921 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13922 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13923 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13924 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13925 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13926 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13927 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13928 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13933 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13934 /* output mixer control */
13935 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13936 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13937 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13938 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13939 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13941 /* Input mixer control */
13942 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13943 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13944 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13945 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13946 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13947 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13948 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13949 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13950 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13954 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13955 .name = "Channel Mode",
13956 .info = alc_ch_mode_info,
13957 .get = alc_ch_mode_get,
13958 .put = alc_ch_mode_put,
13959 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13964 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13965 /* output mixer control */
13966 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13968 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13973 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13974 /* output mixer control */
13975 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13976 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13977 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13978 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13979 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13981 /* Input mixer control */
13982 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13983 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13984 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13985 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13986 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13987 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13989 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13990 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13991 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13994 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13995 .name = "Channel Mode",
13996 .info = alc_ch_mode_info,
13997 .get = alc_ch_mode_get,
13998 .put = alc_ch_mode_put,
13999 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14004 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14005 /* output mixer control */
14006 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14007 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14008 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14009 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14010 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14012 /* Input mixer control */
14013 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14014 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14015 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14016 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14017 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14018 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14020 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14021 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14022 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14025 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14026 .name = "Channel Mode",
14027 .info = alc_ch_mode_info,
14028 .get = alc_ch_mode_get,
14029 .put = alc_ch_mode_put,
14030 .private_value = ARRAY_SIZE(alc861_asus_modes),
14035 /* additional mixer */
14036 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14037 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14038 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14043 * generic initialization of ADC, input mixers and output mixers
14045 static struct hda_verb alc861_base_init_verbs[] = {
14047 * Unmute ADC0 and set the default input to mic-in
14049 /* port-A for surround (rear panel) */
14050 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14051 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14052 /* port-B for mic-in (rear panel) with vref */
14053 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14054 /* port-C for line-in (rear panel) */
14055 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14056 /* port-D for Front */
14057 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14058 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14059 /* port-E for HP out (front panel) */
14060 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14061 /* route front PCM to HP */
14062 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14063 /* port-F for mic-in (front panel) with vref */
14064 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14065 /* port-G for CLFE (rear panel) */
14066 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14067 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14068 /* port-H for side (rear panel) */
14069 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14070 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14072 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14073 /* route front mic to ADC1*/
14074 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14075 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14077 /* Unmute DAC0~3 & spdif out*/
14078 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14079 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14080 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14081 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14082 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14084 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14085 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14086 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14087 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14088 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14090 /* Unmute Stereo Mixer 15 */
14091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14093 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14094 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14096 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14097 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14098 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14099 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14100 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14101 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14102 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14103 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14104 /* hp used DAC 3 (Front) */
14105 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14106 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14111 static struct hda_verb alc861_threestack_init_verbs[] = {
14113 * Unmute ADC0 and set the default input to mic-in
14115 /* port-A for surround (rear panel) */
14116 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14117 /* port-B for mic-in (rear panel) with vref */
14118 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14119 /* port-C for line-in (rear panel) */
14120 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14121 /* port-D for Front */
14122 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14123 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14124 /* port-E for HP out (front panel) */
14125 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14126 /* route front PCM to HP */
14127 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14128 /* port-F for mic-in (front panel) with vref */
14129 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14130 /* port-G for CLFE (rear panel) */
14131 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14132 /* port-H for side (rear panel) */
14133 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14135 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14136 /* route front mic to ADC1*/
14137 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14138 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14139 /* Unmute DAC0~3 & spdif out*/
14140 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14141 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14142 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14143 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14144 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14146 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14147 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14148 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14149 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14150 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14152 /* Unmute Stereo Mixer 15 */
14153 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14154 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14155 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14156 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14158 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14159 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14160 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14161 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14162 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14163 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14164 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14165 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14166 /* hp used DAC 3 (Front) */
14167 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14168 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14172 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14174 * Unmute ADC0 and set the default input to mic-in
14176 /* port-A for surround (rear panel) */
14177 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14178 /* port-B for mic-in (rear panel) with vref */
14179 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14180 /* port-C for line-in (rear panel) */
14181 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14182 /* port-D for Front */
14183 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14184 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14185 /* port-E for HP out (front panel) */
14186 /* this has to be set to VREF80 */
14187 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14188 /* route front PCM to HP */
14189 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14190 /* port-F for mic-in (front panel) with vref */
14191 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14192 /* port-G for CLFE (rear panel) */
14193 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14194 /* port-H for side (rear panel) */
14195 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14197 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14198 /* route front mic to ADC1*/
14199 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14201 /* Unmute DAC0~3 & spdif out*/
14202 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14203 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14204 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14205 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14206 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14208 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14209 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14210 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14211 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14212 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14214 /* Unmute Stereo Mixer 15 */
14215 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14216 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14217 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14218 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14220 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14221 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14222 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14223 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14224 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14225 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14226 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14227 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14228 /* hp used DAC 3 (Front) */
14229 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14230 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14234 static struct hda_verb alc861_asus_init_verbs[] = {
14236 * Unmute ADC0 and set the default input to mic-in
14238 /* port-A for surround (rear panel)
14239 * according to codec#0 this is the HP jack
14241 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14242 /* route front PCM to HP */
14243 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14244 /* port-B for mic-in (rear panel) with vref */
14245 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14246 /* port-C for line-in (rear panel) */
14247 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14248 /* port-D for Front */
14249 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14250 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14251 /* port-E for HP out (front panel) */
14252 /* this has to be set to VREF80 */
14253 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14254 /* route front PCM to HP */
14255 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14256 /* port-F for mic-in (front panel) with vref */
14257 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14258 /* port-G for CLFE (rear panel) */
14259 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14260 /* port-H for side (rear panel) */
14261 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14263 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14264 /* route front mic to ADC1*/
14265 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14266 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14267 /* Unmute DAC0~3 & spdif out*/
14268 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14269 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14270 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14271 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14273 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14274 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14275 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14276 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14277 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14279 /* Unmute Stereo Mixer 15 */
14280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14285 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14286 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14287 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14288 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14289 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14290 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14291 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14292 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14293 /* hp used DAC 3 (Front) */
14294 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14295 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14299 /* additional init verbs for ASUS laptops */
14300 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14301 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14302 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14307 * generic initialization of ADC, input mixers and output mixers
14309 static struct hda_verb alc861_auto_init_verbs[] = {
14311 * Unmute ADC0 and set the default input to mic-in
14313 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14314 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14316 /* Unmute DAC0~3 & spdif out*/
14317 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14318 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14319 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14320 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14321 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14323 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14324 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14325 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14326 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14327 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14329 /* Unmute Stereo Mixer 15 */
14330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14333 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14335 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14336 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14337 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14338 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14339 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14340 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14341 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14342 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14344 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14345 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14346 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14347 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14348 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14349 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14350 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14351 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14353 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14358 static struct hda_verb alc861_toshiba_init_verbs[] = {
14359 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14364 /* toggle speaker-output according to the hp-jack state */
14365 static void alc861_toshiba_automute(struct hda_codec *codec)
14367 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14369 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14370 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14371 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14372 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14375 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14378 if ((res >> 26) == ALC880_HP_EVENT)
14379 alc861_toshiba_automute(codec);
14382 /* pcm configuration: identical with ALC880 */
14383 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14384 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14385 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14386 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14389 #define ALC861_DIGOUT_NID 0x07
14391 static struct hda_channel_mode alc861_8ch_modes[1] = {
14395 static hda_nid_t alc861_dac_nids[4] = {
14396 /* front, surround, clfe, side */
14397 0x03, 0x06, 0x05, 0x04
14400 static hda_nid_t alc660_dac_nids[3] = {
14401 /* front, clfe, surround */
14405 static hda_nid_t alc861_adc_nids[1] = {
14410 static struct hda_input_mux alc861_capture_source = {
14414 { "Front Mic", 0x3 },
14421 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14423 struct alc_spec *spec = codec->spec;
14424 hda_nid_t mix, srcs[5];
14427 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14429 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14432 for (i = 0; i < num; i++) {
14434 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14435 if (type != AC_WID_AUD_OUT)
14437 for (j = 0; j < spec->multiout.num_dacs; j++)
14438 if (spec->multiout.dac_nids[j] == srcs[i])
14440 if (j >= spec->multiout.num_dacs)
14446 /* fill in the dac_nids table from the parsed pin configuration */
14447 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14448 const struct auto_pin_cfg *cfg)
14450 struct alc_spec *spec = codec->spec;
14452 hda_nid_t nid, dac;
14454 spec->multiout.dac_nids = spec->private_dac_nids;
14455 for (i = 0; i < cfg->line_outs; i++) {
14456 nid = cfg->line_out_pins[i];
14457 dac = alc861_look_for_dac(codec, nid);
14460 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14465 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14466 hda_nid_t nid, unsigned int chs)
14468 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14469 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14472 /* add playback controls from the parsed DAC table */
14473 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14474 const struct auto_pin_cfg *cfg)
14476 struct alc_spec *spec = codec->spec;
14477 static const char *chname[4] = {
14478 "Front", "Surround", NULL /*CLFE*/, "Side"
14483 if (cfg->line_outs == 1) {
14484 const char *pfx = NULL;
14487 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14490 nid = spec->multiout.dac_nids[0];
14491 return alc861_create_out_sw(codec, pfx, nid, 3);
14495 for (i = 0; i < cfg->line_outs; i++) {
14496 nid = spec->multiout.dac_nids[i];
14501 err = alc861_create_out_sw(codec, "Center", nid, 1);
14504 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14508 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14516 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14518 struct alc_spec *spec = codec->spec;
14525 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14526 nid = alc861_look_for_dac(codec, pin);
14528 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14531 spec->multiout.hp_nid = nid;
14537 /* create playback/capture controls for input pins */
14538 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14539 const struct auto_pin_cfg *cfg)
14541 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14544 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14546 int pin_type, hda_nid_t dac)
14548 hda_nid_t mix, srcs[5];
14551 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14553 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14555 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14557 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14560 for (i = 0; i < num; i++) {
14562 if (srcs[i] == dac || srcs[i] == 0x15)
14563 mute = AMP_IN_UNMUTE(i);
14565 mute = AMP_IN_MUTE(i);
14566 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14571 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14573 struct alc_spec *spec = codec->spec;
14576 for (i = 0; i < spec->autocfg.line_outs; i++) {
14577 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14578 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14580 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14581 spec->multiout.dac_nids[i]);
14585 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14587 struct alc_spec *spec = codec->spec;
14589 if (spec->autocfg.hp_outs)
14590 alc861_auto_set_output_and_unmute(codec,
14591 spec->autocfg.hp_pins[0],
14593 spec->multiout.hp_nid);
14594 if (spec->autocfg.speaker_outs)
14595 alc861_auto_set_output_and_unmute(codec,
14596 spec->autocfg.speaker_pins[0],
14598 spec->multiout.dac_nids[0]);
14601 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14603 struct alc_spec *spec = codec->spec;
14606 for (i = 0; i < AUTO_PIN_LAST; i++) {
14607 hda_nid_t nid = spec->autocfg.input_pins[i];
14608 if (nid >= 0x0c && nid <= 0x11)
14609 alc_set_input_pin(codec, nid, i);
14613 /* parse the BIOS configuration and set up the alc_spec */
14614 /* return 1 if successful, 0 if the proper config is not found,
14615 * or a negative error code
14617 static int alc861_parse_auto_config(struct hda_codec *codec)
14619 struct alc_spec *spec = codec->spec;
14621 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14623 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14627 if (!spec->autocfg.line_outs)
14628 return 0; /* can't find valid BIOS pin config */
14630 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14633 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14636 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14639 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14643 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14645 if (spec->autocfg.dig_outs)
14646 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14648 if (spec->kctls.list)
14649 add_mixer(spec, spec->kctls.list);
14651 add_verb(spec, alc861_auto_init_verbs);
14653 spec->num_mux_defs = 1;
14654 spec->input_mux = &spec->private_imux[0];
14656 spec->adc_nids = alc861_adc_nids;
14657 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14658 set_capture_mixer(codec);
14660 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14665 /* additional initialization for auto-configuration model */
14666 static void alc861_auto_init(struct hda_codec *codec)
14668 struct alc_spec *spec = codec->spec;
14669 alc861_auto_init_multi_out(codec);
14670 alc861_auto_init_hp_out(codec);
14671 alc861_auto_init_analog_input(codec);
14672 if (spec->unsol_event)
14673 alc_inithook(codec);
14676 #ifdef CONFIG_SND_HDA_POWER_SAVE
14677 static struct hda_amp_list alc861_loopbacks[] = {
14678 { 0x15, HDA_INPUT, 0 },
14679 { 0x15, HDA_INPUT, 1 },
14680 { 0x15, HDA_INPUT, 2 },
14681 { 0x15, HDA_INPUT, 3 },
14688 * configuration and preset
14690 static const char *alc861_models[ALC861_MODEL_LAST] = {
14691 [ALC861_3ST] = "3stack",
14692 [ALC660_3ST] = "3stack-660",
14693 [ALC861_3ST_DIG] = "3stack-dig",
14694 [ALC861_6ST_DIG] = "6stack-dig",
14695 [ALC861_UNIWILL_M31] = "uniwill-m31",
14696 [ALC861_TOSHIBA] = "toshiba",
14697 [ALC861_ASUS] = "asus",
14698 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14699 [ALC861_AUTO] = "auto",
14702 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14703 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14704 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14705 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14706 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14707 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14708 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14709 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14710 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14711 * Any other models that need this preset?
14713 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14714 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14715 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14716 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14717 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14718 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14719 /* FIXME: the below seems conflict */
14720 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14721 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14722 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14726 static struct alc_config_preset alc861_presets[] = {
14728 .mixers = { alc861_3ST_mixer },
14729 .init_verbs = { alc861_threestack_init_verbs },
14730 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14731 .dac_nids = alc861_dac_nids,
14732 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14733 .channel_mode = alc861_threestack_modes,
14735 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14736 .adc_nids = alc861_adc_nids,
14737 .input_mux = &alc861_capture_source,
14739 [ALC861_3ST_DIG] = {
14740 .mixers = { alc861_base_mixer },
14741 .init_verbs = { alc861_threestack_init_verbs },
14742 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14743 .dac_nids = alc861_dac_nids,
14744 .dig_out_nid = ALC861_DIGOUT_NID,
14745 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14746 .channel_mode = alc861_threestack_modes,
14748 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14749 .adc_nids = alc861_adc_nids,
14750 .input_mux = &alc861_capture_source,
14752 [ALC861_6ST_DIG] = {
14753 .mixers = { alc861_base_mixer },
14754 .init_verbs = { alc861_base_init_verbs },
14755 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14756 .dac_nids = alc861_dac_nids,
14757 .dig_out_nid = ALC861_DIGOUT_NID,
14758 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14759 .channel_mode = alc861_8ch_modes,
14760 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14761 .adc_nids = alc861_adc_nids,
14762 .input_mux = &alc861_capture_source,
14765 .mixers = { alc861_3ST_mixer },
14766 .init_verbs = { alc861_threestack_init_verbs },
14767 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14768 .dac_nids = alc660_dac_nids,
14769 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14770 .channel_mode = alc861_threestack_modes,
14772 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14773 .adc_nids = alc861_adc_nids,
14774 .input_mux = &alc861_capture_source,
14776 [ALC861_UNIWILL_M31] = {
14777 .mixers = { alc861_uniwill_m31_mixer },
14778 .init_verbs = { alc861_uniwill_m31_init_verbs },
14779 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14780 .dac_nids = alc861_dac_nids,
14781 .dig_out_nid = ALC861_DIGOUT_NID,
14782 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14783 .channel_mode = alc861_uniwill_m31_modes,
14785 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14786 .adc_nids = alc861_adc_nids,
14787 .input_mux = &alc861_capture_source,
14789 [ALC861_TOSHIBA] = {
14790 .mixers = { alc861_toshiba_mixer },
14791 .init_verbs = { alc861_base_init_verbs,
14792 alc861_toshiba_init_verbs },
14793 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14794 .dac_nids = alc861_dac_nids,
14795 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14796 .channel_mode = alc883_3ST_2ch_modes,
14797 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14798 .adc_nids = alc861_adc_nids,
14799 .input_mux = &alc861_capture_source,
14800 .unsol_event = alc861_toshiba_unsol_event,
14801 .init_hook = alc861_toshiba_automute,
14804 .mixers = { alc861_asus_mixer },
14805 .init_verbs = { alc861_asus_init_verbs },
14806 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14807 .dac_nids = alc861_dac_nids,
14808 .dig_out_nid = ALC861_DIGOUT_NID,
14809 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14810 .channel_mode = alc861_asus_modes,
14813 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14814 .adc_nids = alc861_adc_nids,
14815 .input_mux = &alc861_capture_source,
14817 [ALC861_ASUS_LAPTOP] = {
14818 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14819 .init_verbs = { alc861_asus_init_verbs,
14820 alc861_asus_laptop_init_verbs },
14821 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14822 .dac_nids = alc861_dac_nids,
14823 .dig_out_nid = ALC861_DIGOUT_NID,
14824 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14825 .channel_mode = alc883_3ST_2ch_modes,
14827 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14828 .adc_nids = alc861_adc_nids,
14829 .input_mux = &alc861_capture_source,
14833 /* Pin config fixes */
14835 PINFIX_FSC_AMILO_PI1505,
14838 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14839 { 0x0b, 0x0221101f }, /* HP */
14840 { 0x0f, 0x90170310 }, /* speaker */
14844 static const struct alc_fixup alc861_fixups[] = {
14845 [PINFIX_FSC_AMILO_PI1505] = {
14846 .pins = alc861_fsc_amilo_pi1505_pinfix
14850 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14851 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14855 static int patch_alc861(struct hda_codec *codec)
14857 struct alc_spec *spec;
14861 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14865 codec->spec = spec;
14867 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14871 if (board_config < 0) {
14872 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14874 board_config = ALC861_AUTO;
14877 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14879 if (board_config == ALC861_AUTO) {
14880 /* automatic parse from the BIOS config */
14881 err = alc861_parse_auto_config(codec);
14887 "hda_codec: Cannot set up configuration "
14888 "from BIOS. Using base mode...\n");
14889 board_config = ALC861_3ST_DIG;
14893 err = snd_hda_attach_beep_device(codec, 0x23);
14899 if (board_config != ALC861_AUTO)
14900 setup_preset(codec, &alc861_presets[board_config]);
14902 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14903 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14905 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14906 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14908 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14910 spec->vmaster_nid = 0x03;
14912 codec->patch_ops = alc_patch_ops;
14913 if (board_config == ALC861_AUTO)
14914 spec->init_hook = alc861_auto_init;
14915 #ifdef CONFIG_SND_HDA_POWER_SAVE
14916 if (!spec->loopback.amplist)
14917 spec->loopback.amplist = alc861_loopbacks;
14919 codec->proc_widget_hook = print_realtek_coef;
14925 * ALC861-VD support
14929 * In addition, an independent DAC
14931 #define ALC861VD_DIGOUT_NID 0x06
14933 static hda_nid_t alc861vd_dac_nids[4] = {
14934 /* front, surr, clfe, side surr */
14935 0x02, 0x03, 0x04, 0x05
14938 /* dac_nids for ALC660vd are in a different order - according to
14939 * Realtek's driver.
14940 * This should probably result in a different mixer for 6stack models
14941 * of ALC660vd codecs, but for now there is only 3stack mixer
14942 * - and it is the same as in 861vd.
14943 * adc_nids in ALC660vd are (is) the same as in 861vd
14945 static hda_nid_t alc660vd_dac_nids[3] = {
14946 /* front, rear, clfe, rear_surr */
14950 static hda_nid_t alc861vd_adc_nids[1] = {
14955 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14958 /* FIXME: should be a matrix-type input source selection */
14959 static struct hda_input_mux alc861vd_capture_source = {
14963 { "Front Mic", 0x1 },
14969 static struct hda_input_mux alc861vd_dallas_capture_source = {
14972 { "Ext Mic", 0x0 },
14973 { "Int Mic", 0x1 },
14977 static struct hda_input_mux alc861vd_hp_capture_source = {
14980 { "Front Mic", 0x0 },
14981 { "ATAPI Mic", 0x1 },
14988 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14995 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14996 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14997 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14998 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14999 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15006 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15007 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15008 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15009 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15010 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15014 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15015 { 6, alc861vd_6stack_ch6_init },
15016 { 8, alc861vd_6stack_ch8_init },
15019 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15021 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15022 .name = "Channel Mode",
15023 .info = alc_ch_mode_info,
15024 .get = alc_ch_mode_get,
15025 .put = alc_ch_mode_put,
15030 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15031 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15033 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15034 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15035 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15037 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15038 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15040 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15042 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15044 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15045 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15047 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15048 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15050 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15052 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15053 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15054 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15056 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15057 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15058 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15060 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15061 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15063 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15064 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15069 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15070 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15071 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15073 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15075 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15076 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15077 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15079 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15080 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15081 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15083 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15084 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15086 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15087 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15092 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15093 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15094 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15095 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15097 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15099 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15100 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15101 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15103 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15104 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15105 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15107 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15108 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15113 /* Pin assignment: Speaker=0x14, HP = 0x15,
15114 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15116 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15117 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15118 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15119 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15120 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15121 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15122 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15123 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15124 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15125 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15126 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15130 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15131 * Front Mic=0x18, ATAPI Mic = 0x19,
15133 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15134 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15135 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15136 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15137 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15138 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15139 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15140 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15141 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15147 * generic initialization of ADC, input mixers and output mixers
15149 static struct hda_verb alc861vd_volume_init_verbs[] = {
15151 * Unmute ADC0 and set the default input to mic-in
15153 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15154 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15156 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15157 * the analog-loopback mixer widget
15159 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15160 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15161 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15162 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15163 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15164 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15166 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15167 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15168 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15169 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15173 * Set up output mixers (0x02 - 0x05)
15175 /* set vol=0 to output mixers */
15176 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15177 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15178 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15179 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15181 /* set up input amps for analog loopback */
15182 /* Amp Indices: DAC = 0, mixer = 1 */
15183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15184 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15185 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15186 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15187 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15188 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15189 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15190 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15196 * 3-stack pin configuration:
15197 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15199 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15201 * Set pin mode and muting
15203 /* set front pin widgets 0x14 for output */
15204 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15205 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15206 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15208 /* Mic (rear) pin: input vref at 80% */
15209 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15211 /* Front Mic pin: input vref at 80% */
15212 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15213 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15214 /* Line In pin: input */
15215 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15216 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15217 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15219 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15220 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15221 /* CD pin widget for input */
15222 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15228 * 6-stack pin configuration:
15230 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15232 * Set pin mode and muting
15234 /* set front pin widgets 0x14 for output */
15235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15236 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15237 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15239 /* Rear Pin: output 1 (0x0d) */
15240 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15241 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15242 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15243 /* CLFE Pin: output 2 (0x0e) */
15244 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15245 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15246 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15247 /* Side Pin: output 3 (0x0f) */
15248 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15249 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15250 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15252 /* Mic (rear) pin: input vref at 80% */
15253 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15254 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15255 /* Front Mic pin: input vref at 80% */
15256 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15257 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15258 /* Line In pin: input */
15259 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15260 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15261 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15262 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15263 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15264 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15265 /* CD pin widget for input */
15266 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15271 static struct hda_verb alc861vd_eapd_verbs[] = {
15272 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15276 static struct hda_verb alc660vd_eapd_verbs[] = {
15277 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15278 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15282 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15286 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15287 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15291 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15293 unsigned int present;
15294 unsigned char bits;
15296 present = snd_hda_jack_detect(codec, 0x18);
15297 bits = present ? HDA_AMP_MUTE : 0;
15299 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15300 HDA_AMP_MUTE, bits);
15303 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15305 struct alc_spec *spec = codec->spec;
15306 spec->autocfg.hp_pins[0] = 0x1b;
15307 spec->autocfg.speaker_pins[0] = 0x14;
15310 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15312 alc_automute_amp(codec);
15313 alc861vd_lenovo_mic_automute(codec);
15316 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15319 switch (res >> 26) {
15320 case ALC880_MIC_EVENT:
15321 alc861vd_lenovo_mic_automute(codec);
15324 alc_automute_amp_unsol_event(codec, res);
15329 static struct hda_verb alc861vd_dallas_verbs[] = {
15330 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15331 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15332 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15333 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15337 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15338 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15339 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15340 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15341 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15342 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15344 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15345 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15348 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15349 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15350 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15351 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15353 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15354 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15355 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15356 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15357 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15359 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15360 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15367 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15368 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15369 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15374 /* toggle speaker-output according to the hp-jack state */
15375 static void alc861vd_dallas_setup(struct hda_codec *codec)
15377 struct alc_spec *spec = codec->spec;
15379 spec->autocfg.hp_pins[0] = 0x15;
15380 spec->autocfg.speaker_pins[0] = 0x14;
15383 #ifdef CONFIG_SND_HDA_POWER_SAVE
15384 #define alc861vd_loopbacks alc880_loopbacks
15387 /* pcm configuration: identical with ALC880 */
15388 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15389 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15390 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15391 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15394 * configuration and preset
15396 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15397 [ALC660VD_3ST] = "3stack-660",
15398 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15399 [ALC660VD_ASUS_V1S] = "asus-v1s",
15400 [ALC861VD_3ST] = "3stack",
15401 [ALC861VD_3ST_DIG] = "3stack-digout",
15402 [ALC861VD_6ST_DIG] = "6stack-digout",
15403 [ALC861VD_LENOVO] = "lenovo",
15404 [ALC861VD_DALLAS] = "dallas",
15405 [ALC861VD_HP] = "hp",
15406 [ALC861VD_AUTO] = "auto",
15409 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15410 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15411 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15412 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15413 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15414 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15415 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15416 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15417 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15418 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15419 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15420 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15421 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15422 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15423 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15424 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15428 static struct alc_config_preset alc861vd_presets[] = {
15430 .mixers = { alc861vd_3st_mixer },
15431 .init_verbs = { alc861vd_volume_init_verbs,
15432 alc861vd_3stack_init_verbs },
15433 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15434 .dac_nids = alc660vd_dac_nids,
15435 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15436 .channel_mode = alc861vd_3stack_2ch_modes,
15437 .input_mux = &alc861vd_capture_source,
15439 [ALC660VD_3ST_DIG] = {
15440 .mixers = { alc861vd_3st_mixer },
15441 .init_verbs = { alc861vd_volume_init_verbs,
15442 alc861vd_3stack_init_verbs },
15443 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15444 .dac_nids = alc660vd_dac_nids,
15445 .dig_out_nid = ALC861VD_DIGOUT_NID,
15446 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15447 .channel_mode = alc861vd_3stack_2ch_modes,
15448 .input_mux = &alc861vd_capture_source,
15451 .mixers = { alc861vd_3st_mixer },
15452 .init_verbs = { alc861vd_volume_init_verbs,
15453 alc861vd_3stack_init_verbs },
15454 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15455 .dac_nids = alc861vd_dac_nids,
15456 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15457 .channel_mode = alc861vd_3stack_2ch_modes,
15458 .input_mux = &alc861vd_capture_source,
15460 [ALC861VD_3ST_DIG] = {
15461 .mixers = { alc861vd_3st_mixer },
15462 .init_verbs = { alc861vd_volume_init_verbs,
15463 alc861vd_3stack_init_verbs },
15464 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15465 .dac_nids = alc861vd_dac_nids,
15466 .dig_out_nid = ALC861VD_DIGOUT_NID,
15467 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15468 .channel_mode = alc861vd_3stack_2ch_modes,
15469 .input_mux = &alc861vd_capture_source,
15471 [ALC861VD_6ST_DIG] = {
15472 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15473 .init_verbs = { alc861vd_volume_init_verbs,
15474 alc861vd_6stack_init_verbs },
15475 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15476 .dac_nids = alc861vd_dac_nids,
15477 .dig_out_nid = ALC861VD_DIGOUT_NID,
15478 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15479 .channel_mode = alc861vd_6stack_modes,
15480 .input_mux = &alc861vd_capture_source,
15482 [ALC861VD_LENOVO] = {
15483 .mixers = { alc861vd_lenovo_mixer },
15484 .init_verbs = { alc861vd_volume_init_verbs,
15485 alc861vd_3stack_init_verbs,
15486 alc861vd_eapd_verbs,
15487 alc861vd_lenovo_unsol_verbs },
15488 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15489 .dac_nids = alc660vd_dac_nids,
15490 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15491 .channel_mode = alc861vd_3stack_2ch_modes,
15492 .input_mux = &alc861vd_capture_source,
15493 .unsol_event = alc861vd_lenovo_unsol_event,
15494 .setup = alc861vd_lenovo_setup,
15495 .init_hook = alc861vd_lenovo_init_hook,
15497 [ALC861VD_DALLAS] = {
15498 .mixers = { alc861vd_dallas_mixer },
15499 .init_verbs = { alc861vd_dallas_verbs },
15500 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15501 .dac_nids = alc861vd_dac_nids,
15502 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15503 .channel_mode = alc861vd_3stack_2ch_modes,
15504 .input_mux = &alc861vd_dallas_capture_source,
15505 .unsol_event = alc_automute_amp_unsol_event,
15506 .setup = alc861vd_dallas_setup,
15507 .init_hook = alc_automute_amp,
15510 .mixers = { alc861vd_hp_mixer },
15511 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15512 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15513 .dac_nids = alc861vd_dac_nids,
15514 .dig_out_nid = ALC861VD_DIGOUT_NID,
15515 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15516 .channel_mode = alc861vd_3stack_2ch_modes,
15517 .input_mux = &alc861vd_hp_capture_source,
15518 .unsol_event = alc_automute_amp_unsol_event,
15519 .setup = alc861vd_dallas_setup,
15520 .init_hook = alc_automute_amp,
15522 [ALC660VD_ASUS_V1S] = {
15523 .mixers = { alc861vd_lenovo_mixer },
15524 .init_verbs = { alc861vd_volume_init_verbs,
15525 alc861vd_3stack_init_verbs,
15526 alc861vd_eapd_verbs,
15527 alc861vd_lenovo_unsol_verbs },
15528 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15529 .dac_nids = alc660vd_dac_nids,
15530 .dig_out_nid = ALC861VD_DIGOUT_NID,
15531 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15532 .channel_mode = alc861vd_3stack_2ch_modes,
15533 .input_mux = &alc861vd_capture_source,
15534 .unsol_event = alc861vd_lenovo_unsol_event,
15535 .setup = alc861vd_lenovo_setup,
15536 .init_hook = alc861vd_lenovo_init_hook,
15541 * BIOS auto configuration
15543 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15544 const struct auto_pin_cfg *cfg)
15546 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15550 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15551 hda_nid_t nid, int pin_type, int dac_idx)
15553 alc_set_pin_output(codec, nid, pin_type);
15556 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15558 struct alc_spec *spec = codec->spec;
15561 for (i = 0; i <= HDA_SIDE; i++) {
15562 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15563 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15565 alc861vd_auto_set_output_and_unmute(codec, nid,
15571 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15573 struct alc_spec *spec = codec->spec;
15576 pin = spec->autocfg.hp_pins[0];
15577 if (pin) /* connect to front and use dac 0 */
15578 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15579 pin = spec->autocfg.speaker_pins[0];
15581 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15584 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15586 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15588 struct alc_spec *spec = codec->spec;
15591 for (i = 0; i < AUTO_PIN_LAST; i++) {
15592 hda_nid_t nid = spec->autocfg.input_pins[i];
15593 if (alc_is_input_pin(codec, nid)) {
15594 alc_set_input_pin(codec, nid, i);
15595 if (nid != ALC861VD_PIN_CD_NID &&
15596 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15597 snd_hda_codec_write(codec, nid, 0,
15598 AC_VERB_SET_AMP_GAIN_MUTE,
15604 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15606 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15607 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15609 /* add playback controls from the parsed DAC table */
15610 /* Based on ALC880 version. But ALC861VD has separate,
15611 * different NIDs for mute/unmute switch and volume control */
15612 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15613 const struct auto_pin_cfg *cfg)
15615 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15616 hda_nid_t nid_v, nid_s;
15619 for (i = 0; i < cfg->line_outs; i++) {
15620 if (!spec->multiout.dac_nids[i])
15622 nid_v = alc861vd_idx_to_mixer_vol(
15624 spec->multiout.dac_nids[i]));
15625 nid_s = alc861vd_idx_to_mixer_switch(
15627 spec->multiout.dac_nids[i]));
15631 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15633 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15637 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15639 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15643 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15645 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15649 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15651 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15657 if (cfg->line_outs == 1 &&
15658 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15665 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15666 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15670 if (cfg->line_outs == 1 &&
15671 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15673 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15674 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15683 /* add playback controls for speaker and HP outputs */
15684 /* Based on ALC880 version. But ALC861VD has separate,
15685 * different NIDs for mute/unmute switch and volume control */
15686 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15687 hda_nid_t pin, const char *pfx)
15689 hda_nid_t nid_v, nid_s;
15695 if (alc880_is_fixed_pin(pin)) {
15696 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15697 /* specify the DAC as the extra output */
15698 if (!spec->multiout.hp_nid)
15699 spec->multiout.hp_nid = nid_v;
15701 spec->multiout.extra_out_nid[0] = nid_v;
15702 /* control HP volume/switch on the output mixer amp */
15703 nid_v = alc861vd_idx_to_mixer_vol(
15704 alc880_fixed_pin_idx(pin));
15705 nid_s = alc861vd_idx_to_mixer_switch(
15706 alc880_fixed_pin_idx(pin));
15708 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15709 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15712 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15713 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15716 } else if (alc880_is_multi_pin(pin)) {
15717 /* set manual connection */
15718 /* we have only a switch on HP-out PIN */
15719 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15720 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15727 /* parse the BIOS configuration and set up the alc_spec
15728 * return 1 if successful, 0 if the proper config is not found,
15729 * or a negative error code
15730 * Based on ALC880 version - had to change it to override
15731 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15732 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15734 struct alc_spec *spec = codec->spec;
15736 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15738 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15742 if (!spec->autocfg.line_outs)
15743 return 0; /* can't find valid BIOS pin config */
15745 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15748 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15751 err = alc861vd_auto_create_extra_out(spec,
15752 spec->autocfg.speaker_pins[0],
15756 err = alc861vd_auto_create_extra_out(spec,
15757 spec->autocfg.hp_pins[0],
15761 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15765 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15767 if (spec->autocfg.dig_outs)
15768 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15770 if (spec->kctls.list)
15771 add_mixer(spec, spec->kctls.list);
15773 add_verb(spec, alc861vd_volume_init_verbs);
15775 spec->num_mux_defs = 1;
15776 spec->input_mux = &spec->private_imux[0];
15778 err = alc_auto_add_mic_boost(codec);
15782 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15787 /* additional initialization for auto-configuration model */
15788 static void alc861vd_auto_init(struct hda_codec *codec)
15790 struct alc_spec *spec = codec->spec;
15791 alc861vd_auto_init_multi_out(codec);
15792 alc861vd_auto_init_hp_out(codec);
15793 alc861vd_auto_init_analog_input(codec);
15794 alc861vd_auto_init_input_src(codec);
15795 if (spec->unsol_event)
15796 alc_inithook(codec);
15800 ALC660VD_FIX_ASUS_GPIO1
15804 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15805 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15806 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15807 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15811 static const struct alc_fixup alc861vd_fixups[] = {
15812 [ALC660VD_FIX_ASUS_GPIO1] = {
15813 .verbs = alc660vd_fix_asus_gpio1_verbs,
15817 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15818 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15822 static int patch_alc861vd(struct hda_codec *codec)
15824 struct alc_spec *spec;
15825 int err, board_config;
15827 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15831 codec->spec = spec;
15833 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15837 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15838 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15840 board_config = ALC861VD_AUTO;
15843 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15845 if (board_config == ALC861VD_AUTO) {
15846 /* automatic parse from the BIOS config */
15847 err = alc861vd_parse_auto_config(codec);
15853 "hda_codec: Cannot set up configuration "
15854 "from BIOS. Using base mode...\n");
15855 board_config = ALC861VD_3ST;
15859 err = snd_hda_attach_beep_device(codec, 0x23);
15865 if (board_config != ALC861VD_AUTO)
15866 setup_preset(codec, &alc861vd_presets[board_config]);
15868 if (codec->vendor_id == 0x10ec0660) {
15869 /* always turn on EAPD */
15870 add_verb(spec, alc660vd_eapd_verbs);
15873 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15874 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15876 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15877 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15879 if (!spec->adc_nids) {
15880 spec->adc_nids = alc861vd_adc_nids;
15881 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15883 if (!spec->capsrc_nids)
15884 spec->capsrc_nids = alc861vd_capsrc_nids;
15886 set_capture_mixer(codec);
15887 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15889 spec->vmaster_nid = 0x02;
15891 codec->patch_ops = alc_patch_ops;
15893 if (board_config == ALC861VD_AUTO)
15894 spec->init_hook = alc861vd_auto_init;
15895 #ifdef CONFIG_SND_HDA_POWER_SAVE
15896 if (!spec->loopback.amplist)
15897 spec->loopback.amplist = alc861vd_loopbacks;
15899 codec->proc_widget_hook = print_realtek_coef;
15907 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15908 * configuration. Each pin widget can choose any input DACs and a mixer.
15909 * Each ADC is connected from a mixer of all inputs. This makes possible
15910 * 6-channel independent captures.
15912 * In addition, an independent DAC for the multi-playback (not used in this
15915 #define ALC662_DIGOUT_NID 0x06
15916 #define ALC662_DIGIN_NID 0x0a
15918 static hda_nid_t alc662_dac_nids[4] = {
15919 /* front, rear, clfe, rear_surr */
15923 static hda_nid_t alc272_dac_nids[2] = {
15927 static hda_nid_t alc662_adc_nids[2] = {
15932 static hda_nid_t alc272_adc_nids[1] = {
15937 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15938 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15942 /* FIXME: should be a matrix-type input source selection */
15943 static struct hda_input_mux alc662_capture_source = {
15947 { "Front Mic", 0x1 },
15953 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15961 static struct hda_input_mux alc663_capture_source = {
15965 { "Front Mic", 0x1 },
15970 #if 0 /* set to 1 for testing other input sources below */
15971 static struct hda_input_mux alc272_nc10_capture_source = {
15974 { "Autoselect Mic", 0x0 },
15975 { "Internal Mic", 0x1 },
15976 { "In-0x02", 0x2 },
15977 { "In-0x03", 0x3 },
15978 { "In-0x04", 0x4 },
15979 { "In-0x05", 0x5 },
15980 { "In-0x06", 0x6 },
15981 { "In-0x07", 0x7 },
15982 { "In-0x08", 0x8 },
15983 { "In-0x09", 0x9 },
15984 { "In-0x0a", 0x0a },
15985 { "In-0x0b", 0x0b },
15986 { "In-0x0c", 0x0c },
15987 { "In-0x0d", 0x0d },
15988 { "In-0x0e", 0x0e },
15989 { "In-0x0f", 0x0f },
15997 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16004 static struct hda_verb alc662_3ST_ch2_init[] = {
16005 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16006 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16007 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16008 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16015 static struct hda_verb alc662_3ST_ch6_init[] = {
16016 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16017 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16018 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16019 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16020 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16021 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16025 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16026 { 2, alc662_3ST_ch2_init },
16027 { 6, alc662_3ST_ch6_init },
16033 static struct hda_verb alc662_sixstack_ch6_init[] = {
16034 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16035 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16036 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16043 static struct hda_verb alc662_sixstack_ch8_init[] = {
16044 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16045 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16046 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16050 static struct hda_channel_mode alc662_5stack_modes[2] = {
16051 { 2, alc662_sixstack_ch6_init },
16052 { 6, alc662_sixstack_ch8_init },
16055 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16056 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16059 static struct snd_kcontrol_new alc662_base_mixer[] = {
16060 /* output mixer control */
16061 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16062 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16063 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16064 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16065 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16066 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16067 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16068 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16069 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16071 /*Input mixer control */
16072 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16073 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16074 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16075 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16076 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16077 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16078 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16079 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16083 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16084 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16085 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16087 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16088 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16089 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16090 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16093 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16094 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16098 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16099 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16100 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16101 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16102 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16103 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16104 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16105 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16106 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16107 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16108 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16109 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16110 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16111 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16113 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16114 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16115 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16119 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16120 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16121 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16122 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16123 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16124 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16132 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16133 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16134 ALC262_HIPPO_MASTER_SWITCH,
16136 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16137 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16138 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16140 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16141 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16142 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16146 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16147 ALC262_HIPPO_MASTER_SWITCH,
16148 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16149 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16150 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16151 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16152 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16153 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16154 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16160 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16161 .ops = &snd_hda_bind_vol,
16163 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16164 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16169 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16170 .ops = &snd_hda_bind_sw,
16172 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16173 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16178 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16179 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16180 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16186 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16187 .ops = &snd_hda_bind_sw,
16189 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16190 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16191 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16196 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16197 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16198 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16201 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16202 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16207 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16208 .ops = &snd_hda_bind_sw,
16210 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16211 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16212 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16217 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16218 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16219 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16222 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16223 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16227 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16228 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16229 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16233 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16234 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16238 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16239 .ops = &snd_hda_bind_vol,
16241 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16242 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16247 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16248 .ops = &snd_hda_bind_sw,
16250 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16251 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16256 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16257 HDA_BIND_VOL("Master Playback Volume",
16258 &alc663_asus_two_bind_master_vol),
16259 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16260 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16261 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16263 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16267 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16268 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16269 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16270 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16271 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16277 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16278 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16279 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16280 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16281 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16282 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16286 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16287 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16291 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16292 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16293 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16294 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16298 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16299 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16300 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16301 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16305 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16306 .ops = &snd_hda_bind_sw,
16308 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16309 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16310 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16311 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16312 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16317 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16318 .ops = &snd_hda_bind_sw,
16320 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16321 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16326 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16327 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16328 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16329 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16330 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16331 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16332 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16333 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16339 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16340 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16341 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16342 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16343 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16344 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16345 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16346 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16351 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16353 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16354 .name = "Channel Mode",
16355 .info = alc_ch_mode_info,
16356 .get = alc_ch_mode_get,
16357 .put = alc_ch_mode_put,
16362 static struct hda_verb alc662_init_verbs[] = {
16363 /* ADC: mute amp left and right */
16364 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16365 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16366 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16376 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16377 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16378 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16379 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16381 /* Front Pin: output 0 (0x0c) */
16382 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16383 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16385 /* Rear Pin: output 1 (0x0d) */
16386 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16389 /* CLFE Pin: output 2 (0x0e) */
16390 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16391 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16393 /* Mic (rear) pin: input vref at 80% */
16394 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16395 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16396 /* Front Mic pin: input vref at 80% */
16397 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16398 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16399 /* Line In pin: input */
16400 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16401 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16402 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16403 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16404 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16405 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16406 /* CD pin widget for input */
16407 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16409 /* FIXME: use matrix-type input source selection */
16410 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16415 /* always trun on EAPD */
16416 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16417 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16422 static struct hda_verb alc662_sue_init_verbs[] = {
16423 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16424 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16428 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16429 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16430 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16434 /* Set Unsolicited Event*/
16435 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16436 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16437 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16442 * generic initialization of ADC, input mixers and output mixers
16444 static struct hda_verb alc662_auto_init_verbs[] = {
16446 * Unmute ADC and set the default input to mic-in
16448 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16451 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16453 * Note: PASD motherboards uses the Line In 2 as the input for front
16454 * panel mic (mic 2)
16456 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16464 * Set up output mixers (0x0c - 0x0f)
16466 /* set vol=0 to output mixers */
16467 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16468 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16469 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16471 /* set up input amps for analog loopback */
16472 /* Amp Indices: DAC = 0, mixer = 1 */
16473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16475 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16477 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16478 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16481 /* FIXME: use matrix-type input source selection */
16482 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16489 /* additional verbs for ALC663 */
16490 static struct hda_verb alc663_auto_init_verbs[] = {
16491 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16492 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16496 static struct hda_verb alc663_m51va_init_verbs[] = {
16497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16498 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16499 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16500 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16501 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16504 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16505 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16509 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16510 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16511 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16512 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16515 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16516 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16520 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16521 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16522 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16523 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16524 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16527 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16528 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16532 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16533 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16534 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16535 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16536 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16537 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16538 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16539 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16543 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16544 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16545 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16546 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16547 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16548 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16550 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16553 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16554 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16555 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16559 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16560 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16561 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16562 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16563 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16564 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16566 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16569 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16570 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16571 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16575 static struct hda_verb alc663_g71v_init_verbs[] = {
16576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16577 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16578 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16580 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16581 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16582 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16584 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16585 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16586 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16590 static struct hda_verb alc663_g50v_init_verbs[] = {
16591 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16592 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16593 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16595 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16596 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16600 static struct hda_verb alc662_ecs_init_verbs[] = {
16601 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16603 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16604 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16608 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16609 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16610 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16611 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16613 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16614 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16615 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16616 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16618 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16619 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16623 static struct hda_verb alc272_dell_init_verbs[] = {
16624 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16625 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16626 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16627 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16628 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16629 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16630 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16631 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16632 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16633 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16634 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16638 static struct hda_verb alc663_mode7_init_verbs[] = {
16639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16640 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16641 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16642 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16643 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16644 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16645 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16646 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16647 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16648 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16651 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16652 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16653 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16657 static struct hda_verb alc663_mode8_init_verbs[] = {
16658 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16659 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16661 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16663 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16664 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16665 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16666 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16667 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16668 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16671 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16672 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16673 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16677 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16678 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16679 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16683 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16684 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16685 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16689 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16691 unsigned int present;
16692 unsigned char bits;
16694 present = snd_hda_jack_detect(codec, 0x14);
16695 bits = present ? HDA_AMP_MUTE : 0;
16697 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16698 HDA_AMP_MUTE, bits);
16701 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16703 unsigned int present;
16704 unsigned char bits;
16706 present = snd_hda_jack_detect(codec, 0x1b);
16707 bits = present ? HDA_AMP_MUTE : 0;
16709 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16710 HDA_AMP_MUTE, bits);
16711 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16712 HDA_AMP_MUTE, bits);
16715 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16718 if ((res >> 26) == ALC880_HP_EVENT)
16719 alc662_lenovo_101e_all_automute(codec);
16720 if ((res >> 26) == ALC880_FRONT_EVENT)
16721 alc662_lenovo_101e_ispeaker_automute(codec);
16724 /* unsolicited event for HP jack sensing */
16725 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16728 if ((res >> 26) == ALC880_MIC_EVENT)
16729 alc_mic_automute(codec);
16731 alc262_hippo_unsol_event(codec, res);
16734 static void alc662_eeepc_setup(struct hda_codec *codec)
16736 struct alc_spec *spec = codec->spec;
16738 alc262_hippo1_setup(codec);
16739 spec->ext_mic.pin = 0x18;
16740 spec->ext_mic.mux_idx = 0;
16741 spec->int_mic.pin = 0x19;
16742 spec->int_mic.mux_idx = 1;
16743 spec->auto_mic = 1;
16746 static void alc662_eeepc_inithook(struct hda_codec *codec)
16748 alc262_hippo_automute(codec);
16749 alc_mic_automute(codec);
16752 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16754 struct alc_spec *spec = codec->spec;
16756 spec->autocfg.hp_pins[0] = 0x14;
16757 spec->autocfg.speaker_pins[0] = 0x1b;
16760 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16762 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16764 unsigned int present;
16765 unsigned char bits;
16767 present = snd_hda_jack_detect(codec, 0x21);
16768 bits = present ? HDA_AMP_MUTE : 0;
16769 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16770 AMP_IN_MUTE(0), bits);
16771 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16772 AMP_IN_MUTE(0), bits);
16775 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16777 unsigned int present;
16778 unsigned char bits;
16780 present = snd_hda_jack_detect(codec, 0x21);
16781 bits = present ? HDA_AMP_MUTE : 0;
16782 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16783 AMP_IN_MUTE(0), bits);
16784 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16785 AMP_IN_MUTE(0), bits);
16786 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16787 AMP_IN_MUTE(0), bits);
16788 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16789 AMP_IN_MUTE(0), bits);
16792 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16794 unsigned int present;
16795 unsigned char bits;
16797 present = snd_hda_jack_detect(codec, 0x15);
16798 bits = present ? HDA_AMP_MUTE : 0;
16799 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16800 AMP_IN_MUTE(0), bits);
16801 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16802 AMP_IN_MUTE(0), bits);
16803 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16804 AMP_IN_MUTE(0), bits);
16805 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16806 AMP_IN_MUTE(0), bits);
16809 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16811 unsigned int present;
16812 unsigned char bits;
16814 present = snd_hda_jack_detect(codec, 0x1b);
16815 bits = present ? 0 : PIN_OUT;
16816 snd_hda_codec_write(codec, 0x14, 0,
16817 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16820 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16822 unsigned int present1, present2;
16824 present1 = snd_hda_jack_detect(codec, 0x21);
16825 present2 = snd_hda_jack_detect(codec, 0x15);
16827 if (present1 || present2) {
16828 snd_hda_codec_write_cache(codec, 0x14, 0,
16829 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16831 snd_hda_codec_write_cache(codec, 0x14, 0,
16832 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16836 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16838 unsigned int present1, present2;
16840 present1 = snd_hda_jack_detect(codec, 0x1b);
16841 present2 = snd_hda_jack_detect(codec, 0x15);
16843 if (present1 || present2) {
16844 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16845 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16846 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16847 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16849 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16850 AMP_IN_MUTE(0), 0);
16851 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16852 AMP_IN_MUTE(0), 0);
16856 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16858 unsigned int present1, present2;
16860 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16861 AC_VERB_GET_PIN_SENSE, 0)
16862 & AC_PINSENSE_PRESENCE;
16863 present2 = snd_hda_codec_read(codec, 0x21, 0,
16864 AC_VERB_GET_PIN_SENSE, 0)
16865 & AC_PINSENSE_PRESENCE;
16867 if (present1 || present2) {
16868 snd_hda_codec_write_cache(codec, 0x14, 0,
16869 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16870 snd_hda_codec_write_cache(codec, 0x17, 0,
16871 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16873 snd_hda_codec_write_cache(codec, 0x14, 0,
16874 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16875 snd_hda_codec_write_cache(codec, 0x17, 0,
16876 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16880 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16882 unsigned int present1, present2;
16884 present1 = snd_hda_codec_read(codec, 0x21, 0,
16885 AC_VERB_GET_PIN_SENSE, 0)
16886 & AC_PINSENSE_PRESENCE;
16887 present2 = snd_hda_codec_read(codec, 0x15, 0,
16888 AC_VERB_GET_PIN_SENSE, 0)
16889 & AC_PINSENSE_PRESENCE;
16891 if (present1 || present2) {
16892 snd_hda_codec_write_cache(codec, 0x14, 0,
16893 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16894 snd_hda_codec_write_cache(codec, 0x17, 0,
16895 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16897 snd_hda_codec_write_cache(codec, 0x14, 0,
16898 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16899 snd_hda_codec_write_cache(codec, 0x17, 0,
16900 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16904 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16907 switch (res >> 26) {
16908 case ALC880_HP_EVENT:
16909 alc663_m51va_speaker_automute(codec);
16911 case ALC880_MIC_EVENT:
16912 alc_mic_automute(codec);
16917 static void alc663_m51va_setup(struct hda_codec *codec)
16919 struct alc_spec *spec = codec->spec;
16920 spec->ext_mic.pin = 0x18;
16921 spec->ext_mic.mux_idx = 0;
16922 spec->int_mic.pin = 0x12;
16923 spec->int_mic.mux_idx = 9;
16924 spec->auto_mic = 1;
16927 static void alc663_m51va_inithook(struct hda_codec *codec)
16929 alc663_m51va_speaker_automute(codec);
16930 alc_mic_automute(codec);
16933 /* ***************** Mode1 ******************************/
16934 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16936 static void alc663_mode1_setup(struct hda_codec *codec)
16938 struct alc_spec *spec = codec->spec;
16939 spec->ext_mic.pin = 0x18;
16940 spec->ext_mic.mux_idx = 0;
16941 spec->int_mic.pin = 0x19;
16942 spec->int_mic.mux_idx = 1;
16943 spec->auto_mic = 1;
16946 #define alc663_mode1_inithook alc663_m51va_inithook
16948 /* ***************** Mode2 ******************************/
16949 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16952 switch (res >> 26) {
16953 case ALC880_HP_EVENT:
16954 alc662_f5z_speaker_automute(codec);
16956 case ALC880_MIC_EVENT:
16957 alc_mic_automute(codec);
16962 #define alc662_mode2_setup alc663_mode1_setup
16964 static void alc662_mode2_inithook(struct hda_codec *codec)
16966 alc662_f5z_speaker_automute(codec);
16967 alc_mic_automute(codec);
16969 /* ***************** Mode3 ******************************/
16970 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16973 switch (res >> 26) {
16974 case ALC880_HP_EVENT:
16975 alc663_two_hp_m1_speaker_automute(codec);
16977 case ALC880_MIC_EVENT:
16978 alc_mic_automute(codec);
16983 #define alc663_mode3_setup alc663_mode1_setup
16985 static void alc663_mode3_inithook(struct hda_codec *codec)
16987 alc663_two_hp_m1_speaker_automute(codec);
16988 alc_mic_automute(codec);
16990 /* ***************** Mode4 ******************************/
16991 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16994 switch (res >> 26) {
16995 case ALC880_HP_EVENT:
16996 alc663_21jd_two_speaker_automute(codec);
16998 case ALC880_MIC_EVENT:
16999 alc_mic_automute(codec);
17004 #define alc663_mode4_setup alc663_mode1_setup
17006 static void alc663_mode4_inithook(struct hda_codec *codec)
17008 alc663_21jd_two_speaker_automute(codec);
17009 alc_mic_automute(codec);
17011 /* ***************** Mode5 ******************************/
17012 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17015 switch (res >> 26) {
17016 case ALC880_HP_EVENT:
17017 alc663_15jd_two_speaker_automute(codec);
17019 case ALC880_MIC_EVENT:
17020 alc_mic_automute(codec);
17025 #define alc663_mode5_setup alc663_mode1_setup
17027 static void alc663_mode5_inithook(struct hda_codec *codec)
17029 alc663_15jd_two_speaker_automute(codec);
17030 alc_mic_automute(codec);
17032 /* ***************** Mode6 ******************************/
17033 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17036 switch (res >> 26) {
17037 case ALC880_HP_EVENT:
17038 alc663_two_hp_m2_speaker_automute(codec);
17040 case ALC880_MIC_EVENT:
17041 alc_mic_automute(codec);
17046 #define alc663_mode6_setup alc663_mode1_setup
17048 static void alc663_mode6_inithook(struct hda_codec *codec)
17050 alc663_two_hp_m2_speaker_automute(codec);
17051 alc_mic_automute(codec);
17054 /* ***************** Mode7 ******************************/
17055 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17058 switch (res >> 26) {
17059 case ALC880_HP_EVENT:
17060 alc663_two_hp_m7_speaker_automute(codec);
17062 case ALC880_MIC_EVENT:
17063 alc_mic_automute(codec);
17068 #define alc663_mode7_setup alc663_mode1_setup
17070 static void alc663_mode7_inithook(struct hda_codec *codec)
17072 alc663_two_hp_m7_speaker_automute(codec);
17073 alc_mic_automute(codec);
17076 /* ***************** Mode8 ******************************/
17077 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17080 switch (res >> 26) {
17081 case ALC880_HP_EVENT:
17082 alc663_two_hp_m8_speaker_automute(codec);
17084 case ALC880_MIC_EVENT:
17085 alc_mic_automute(codec);
17090 #define alc663_mode8_setup alc663_m51va_setup
17092 static void alc663_mode8_inithook(struct hda_codec *codec)
17094 alc663_two_hp_m8_speaker_automute(codec);
17095 alc_mic_automute(codec);
17098 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17100 unsigned int present;
17101 unsigned char bits;
17103 present = snd_hda_jack_detect(codec, 0x21);
17104 bits = present ? HDA_AMP_MUTE : 0;
17105 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17106 HDA_AMP_MUTE, bits);
17107 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17108 HDA_AMP_MUTE, bits);
17111 static void alc663_g71v_front_automute(struct hda_codec *codec)
17113 unsigned int present;
17114 unsigned char bits;
17116 present = snd_hda_jack_detect(codec, 0x15);
17117 bits = present ? HDA_AMP_MUTE : 0;
17118 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17119 HDA_AMP_MUTE, bits);
17122 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17125 switch (res >> 26) {
17126 case ALC880_HP_EVENT:
17127 alc663_g71v_hp_automute(codec);
17129 case ALC880_FRONT_EVENT:
17130 alc663_g71v_front_automute(codec);
17132 case ALC880_MIC_EVENT:
17133 alc_mic_automute(codec);
17138 #define alc663_g71v_setup alc663_m51va_setup
17140 static void alc663_g71v_inithook(struct hda_codec *codec)
17142 alc663_g71v_front_automute(codec);
17143 alc663_g71v_hp_automute(codec);
17144 alc_mic_automute(codec);
17147 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17150 switch (res >> 26) {
17151 case ALC880_HP_EVENT:
17152 alc663_m51va_speaker_automute(codec);
17154 case ALC880_MIC_EVENT:
17155 alc_mic_automute(codec);
17160 #define alc663_g50v_setup alc663_m51va_setup
17162 static void alc663_g50v_inithook(struct hda_codec *codec)
17164 alc663_m51va_speaker_automute(codec);
17165 alc_mic_automute(codec);
17168 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17169 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17170 ALC262_HIPPO_MASTER_SWITCH,
17172 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17173 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17174 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17176 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17177 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17178 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17182 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17183 /* Master Playback automatically created from Speaker and Headphone */
17184 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17185 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17186 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17189 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17190 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17191 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17193 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17194 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17195 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17199 #ifdef CONFIG_SND_HDA_POWER_SAVE
17200 #define alc662_loopbacks alc880_loopbacks
17204 /* pcm configuration: identical with ALC880 */
17205 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17206 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17207 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17208 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17211 * configuration and preset
17213 static const char *alc662_models[ALC662_MODEL_LAST] = {
17214 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17215 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17216 [ALC662_3ST_6ch] = "3stack-6ch",
17217 [ALC662_5ST_DIG] = "6stack-dig",
17218 [ALC662_LENOVO_101E] = "lenovo-101e",
17219 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17220 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17221 [ALC662_ECS] = "ecs",
17222 [ALC663_ASUS_M51VA] = "m51va",
17223 [ALC663_ASUS_G71V] = "g71v",
17224 [ALC663_ASUS_H13] = "h13",
17225 [ALC663_ASUS_G50V] = "g50v",
17226 [ALC663_ASUS_MODE1] = "asus-mode1",
17227 [ALC662_ASUS_MODE2] = "asus-mode2",
17228 [ALC663_ASUS_MODE3] = "asus-mode3",
17229 [ALC663_ASUS_MODE4] = "asus-mode4",
17230 [ALC663_ASUS_MODE5] = "asus-mode5",
17231 [ALC663_ASUS_MODE6] = "asus-mode6",
17232 [ALC663_ASUS_MODE7] = "asus-mode7",
17233 [ALC663_ASUS_MODE8] = "asus-mode8",
17234 [ALC272_DELL] = "dell",
17235 [ALC272_DELL_ZM1] = "dell-zm1",
17236 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17237 [ALC662_AUTO] = "auto",
17240 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17241 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17242 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17243 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17244 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17245 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17246 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17247 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17248 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17249 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17250 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17251 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17252 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17253 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17254 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17255 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17256 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17257 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17258 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17259 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17260 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17261 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17262 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17263 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17264 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17265 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17266 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17267 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17268 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17269 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17270 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17271 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17272 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17273 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17274 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17275 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17276 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17277 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17278 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17279 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17280 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17281 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17282 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17283 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17284 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17285 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17286 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17287 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17288 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17289 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17290 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17291 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17292 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17293 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17294 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17295 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17296 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17297 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17298 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17299 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17300 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17301 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17302 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17303 ALC662_3ST_6ch_DIG),
17304 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17305 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17306 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17307 ALC662_3ST_6ch_DIG),
17308 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17309 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17310 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17311 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17312 ALC662_3ST_6ch_DIG),
17313 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17315 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17319 static struct alc_config_preset alc662_presets[] = {
17320 [ALC662_3ST_2ch_DIG] = {
17321 .mixers = { alc662_3ST_2ch_mixer },
17322 .init_verbs = { alc662_init_verbs },
17323 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17324 .dac_nids = alc662_dac_nids,
17325 .dig_out_nid = ALC662_DIGOUT_NID,
17326 .dig_in_nid = ALC662_DIGIN_NID,
17327 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17328 .channel_mode = alc662_3ST_2ch_modes,
17329 .input_mux = &alc662_capture_source,
17331 [ALC662_3ST_6ch_DIG] = {
17332 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17333 .init_verbs = { alc662_init_verbs },
17334 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17335 .dac_nids = alc662_dac_nids,
17336 .dig_out_nid = ALC662_DIGOUT_NID,
17337 .dig_in_nid = ALC662_DIGIN_NID,
17338 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17339 .channel_mode = alc662_3ST_6ch_modes,
17341 .input_mux = &alc662_capture_source,
17343 [ALC662_3ST_6ch] = {
17344 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17345 .init_verbs = { alc662_init_verbs },
17346 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17347 .dac_nids = alc662_dac_nids,
17348 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17349 .channel_mode = alc662_3ST_6ch_modes,
17351 .input_mux = &alc662_capture_source,
17353 [ALC662_5ST_DIG] = {
17354 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17355 .init_verbs = { alc662_init_verbs },
17356 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17357 .dac_nids = alc662_dac_nids,
17358 .dig_out_nid = ALC662_DIGOUT_NID,
17359 .dig_in_nid = ALC662_DIGIN_NID,
17360 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17361 .channel_mode = alc662_5stack_modes,
17362 .input_mux = &alc662_capture_source,
17364 [ALC662_LENOVO_101E] = {
17365 .mixers = { alc662_lenovo_101e_mixer },
17366 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17367 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17368 .dac_nids = alc662_dac_nids,
17369 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17370 .channel_mode = alc662_3ST_2ch_modes,
17371 .input_mux = &alc662_lenovo_101e_capture_source,
17372 .unsol_event = alc662_lenovo_101e_unsol_event,
17373 .init_hook = alc662_lenovo_101e_all_automute,
17375 [ALC662_ASUS_EEEPC_P701] = {
17376 .mixers = { alc662_eeepc_p701_mixer },
17377 .init_verbs = { alc662_init_verbs,
17378 alc662_eeepc_sue_init_verbs },
17379 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17380 .dac_nids = alc662_dac_nids,
17381 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17382 .channel_mode = alc662_3ST_2ch_modes,
17383 .unsol_event = alc662_eeepc_unsol_event,
17384 .setup = alc662_eeepc_setup,
17385 .init_hook = alc662_eeepc_inithook,
17387 [ALC662_ASUS_EEEPC_EP20] = {
17388 .mixers = { alc662_eeepc_ep20_mixer,
17389 alc662_chmode_mixer },
17390 .init_verbs = { alc662_init_verbs,
17391 alc662_eeepc_ep20_sue_init_verbs },
17392 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17393 .dac_nids = alc662_dac_nids,
17394 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17395 .channel_mode = alc662_3ST_6ch_modes,
17396 .input_mux = &alc662_lenovo_101e_capture_source,
17397 .unsol_event = alc662_eeepc_unsol_event,
17398 .setup = alc662_eeepc_ep20_setup,
17399 .init_hook = alc662_eeepc_ep20_inithook,
17402 .mixers = { alc662_ecs_mixer },
17403 .init_verbs = { alc662_init_verbs,
17404 alc662_ecs_init_verbs },
17405 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17406 .dac_nids = alc662_dac_nids,
17407 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17408 .channel_mode = alc662_3ST_2ch_modes,
17409 .unsol_event = alc662_eeepc_unsol_event,
17410 .setup = alc662_eeepc_setup,
17411 .init_hook = alc662_eeepc_inithook,
17413 [ALC663_ASUS_M51VA] = {
17414 .mixers = { alc663_m51va_mixer },
17415 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17416 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17417 .dac_nids = alc662_dac_nids,
17418 .dig_out_nid = ALC662_DIGOUT_NID,
17419 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17420 .channel_mode = alc662_3ST_2ch_modes,
17421 .unsol_event = alc663_m51va_unsol_event,
17422 .setup = alc663_m51va_setup,
17423 .init_hook = alc663_m51va_inithook,
17425 [ALC663_ASUS_G71V] = {
17426 .mixers = { alc663_g71v_mixer },
17427 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17428 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17429 .dac_nids = alc662_dac_nids,
17430 .dig_out_nid = ALC662_DIGOUT_NID,
17431 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17432 .channel_mode = alc662_3ST_2ch_modes,
17433 .unsol_event = alc663_g71v_unsol_event,
17434 .setup = alc663_g71v_setup,
17435 .init_hook = alc663_g71v_inithook,
17437 [ALC663_ASUS_H13] = {
17438 .mixers = { alc663_m51va_mixer },
17439 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17440 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17441 .dac_nids = alc662_dac_nids,
17442 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17443 .channel_mode = alc662_3ST_2ch_modes,
17444 .unsol_event = alc663_m51va_unsol_event,
17445 .init_hook = alc663_m51va_inithook,
17447 [ALC663_ASUS_G50V] = {
17448 .mixers = { alc663_g50v_mixer },
17449 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17450 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17451 .dac_nids = alc662_dac_nids,
17452 .dig_out_nid = ALC662_DIGOUT_NID,
17453 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17454 .channel_mode = alc662_3ST_6ch_modes,
17455 .input_mux = &alc663_capture_source,
17456 .unsol_event = alc663_g50v_unsol_event,
17457 .setup = alc663_g50v_setup,
17458 .init_hook = alc663_g50v_inithook,
17460 [ALC663_ASUS_MODE1] = {
17461 .mixers = { alc663_m51va_mixer },
17462 .cap_mixer = alc662_auto_capture_mixer,
17463 .init_verbs = { alc662_init_verbs,
17464 alc663_21jd_amic_init_verbs },
17465 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17467 .dac_nids = alc662_dac_nids,
17468 .dig_out_nid = ALC662_DIGOUT_NID,
17469 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17470 .channel_mode = alc662_3ST_2ch_modes,
17471 .unsol_event = alc663_mode1_unsol_event,
17472 .setup = alc663_mode1_setup,
17473 .init_hook = alc663_mode1_inithook,
17475 [ALC662_ASUS_MODE2] = {
17476 .mixers = { alc662_1bjd_mixer },
17477 .cap_mixer = alc662_auto_capture_mixer,
17478 .init_verbs = { alc662_init_verbs,
17479 alc662_1bjd_amic_init_verbs },
17480 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17481 .dac_nids = alc662_dac_nids,
17482 .dig_out_nid = ALC662_DIGOUT_NID,
17483 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17484 .channel_mode = alc662_3ST_2ch_modes,
17485 .unsol_event = alc662_mode2_unsol_event,
17486 .setup = alc662_mode2_setup,
17487 .init_hook = alc662_mode2_inithook,
17489 [ALC663_ASUS_MODE3] = {
17490 .mixers = { alc663_two_hp_m1_mixer },
17491 .cap_mixer = alc662_auto_capture_mixer,
17492 .init_verbs = { alc662_init_verbs,
17493 alc663_two_hp_amic_m1_init_verbs },
17494 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17496 .dac_nids = alc662_dac_nids,
17497 .dig_out_nid = ALC662_DIGOUT_NID,
17498 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17499 .channel_mode = alc662_3ST_2ch_modes,
17500 .unsol_event = alc663_mode3_unsol_event,
17501 .setup = alc663_mode3_setup,
17502 .init_hook = alc663_mode3_inithook,
17504 [ALC663_ASUS_MODE4] = {
17505 .mixers = { alc663_asus_21jd_clfe_mixer },
17506 .cap_mixer = alc662_auto_capture_mixer,
17507 .init_verbs = { alc662_init_verbs,
17508 alc663_21jd_amic_init_verbs},
17509 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17511 .dac_nids = alc662_dac_nids,
17512 .dig_out_nid = ALC662_DIGOUT_NID,
17513 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17514 .channel_mode = alc662_3ST_2ch_modes,
17515 .unsol_event = alc663_mode4_unsol_event,
17516 .setup = alc663_mode4_setup,
17517 .init_hook = alc663_mode4_inithook,
17519 [ALC663_ASUS_MODE5] = {
17520 .mixers = { alc663_asus_15jd_clfe_mixer },
17521 .cap_mixer = alc662_auto_capture_mixer,
17522 .init_verbs = { alc662_init_verbs,
17523 alc663_15jd_amic_init_verbs },
17524 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17526 .dac_nids = alc662_dac_nids,
17527 .dig_out_nid = ALC662_DIGOUT_NID,
17528 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17529 .channel_mode = alc662_3ST_2ch_modes,
17530 .unsol_event = alc663_mode5_unsol_event,
17531 .setup = alc663_mode5_setup,
17532 .init_hook = alc663_mode5_inithook,
17534 [ALC663_ASUS_MODE6] = {
17535 .mixers = { alc663_two_hp_m2_mixer },
17536 .cap_mixer = alc662_auto_capture_mixer,
17537 .init_verbs = { alc662_init_verbs,
17538 alc663_two_hp_amic_m2_init_verbs },
17539 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17541 .dac_nids = alc662_dac_nids,
17542 .dig_out_nid = ALC662_DIGOUT_NID,
17543 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17544 .channel_mode = alc662_3ST_2ch_modes,
17545 .unsol_event = alc663_mode6_unsol_event,
17546 .setup = alc663_mode6_setup,
17547 .init_hook = alc663_mode6_inithook,
17549 [ALC663_ASUS_MODE7] = {
17550 .mixers = { alc663_mode7_mixer },
17551 .cap_mixer = alc662_auto_capture_mixer,
17552 .init_verbs = { alc662_init_verbs,
17553 alc663_mode7_init_verbs },
17554 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17556 .dac_nids = alc662_dac_nids,
17557 .dig_out_nid = ALC662_DIGOUT_NID,
17558 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17559 .channel_mode = alc662_3ST_2ch_modes,
17560 .unsol_event = alc663_mode7_unsol_event,
17561 .setup = alc663_mode7_setup,
17562 .init_hook = alc663_mode7_inithook,
17564 [ALC663_ASUS_MODE8] = {
17565 .mixers = { alc663_mode8_mixer },
17566 .cap_mixer = alc662_auto_capture_mixer,
17567 .init_verbs = { alc662_init_verbs,
17568 alc663_mode8_init_verbs },
17569 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17571 .dac_nids = alc662_dac_nids,
17572 .dig_out_nid = ALC662_DIGOUT_NID,
17573 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17574 .channel_mode = alc662_3ST_2ch_modes,
17575 .unsol_event = alc663_mode8_unsol_event,
17576 .setup = alc663_mode8_setup,
17577 .init_hook = alc663_mode8_inithook,
17580 .mixers = { alc663_m51va_mixer },
17581 .cap_mixer = alc272_auto_capture_mixer,
17582 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17583 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17584 .dac_nids = alc662_dac_nids,
17585 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17586 .adc_nids = alc272_adc_nids,
17587 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17588 .capsrc_nids = alc272_capsrc_nids,
17589 .channel_mode = alc662_3ST_2ch_modes,
17590 .unsol_event = alc663_m51va_unsol_event,
17591 .setup = alc663_m51va_setup,
17592 .init_hook = alc663_m51va_inithook,
17594 [ALC272_DELL_ZM1] = {
17595 .mixers = { alc663_m51va_mixer },
17596 .cap_mixer = alc662_auto_capture_mixer,
17597 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17598 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17599 .dac_nids = alc662_dac_nids,
17600 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17601 .adc_nids = alc662_adc_nids,
17603 .capsrc_nids = alc662_capsrc_nids,
17604 .channel_mode = alc662_3ST_2ch_modes,
17605 .unsol_event = alc663_m51va_unsol_event,
17606 .setup = alc663_m51va_setup,
17607 .init_hook = alc663_m51va_inithook,
17609 [ALC272_SAMSUNG_NC10] = {
17610 .mixers = { alc272_nc10_mixer },
17611 .init_verbs = { alc662_init_verbs,
17612 alc663_21jd_amic_init_verbs },
17613 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17614 .dac_nids = alc272_dac_nids,
17615 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17616 .channel_mode = alc662_3ST_2ch_modes,
17617 /*.input_mux = &alc272_nc10_capture_source,*/
17618 .unsol_event = alc663_mode4_unsol_event,
17619 .setup = alc663_mode4_setup,
17620 .init_hook = alc663_mode4_inithook,
17626 * BIOS auto configuration
17629 /* convert from MIX nid to DAC */
17630 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17634 else if (nid >= 0x0c && nid <= 0x0e)
17635 return nid - 0x0c + 0x02;
17640 /* get MIX nid connected to the given pin targeted to DAC */
17641 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17647 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17648 for (i = 0; i < num; i++) {
17649 if (alc662_mix_to_dac(mix[i]) == dac)
17655 /* look for an empty DAC slot */
17656 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17658 struct alc_spec *spec = codec->spec;
17662 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17665 for (i = 0; i < num; i++) {
17666 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17669 for (j = 0; j < spec->multiout.num_dacs; j++)
17670 if (spec->multiout.dac_nids[j] == nid)
17672 if (j >= spec->multiout.num_dacs)
17678 /* fill in the dac_nids table from the parsed pin configuration */
17679 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17680 const struct auto_pin_cfg *cfg)
17682 struct alc_spec *spec = codec->spec;
17686 spec->multiout.dac_nids = spec->private_dac_nids;
17687 for (i = 0; i < cfg->line_outs; i++) {
17688 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17691 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17696 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17697 hda_nid_t nid, unsigned int chs)
17699 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17700 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17703 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17704 hda_nid_t nid, unsigned int chs)
17706 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17707 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17710 #define alc662_add_stereo_vol(spec, pfx, nid) \
17711 alc662_add_vol_ctl(spec, pfx, nid, 3)
17712 #define alc662_add_stereo_sw(spec, pfx, nid) \
17713 alc662_add_sw_ctl(spec, pfx, nid, 3)
17715 /* add playback controls from the parsed DAC table */
17716 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17717 const struct auto_pin_cfg *cfg)
17719 struct alc_spec *spec = codec->spec;
17720 static const char *chname[4] = {
17721 "Front", "Surround", NULL /*CLFE*/, "Side"
17723 hda_nid_t nid, mix;
17726 for (i = 0; i < cfg->line_outs; i++) {
17727 nid = spec->multiout.dac_nids[i];
17730 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17735 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17738 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17741 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17744 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17749 if (cfg->line_outs == 1 &&
17750 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17757 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17760 if (cfg->line_outs == 1 &&
17761 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17763 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17771 /* add playback controls for speaker and HP outputs */
17772 /* return DAC nid if any new DAC is assigned */
17773 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17776 struct alc_spec *spec = codec->spec;
17777 hda_nid_t nid, mix;
17782 nid = alc662_look_for_dac(codec, pin);
17784 /* the corresponding DAC is already occupied */
17785 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17786 return 0; /* no way */
17787 /* create a switch only */
17788 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17789 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17792 mix = alc662_dac_to_mix(codec, pin, nid);
17795 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17798 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17804 /* create playback/capture controls for input pins */
17805 #define alc662_auto_create_input_ctls \
17806 alc882_auto_create_input_ctls
17808 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17809 hda_nid_t nid, int pin_type,
17815 alc_set_pin_output(codec, nid, pin_type);
17816 /* need the manual connection? */
17817 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17820 for (i = 0; i < num; i++) {
17821 if (alc662_mix_to_dac(srcs[i]) != dac)
17823 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17828 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17830 struct alc_spec *spec = codec->spec;
17831 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17834 for (i = 0; i <= HDA_SIDE; i++) {
17835 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17837 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17838 spec->multiout.dac_nids[i]);
17842 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17844 struct alc_spec *spec = codec->spec;
17847 pin = spec->autocfg.hp_pins[0];
17849 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17850 spec->multiout.hp_nid);
17851 pin = spec->autocfg.speaker_pins[0];
17853 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17854 spec->multiout.extra_out_nid[0]);
17857 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17859 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17861 struct alc_spec *spec = codec->spec;
17864 for (i = 0; i < AUTO_PIN_LAST; i++) {
17865 hda_nid_t nid = spec->autocfg.input_pins[i];
17866 if (alc_is_input_pin(codec, nid)) {
17867 alc_set_input_pin(codec, nid, i);
17868 if (nid != ALC662_PIN_CD_NID &&
17869 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17870 snd_hda_codec_write(codec, nid, 0,
17871 AC_VERB_SET_AMP_GAIN_MUTE,
17877 #define alc662_auto_init_input_src alc882_auto_init_input_src
17879 static int alc662_parse_auto_config(struct hda_codec *codec)
17881 struct alc_spec *spec = codec->spec;
17883 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17885 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17889 if (!spec->autocfg.line_outs)
17890 return 0; /* can't find valid BIOS pin config */
17892 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17895 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17898 err = alc662_auto_create_extra_out(codec,
17899 spec->autocfg.speaker_pins[0],
17904 spec->multiout.extra_out_nid[0] = err;
17905 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17910 spec->multiout.hp_nid = err;
17911 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17915 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17917 if (spec->autocfg.dig_outs)
17918 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17920 if (spec->kctls.list)
17921 add_mixer(spec, spec->kctls.list);
17923 spec->num_mux_defs = 1;
17924 spec->input_mux = &spec->private_imux[0];
17926 add_verb(spec, alc662_auto_init_verbs);
17927 if (codec->vendor_id == 0x10ec0663)
17928 add_verb(spec, alc663_auto_init_verbs);
17930 err = alc_auto_add_mic_boost(codec);
17934 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17939 /* additional initialization for auto-configuration model */
17940 static void alc662_auto_init(struct hda_codec *codec)
17942 struct alc_spec *spec = codec->spec;
17943 alc662_auto_init_multi_out(codec);
17944 alc662_auto_init_hp_out(codec);
17945 alc662_auto_init_analog_input(codec);
17946 alc662_auto_init_input_src(codec);
17947 if (spec->unsol_event)
17948 alc_inithook(codec);
17951 static int patch_alc662(struct hda_codec *codec)
17953 struct alc_spec *spec;
17954 int err, board_config;
17956 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17960 codec->spec = spec;
17962 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17964 if (alc_read_coef_idx(codec, 0)==0x8020){
17965 kfree(codec->chip_name);
17966 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17967 if (!codec->chip_name) {
17973 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17976 if (board_config < 0) {
17977 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17979 board_config = ALC662_AUTO;
17982 if (board_config == ALC662_AUTO) {
17983 /* automatic parse from the BIOS config */
17984 err = alc662_parse_auto_config(codec);
17990 "hda_codec: Cannot set up configuration "
17991 "from BIOS. Using base mode...\n");
17992 board_config = ALC662_3ST_2ch_DIG;
17996 err = snd_hda_attach_beep_device(codec, 0x1);
18002 if (board_config != ALC662_AUTO)
18003 setup_preset(codec, &alc662_presets[board_config]);
18005 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18006 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18008 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18009 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18011 if (!spec->adc_nids) {
18012 spec->adc_nids = alc662_adc_nids;
18013 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18015 if (!spec->capsrc_nids)
18016 spec->capsrc_nids = alc662_capsrc_nids;
18018 if (!spec->cap_mixer)
18019 set_capture_mixer(codec);
18020 if (codec->vendor_id == 0x10ec0662)
18021 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18023 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18025 spec->vmaster_nid = 0x02;
18027 codec->patch_ops = alc_patch_ops;
18028 if (board_config == ALC662_AUTO)
18029 spec->init_hook = alc662_auto_init;
18030 #ifdef CONFIG_SND_HDA_POWER_SAVE
18031 if (!spec->loopback.amplist)
18032 spec->loopback.amplist = alc662_loopbacks;
18034 codec->proc_widget_hook = print_realtek_coef;
18039 static int patch_alc888(struct hda_codec *codec)
18041 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18042 kfree(codec->chip_name);
18043 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18044 if (!codec->chip_name) {
18048 return patch_alc662(codec);
18050 return patch_alc882(codec);
18056 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18057 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18058 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18059 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18060 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18061 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18062 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18063 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18064 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18065 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18066 .patch = patch_alc861 },
18067 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18068 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18069 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18070 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18071 .patch = patch_alc882 },
18072 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18073 .patch = patch_alc662 },
18074 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18075 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18076 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18077 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18078 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18079 .patch = patch_alc882 },
18080 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18081 .patch = patch_alc882 },
18082 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18083 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18084 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18085 .patch = patch_alc882 },
18086 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18087 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18088 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18089 {} /* terminator */
18092 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18094 MODULE_LICENSE("GPL");
18095 MODULE_DESCRIPTION("Realtek HD-audio codec");
18097 static struct hda_codec_preset_list realtek_list = {
18098 .preset = snd_hda_preset_realtek,
18099 .owner = THIS_MODULE,
18102 static int __init patch_realtek_init(void)
18104 return snd_hda_add_codec_preset(&realtek_list);
18107 static void __exit patch_realtek_exit(void)
18109 snd_hda_delete_codec_preset(&realtek_list);
18112 module_init(patch_realtek_init)
18113 module_exit(patch_realtek_exit)