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 */
141 ALC269_MODEL_LAST /* last tag */
158 /* ALC861-VD models */
180 ALC662_ASUS_EEEPC_P701,
181 ALC662_ASUS_EEEPC_EP20,
223 ALC883_TARGA_2ch_DIG,
224 ALC883_TARGA_8ch_DIG,
227 ALC888_ACER_ASPIRE_4930G,
228 ALC888_ACER_ASPIRE_6530G,
229 ALC888_ACER_ASPIRE_8930G,
230 ALC888_ACER_ASPIRE_7730G,
234 ALC883_LENOVO_101E_2ch,
235 ALC883_LENOVO_NB0763,
236 ALC888_LENOVO_MS7195_DIG,
244 ALC883_FUJITSU_PI2515,
245 ALC888_FUJITSU_XA3530,
246 ALC883_3ST_6ch_INTEL,
259 #define GPIO_MASK 0x03
261 /* extra amp-initialization sequence types */
270 struct alc_mic_route {
272 unsigned char mux_idx;
273 unsigned char amix_idx;
276 #define MUX_IDX_UNDEF ((unsigned char)-1)
278 struct alc_customize_define {
279 unsigned int sku_cfg;
280 unsigned char port_connectivity;
281 unsigned char check_sum;
282 unsigned char customization;
283 unsigned char external_amp;
284 unsigned int enable_pcbeep:1;
285 unsigned int platform_type:1;
287 unsigned int override:1;
291 /* codec parameterization */
292 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
293 unsigned int num_mixers;
294 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
295 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
297 const struct hda_verb *init_verbs[10]; /* initialization verbs
301 unsigned int num_init_verbs;
303 char stream_name_analog[32]; /* analog PCM stream */
304 struct hda_pcm_stream *stream_analog_playback;
305 struct hda_pcm_stream *stream_analog_capture;
306 struct hda_pcm_stream *stream_analog_alt_playback;
307 struct hda_pcm_stream *stream_analog_alt_capture;
309 char stream_name_digital[32]; /* digital PCM stream */
310 struct hda_pcm_stream *stream_digital_playback;
311 struct hda_pcm_stream *stream_digital_capture;
314 struct hda_multi_out multiout; /* playback set-up
315 * max_channels, dacs must be set
316 * dig_out_nid and hp_nid are optional
318 hda_nid_t alt_dac_nid;
319 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
323 unsigned int num_adc_nids;
325 hda_nid_t *capsrc_nids;
326 hda_nid_t dig_in_nid; /* digital-in NID; optional */
329 unsigned int num_mux_defs;
330 const struct hda_input_mux *input_mux;
331 unsigned int cur_mux[3];
332 struct alc_mic_route ext_mic;
333 struct alc_mic_route int_mic;
336 const struct hda_channel_mode *channel_mode;
337 int num_channel_mode;
339 int const_channel_count;
340 int ext_channel_count;
342 /* PCM information */
343 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
345 /* dynamic controls, init_verbs and input_mux */
346 struct auto_pin_cfg autocfg;
347 struct alc_customize_define cdefine;
348 struct snd_array kctls;
349 struct hda_input_mux private_imux[3];
350 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
351 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
352 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
355 void (*init_hook)(struct hda_codec *codec);
356 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
357 #ifdef CONFIG_SND_HDA_POWER_SAVE
358 void (*power_hook)(struct hda_codec *codec);
361 /* for pin sensing */
362 unsigned int sense_updated: 1;
363 unsigned int jack_present: 1;
364 unsigned int master_sw: 1;
365 unsigned int auto_mic:1;
368 unsigned int no_analog :1; /* digital I/O only */
371 /* for virtual master */
372 hda_nid_t vmaster_nid;
373 #ifdef CONFIG_SND_HDA_POWER_SAVE
374 struct hda_loopback_check loopback;
379 unsigned int pll_coef_idx, pll_coef_bit;
383 * configuration template - to be copied to the spec instance
385 struct alc_config_preset {
386 struct snd_kcontrol_new *mixers[5]; /* should be identical size
389 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
390 const struct hda_verb *init_verbs[5];
391 unsigned int num_dacs;
393 hda_nid_t dig_out_nid; /* optional */
394 hda_nid_t hp_nid; /* optional */
395 hda_nid_t *slave_dig_outs;
396 unsigned int num_adc_nids;
398 hda_nid_t *capsrc_nids;
399 hda_nid_t dig_in_nid;
400 unsigned int num_channel_mode;
401 const struct hda_channel_mode *channel_mode;
403 int const_channel_count;
404 unsigned int num_mux_defs;
405 const struct hda_input_mux *input_mux;
406 void (*unsol_event)(struct hda_codec *, unsigned int);
407 void (*setup)(struct hda_codec *);
408 void (*init_hook)(struct hda_codec *);
409 #ifdef CONFIG_SND_HDA_POWER_SAVE
410 struct hda_amp_list *loopbacks;
411 void (*power_hook)(struct hda_codec *codec);
419 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
420 struct snd_ctl_elem_info *uinfo)
422 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
423 struct alc_spec *spec = codec->spec;
424 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
425 if (mux_idx >= spec->num_mux_defs)
427 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
429 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
432 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
433 struct snd_ctl_elem_value *ucontrol)
435 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
436 struct alc_spec *spec = codec->spec;
437 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
439 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
443 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
444 struct snd_ctl_elem_value *ucontrol)
446 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
447 struct alc_spec *spec = codec->spec;
448 const struct hda_input_mux *imux;
449 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
450 unsigned int mux_idx;
451 hda_nid_t nid = spec->capsrc_nids ?
452 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
455 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
456 imux = &spec->input_mux[mux_idx];
457 if (!imux->num_items && mux_idx > 0)
458 imux = &spec->input_mux[0];
460 type = get_wcaps_type(get_wcaps(codec, nid));
461 if (type == AC_WID_AUD_MIX) {
462 /* Matrix-mixer style (e.g. ALC882) */
463 unsigned int *cur_val = &spec->cur_mux[adc_idx];
466 idx = ucontrol->value.enumerated.item[0];
467 if (idx >= imux->num_items)
468 idx = imux->num_items - 1;
471 for (i = 0; i < imux->num_items; i++) {
472 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
473 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
474 imux->items[i].index,
480 /* MUX style (e.g. ALC880) */
481 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
482 &spec->cur_mux[adc_idx]);
487 * channel mode setting
489 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
490 struct snd_ctl_elem_info *uinfo)
492 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
493 struct alc_spec *spec = codec->spec;
494 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
495 spec->num_channel_mode);
498 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
499 struct snd_ctl_elem_value *ucontrol)
501 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
502 struct alc_spec *spec = codec->spec;
503 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
504 spec->num_channel_mode,
505 spec->ext_channel_count);
508 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
509 struct snd_ctl_elem_value *ucontrol)
511 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
512 struct alc_spec *spec = codec->spec;
513 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
514 spec->num_channel_mode,
515 &spec->ext_channel_count);
516 if (err >= 0 && !spec->const_channel_count) {
517 spec->multiout.max_channels = spec->ext_channel_count;
518 if (spec->need_dac_fix)
519 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
525 * Control the mode of pin widget settings via the mixer. "pc" is used
526 * instead of "%" to avoid consequences of accidently treating the % as
527 * being part of a format specifier. Maximum allowed length of a value is
528 * 63 characters plus NULL terminator.
530 * Note: some retasking pin complexes seem to ignore requests for input
531 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
532 * are requested. Therefore order this list so that this behaviour will not
533 * cause problems when mixer clients move through the enum sequentially.
534 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
537 static char *alc_pin_mode_names[] = {
538 "Mic 50pc bias", "Mic 80pc bias",
539 "Line in", "Line out", "Headphone out",
541 static unsigned char alc_pin_mode_values[] = {
542 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
544 /* The control can present all 5 options, or it can limit the options based
545 * in the pin being assumed to be exclusively an input or an output pin. In
546 * addition, "input" pins may or may not process the mic bias option
547 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
548 * accept requests for bias as of chip versions up to March 2006) and/or
549 * wiring in the computer.
551 #define ALC_PIN_DIR_IN 0x00
552 #define ALC_PIN_DIR_OUT 0x01
553 #define ALC_PIN_DIR_INOUT 0x02
554 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
555 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
557 /* Info about the pin modes supported by the different pin direction modes.
558 * For each direction the minimum and maximum values are given.
560 static signed char alc_pin_mode_dir_info[5][2] = {
561 { 0, 2 }, /* ALC_PIN_DIR_IN */
562 { 3, 4 }, /* ALC_PIN_DIR_OUT */
563 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
564 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
565 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
567 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
568 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
569 #define alc_pin_mode_n_items(_dir) \
570 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
572 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
573 struct snd_ctl_elem_info *uinfo)
575 unsigned int item_num = uinfo->value.enumerated.item;
576 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
578 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
580 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
582 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
583 item_num = alc_pin_mode_min(dir);
584 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
588 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
589 struct snd_ctl_elem_value *ucontrol)
592 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
593 hda_nid_t nid = kcontrol->private_value & 0xffff;
594 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
595 long *valp = ucontrol->value.integer.value;
596 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
597 AC_VERB_GET_PIN_WIDGET_CONTROL,
600 /* Find enumerated value for current pinctl setting */
601 i = alc_pin_mode_min(dir);
602 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
604 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
608 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
609 struct snd_ctl_elem_value *ucontrol)
612 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
613 hda_nid_t nid = kcontrol->private_value & 0xffff;
614 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
615 long val = *ucontrol->value.integer.value;
616 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
617 AC_VERB_GET_PIN_WIDGET_CONTROL,
620 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
621 val = alc_pin_mode_min(dir);
623 change = pinctl != alc_pin_mode_values[val];
625 /* Set pin mode to that requested */
626 snd_hda_codec_write_cache(codec, nid, 0,
627 AC_VERB_SET_PIN_WIDGET_CONTROL,
628 alc_pin_mode_values[val]);
630 /* Also enable the retasking pin's input/output as required
631 * for the requested pin mode. Enum values of 2 or less are
634 * Dynamically switching the input/output buffers probably
635 * reduces noise slightly (particularly on input) so we'll
636 * do it. However, having both input and output buffers
637 * enabled simultaneously doesn't seem to be problematic if
638 * this turns out to be necessary in the future.
641 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
642 HDA_AMP_MUTE, HDA_AMP_MUTE);
643 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
646 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
647 HDA_AMP_MUTE, HDA_AMP_MUTE);
648 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
655 #define ALC_PIN_MODE(xname, nid, dir) \
656 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
657 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
658 .info = alc_pin_mode_info, \
659 .get = alc_pin_mode_get, \
660 .put = alc_pin_mode_put, \
661 .private_value = nid | (dir<<16) }
663 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
664 * together using a mask with more than one bit set. This control is
665 * currently used only by the ALC260 test model. At this stage they are not
666 * needed for any "production" models.
668 #ifdef CONFIG_SND_DEBUG
669 #define alc_gpio_data_info snd_ctl_boolean_mono_info
671 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
672 struct snd_ctl_elem_value *ucontrol)
674 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
675 hda_nid_t nid = kcontrol->private_value & 0xffff;
676 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
677 long *valp = ucontrol->value.integer.value;
678 unsigned int val = snd_hda_codec_read(codec, nid, 0,
679 AC_VERB_GET_GPIO_DATA, 0x00);
681 *valp = (val & mask) != 0;
684 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
685 struct snd_ctl_elem_value *ucontrol)
688 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
689 hda_nid_t nid = kcontrol->private_value & 0xffff;
690 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
691 long val = *ucontrol->value.integer.value;
692 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
693 AC_VERB_GET_GPIO_DATA,
696 /* Set/unset the masked GPIO bit(s) as needed */
697 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
702 snd_hda_codec_write_cache(codec, nid, 0,
703 AC_VERB_SET_GPIO_DATA, gpio_data);
707 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
708 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
709 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
710 .info = alc_gpio_data_info, \
711 .get = alc_gpio_data_get, \
712 .put = alc_gpio_data_put, \
713 .private_value = nid | (mask<<16) }
714 #endif /* CONFIG_SND_DEBUG */
716 /* A switch control to allow the enabling of the digital IO pins on the
717 * ALC260. This is incredibly simplistic; the intention of this control is
718 * to provide something in the test model allowing digital outputs to be
719 * identified if present. If models are found which can utilise these
720 * outputs a more complete mixer control can be devised for those models if
723 #ifdef CONFIG_SND_DEBUG
724 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
726 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
727 struct snd_ctl_elem_value *ucontrol)
729 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
730 hda_nid_t nid = kcontrol->private_value & 0xffff;
731 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
732 long *valp = ucontrol->value.integer.value;
733 unsigned int val = snd_hda_codec_read(codec, nid, 0,
734 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
736 *valp = (val & mask) != 0;
739 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
740 struct snd_ctl_elem_value *ucontrol)
743 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
744 hda_nid_t nid = kcontrol->private_value & 0xffff;
745 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
746 long val = *ucontrol->value.integer.value;
747 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
748 AC_VERB_GET_DIGI_CONVERT_1,
751 /* Set/unset the masked control bit(s) as needed */
752 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
757 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
762 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
763 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
764 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
765 .info = alc_spdif_ctrl_info, \
766 .get = alc_spdif_ctrl_get, \
767 .put = alc_spdif_ctrl_put, \
768 .private_value = nid | (mask<<16) }
769 #endif /* CONFIG_SND_DEBUG */
771 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
772 * Again, this is only used in the ALC26x test models to help identify when
773 * the EAPD line must be asserted for features to work.
775 #ifdef CONFIG_SND_DEBUG
776 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
778 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
779 struct snd_ctl_elem_value *ucontrol)
781 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
782 hda_nid_t nid = kcontrol->private_value & 0xffff;
783 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
784 long *valp = ucontrol->value.integer.value;
785 unsigned int val = snd_hda_codec_read(codec, nid, 0,
786 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
788 *valp = (val & mask) != 0;
792 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
793 struct snd_ctl_elem_value *ucontrol)
796 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
797 hda_nid_t nid = kcontrol->private_value & 0xffff;
798 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
799 long val = *ucontrol->value.integer.value;
800 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
801 AC_VERB_GET_EAPD_BTLENABLE,
804 /* Set/unset the masked control bit(s) as needed */
805 change = (!val ? 0 : mask) != (ctrl_data & mask);
810 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
816 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
817 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
818 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
819 .info = alc_eapd_ctrl_info, \
820 .get = alc_eapd_ctrl_get, \
821 .put = alc_eapd_ctrl_put, \
822 .private_value = nid | (mask<<16) }
823 #endif /* CONFIG_SND_DEBUG */
826 * set up the input pin config (depending on the given auto-pin type)
828 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
831 unsigned int val = PIN_IN;
833 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
835 pincap = snd_hda_query_pin_caps(codec, nid);
836 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
837 if (pincap & AC_PINCAP_VREF_80)
839 else if (pincap & AC_PINCAP_VREF_50)
841 else if (pincap & AC_PINCAP_VREF_100)
843 else if (pincap & AC_PINCAP_VREF_GRD)
846 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
851 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
853 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
855 spec->mixers[spec->num_mixers++] = mix;
858 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
860 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
862 spec->init_verbs[spec->num_init_verbs++] = verb;
866 * set up from the preset table
868 static void setup_preset(struct hda_codec *codec,
869 const struct alc_config_preset *preset)
871 struct alc_spec *spec = codec->spec;
874 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
875 add_mixer(spec, preset->mixers[i]);
876 spec->cap_mixer = preset->cap_mixer;
877 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
879 add_verb(spec, preset->init_verbs[i]);
881 spec->channel_mode = preset->channel_mode;
882 spec->num_channel_mode = preset->num_channel_mode;
883 spec->need_dac_fix = preset->need_dac_fix;
884 spec->const_channel_count = preset->const_channel_count;
886 if (preset->const_channel_count)
887 spec->multiout.max_channels = preset->const_channel_count;
889 spec->multiout.max_channels = spec->channel_mode[0].channels;
890 spec->ext_channel_count = spec->channel_mode[0].channels;
892 spec->multiout.num_dacs = preset->num_dacs;
893 spec->multiout.dac_nids = preset->dac_nids;
894 spec->multiout.dig_out_nid = preset->dig_out_nid;
895 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
896 spec->multiout.hp_nid = preset->hp_nid;
898 spec->num_mux_defs = preset->num_mux_defs;
899 if (!spec->num_mux_defs)
900 spec->num_mux_defs = 1;
901 spec->input_mux = preset->input_mux;
903 spec->num_adc_nids = preset->num_adc_nids;
904 spec->adc_nids = preset->adc_nids;
905 spec->capsrc_nids = preset->capsrc_nids;
906 spec->dig_in_nid = preset->dig_in_nid;
908 spec->unsol_event = preset->unsol_event;
909 spec->init_hook = preset->init_hook;
910 #ifdef CONFIG_SND_HDA_POWER_SAVE
911 spec->power_hook = preset->power_hook;
912 spec->loopback.amplist = preset->loopbacks;
916 preset->setup(codec);
919 /* Enable GPIO mask and set output */
920 static struct hda_verb alc_gpio1_init_verbs[] = {
921 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
922 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
923 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
927 static struct hda_verb alc_gpio2_init_verbs[] = {
928 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
929 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
930 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
934 static struct hda_verb alc_gpio3_init_verbs[] = {
935 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
936 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
937 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
942 * Fix hardware PLL issue
943 * On some codecs, the analog PLL gating control must be off while
944 * the default value is 1.
946 static void alc_fix_pll(struct hda_codec *codec)
948 struct alc_spec *spec = codec->spec;
953 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
955 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
956 AC_VERB_GET_PROC_COEF, 0);
957 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
959 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
960 val & ~(1 << spec->pll_coef_bit));
963 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
964 unsigned int coef_idx, unsigned int coef_bit)
966 struct alc_spec *spec = codec->spec;
968 spec->pll_coef_idx = coef_idx;
969 spec->pll_coef_bit = coef_bit;
973 static void alc_automute_pin(struct hda_codec *codec)
975 struct alc_spec *spec = codec->spec;
976 unsigned int nid = spec->autocfg.hp_pins[0];
981 spec->jack_present = snd_hda_jack_detect(codec, nid);
982 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
983 nid = spec->autocfg.speaker_pins[i];
986 snd_hda_codec_write(codec, nid, 0,
987 AC_VERB_SET_PIN_WIDGET_CONTROL,
988 spec->jack_present ? 0 : PIN_OUT);
992 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
995 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
998 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
999 for (i = 0; i < nums; i++)
1005 static void alc_mic_automute(struct hda_codec *codec)
1007 struct alc_spec *spec = codec->spec;
1008 struct alc_mic_route *dead, *alive;
1009 unsigned int present, type;
1012 if (!spec->auto_mic)
1014 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1016 if (snd_BUG_ON(!spec->adc_nids))
1019 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1021 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1023 alive = &spec->ext_mic;
1024 dead = &spec->int_mic;
1026 alive = &spec->int_mic;
1027 dead = &spec->ext_mic;
1030 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1031 if (type == AC_WID_AUD_MIX) {
1032 /* Matrix-mixer style (e.g. ALC882) */
1033 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1036 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1038 HDA_AMP_MUTE, HDA_AMP_MUTE);
1040 /* MUX style (e.g. ALC880) */
1041 snd_hda_codec_write_cache(codec, cap_nid, 0,
1042 AC_VERB_SET_CONNECT_SEL,
1046 /* FIXME: analog mixer */
1049 /* unsolicited event for HP jack sensing */
1050 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1052 if (codec->vendor_id == 0x10ec0880)
1057 case ALC880_HP_EVENT:
1058 alc_automute_pin(codec);
1060 case ALC880_MIC_EVENT:
1061 alc_mic_automute(codec);
1066 static void alc_inithook(struct hda_codec *codec)
1068 alc_automute_pin(codec);
1069 alc_mic_automute(codec);
1072 /* additional initialization for ALC888 variants */
1073 static void alc888_coef_init(struct hda_codec *codec)
1077 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1078 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1079 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1080 if ((tmp & 0xf0) == 0x20)
1082 snd_hda_codec_read(codec, 0x20, 0,
1083 AC_VERB_SET_PROC_COEF, 0x830);
1086 snd_hda_codec_read(codec, 0x20, 0,
1087 AC_VERB_SET_PROC_COEF, 0x3030);
1090 static void alc889_coef_init(struct hda_codec *codec)
1094 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1095 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1096 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1100 /* turn on/off EAPD control (only if available) */
1101 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1103 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1105 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1106 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1110 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1115 case ALC_INIT_GPIO1:
1116 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1118 case ALC_INIT_GPIO2:
1119 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1121 case ALC_INIT_GPIO3:
1122 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1124 case ALC_INIT_DEFAULT:
1125 switch (codec->vendor_id) {
1127 set_eapd(codec, 0x0f, 1);
1128 set_eapd(codec, 0x10, 1);
1141 set_eapd(codec, 0x14, 1);
1142 set_eapd(codec, 0x15, 1);
1145 switch (codec->vendor_id) {
1147 snd_hda_codec_write(codec, 0x1a, 0,
1148 AC_VERB_SET_COEF_INDEX, 7);
1149 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1150 AC_VERB_GET_PROC_COEF, 0);
1151 snd_hda_codec_write(codec, 0x1a, 0,
1152 AC_VERB_SET_COEF_INDEX, 7);
1153 snd_hda_codec_write(codec, 0x1a, 0,
1154 AC_VERB_SET_PROC_COEF,
1164 alc889_coef_init(codec);
1167 alc888_coef_init(codec);
1169 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1172 snd_hda_codec_write(codec, 0x20, 0,
1173 AC_VERB_SET_COEF_INDEX, 7);
1174 tmp = snd_hda_codec_read(codec, 0x20, 0,
1175 AC_VERB_GET_PROC_COEF, 0);
1176 snd_hda_codec_write(codec, 0x20, 0,
1177 AC_VERB_SET_COEF_INDEX, 7);
1178 snd_hda_codec_write(codec, 0x20, 0,
1179 AC_VERB_SET_PROC_COEF,
1188 static void alc_init_auto_hp(struct hda_codec *codec)
1190 struct alc_spec *spec = codec->spec;
1192 if (!spec->autocfg.hp_pins[0])
1195 if (!spec->autocfg.speaker_pins[0]) {
1196 if (spec->autocfg.line_out_pins[0] &&
1197 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1198 spec->autocfg.speaker_pins[0] =
1199 spec->autocfg.line_out_pins[0];
1204 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1205 spec->autocfg.hp_pins[0]);
1206 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1207 AC_VERB_SET_UNSOLICITED_ENABLE,
1208 AC_USRSP_EN | ALC880_HP_EVENT);
1209 spec->unsol_event = alc_sku_unsol_event;
1212 static void alc_init_auto_mic(struct hda_codec *codec)
1214 struct alc_spec *spec = codec->spec;
1215 struct auto_pin_cfg *cfg = &spec->autocfg;
1216 hda_nid_t fixed, ext;
1219 /* there must be only two mic inputs exclusively */
1220 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1221 if (cfg->input_pins[i])
1225 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1226 hda_nid_t nid = cfg->input_pins[i];
1227 unsigned int defcfg;
1230 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1231 switch (get_defcfg_connect(defcfg)) {
1232 case AC_JACK_PORT_FIXED:
1234 return; /* already occupied */
1237 case AC_JACK_PORT_COMPLEX:
1239 return; /* already occupied */
1243 return; /* invalid entry */
1248 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1249 return; /* no unsol support */
1250 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1252 spec->ext_mic.pin = ext;
1253 spec->int_mic.pin = fixed;
1254 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1255 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1257 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1258 AC_VERB_SET_UNSOLICITED_ENABLE,
1259 AC_USRSP_EN | ALC880_MIC_EVENT);
1260 spec->unsol_event = alc_sku_unsol_event;
1263 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1265 unsigned int ass, tmp, i;
1267 struct alc_spec *spec = codec->spec;
1269 ass = codec->subsystem_id & 0xffff;
1270 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1274 if (codec->vendor_id == 0x10ec0260)
1276 ass = snd_hda_codec_get_pincfg(codec, nid);
1279 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1280 codec->chip_name, ass);
1286 for (i = 1; i < 16; i++) {
1290 if (((ass >> 16) & 0xf) != tmp)
1293 spec->cdefine.port_connectivity = ass >> 30;
1294 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1295 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1296 spec->cdefine.customization = ass >> 8;
1298 spec->cdefine.sku_cfg = ass;
1299 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1300 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1301 spec->cdefine.swap = (ass & 0x2) >> 1;
1302 spec->cdefine.override = ass & 0x1;
1304 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1305 nid, spec->cdefine.sku_cfg);
1306 snd_printd("SKU: port_connectivity=0x%x\n",
1307 spec->cdefine.port_connectivity);
1308 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1309 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1310 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1311 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1312 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1313 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1314 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1319 /* check subsystem ID and set up device-specific initialization;
1320 * return 1 if initialized, 0 if invalid SSID
1322 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1323 * 31 ~ 16 : Manufacture ID
1325 * 7 ~ 0 : Assembly ID
1326 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1328 static int alc_subsystem_id(struct hda_codec *codec,
1329 hda_nid_t porta, hda_nid_t porte,
1330 hda_nid_t portd, hda_nid_t porti)
1332 unsigned int ass, tmp, i;
1334 struct alc_spec *spec = codec->spec;
1336 ass = codec->subsystem_id & 0xffff;
1337 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1340 /* invalid SSID, check the special NID pin defcfg instead */
1342 * 31~30 : port connectivity
1345 * 19~16 : Check sum (15:1)
1350 if (codec->vendor_id == 0x10ec0260)
1352 ass = snd_hda_codec_get_pincfg(codec, nid);
1353 snd_printd("realtek: No valid SSID, "
1354 "checking pincfg 0x%08x for NID 0x%x\n",
1358 if ((ass >> 30) != 1) /* no physical connection */
1363 for (i = 1; i < 16; i++) {
1367 if (((ass >> 16) & 0xf) != tmp)
1370 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1371 ass & 0xffff, codec->vendor_id);
1375 * 2 : 0 --> Desktop, 1 --> Laptop
1376 * 3~5 : External Amplifier control
1379 tmp = (ass & 0x38) >> 3; /* external Amp control */
1382 spec->init_amp = ALC_INIT_GPIO1;
1385 spec->init_amp = ALC_INIT_GPIO2;
1388 spec->init_amp = ALC_INIT_GPIO3;
1391 spec->init_amp = ALC_INIT_DEFAULT;
1395 /* is laptop or Desktop and enable the function "Mute internal speaker
1396 * when the external headphone out jack is plugged"
1398 if (!(ass & 0x8000))
1401 * 10~8 : Jack location
1402 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1404 * 15 : 1 --> enable the function "Mute internal speaker
1405 * when the external headphone out jack is plugged"
1407 if (!spec->autocfg.hp_pins[0]) {
1409 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1420 for (i = 0; i < spec->autocfg.line_outs; i++)
1421 if (spec->autocfg.line_out_pins[i] == nid)
1423 spec->autocfg.hp_pins[0] = nid;
1426 alc_init_auto_hp(codec);
1427 alc_init_auto_mic(codec);
1431 static void alc_ssid_check(struct hda_codec *codec,
1432 hda_nid_t porta, hda_nid_t porte,
1433 hda_nid_t portd, hda_nid_t porti)
1435 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1436 struct alc_spec *spec = codec->spec;
1437 snd_printd("realtek: "
1438 "Enable default setup for auto mode as fallback\n");
1439 spec->init_amp = ALC_INIT_DEFAULT;
1440 alc_init_auto_hp(codec);
1441 alc_init_auto_mic(codec);
1446 * Fix-up pin default configurations and add default verbs
1455 const struct alc_pincfg *pins;
1456 const struct hda_verb *verbs;
1459 static void alc_pick_fixup(struct hda_codec *codec,
1460 const struct snd_pci_quirk *quirk,
1461 const struct alc_fixup *fix)
1463 const struct alc_pincfg *cfg;
1465 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1469 fix += quirk->value;
1472 for (; cfg->nid; cfg++)
1473 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1476 add_verb(codec->spec, fix->verbs);
1479 static int alc_read_coef_idx(struct hda_codec *codec,
1480 unsigned int coef_idx)
1483 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1485 val = snd_hda_codec_read(codec, 0x20, 0,
1486 AC_VERB_GET_PROC_COEF, 0);
1497 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1498 /* Mic-in jack as mic in */
1499 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1500 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1501 /* Line-in jack as Line in */
1502 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1503 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1504 /* Line-Out as Front */
1505 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1512 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1513 /* Mic-in jack as mic in */
1514 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1515 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1516 /* Line-in jack as Surround */
1517 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1518 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1519 /* Line-Out as Front */
1520 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1527 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1528 /* Mic-in jack as CLFE */
1529 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1530 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1531 /* Line-in jack as Surround */
1532 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1533 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1534 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1535 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1542 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1543 /* Mic-in jack as CLFE */
1544 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1545 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1546 /* Line-in jack as Surround */
1547 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1548 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1549 /* Line-Out as Side */
1550 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1554 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1555 { 2, alc888_4ST_ch2_intel_init },
1556 { 4, alc888_4ST_ch4_intel_init },
1557 { 6, alc888_4ST_ch6_intel_init },
1558 { 8, alc888_4ST_ch8_intel_init },
1562 * ALC888 Fujitsu Siemens Amillo xa3530
1565 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1566 /* Front Mic: set to PIN_IN (empty by default) */
1567 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1568 /* Connect Internal HP to Front */
1569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1570 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1571 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1572 /* Connect Bass HP to Front */
1573 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1575 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1576 /* Connect Line-Out side jack (SPDIF) to Side */
1577 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1578 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1579 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1580 /* Connect Mic jack to CLFE */
1581 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1582 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1583 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1584 /* Connect Line-in jack to Surround */
1585 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1586 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1587 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1588 /* Connect HP out jack to Front */
1589 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1590 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1591 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1592 /* Enable unsolicited event for HP jack and Line-out jack */
1593 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1594 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1598 static void alc_automute_amp(struct hda_codec *codec)
1600 struct alc_spec *spec = codec->spec;
1605 spec->jack_present = 0;
1606 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1607 nid = spec->autocfg.hp_pins[i];
1610 if (snd_hda_jack_detect(codec, nid)) {
1611 spec->jack_present = 1;
1616 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1617 /* Toggle internal speakers muting */
1618 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1619 nid = spec->autocfg.speaker_pins[i];
1622 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1623 HDA_AMP_MUTE, mute);
1627 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1630 if (codec->vendor_id == 0x10ec0880)
1634 if (res == ALC880_HP_EVENT)
1635 alc_automute_amp(codec);
1638 static void alc889_automute_setup(struct hda_codec *codec)
1640 struct alc_spec *spec = codec->spec;
1642 spec->autocfg.hp_pins[0] = 0x15;
1643 spec->autocfg.speaker_pins[0] = 0x14;
1644 spec->autocfg.speaker_pins[1] = 0x16;
1645 spec->autocfg.speaker_pins[2] = 0x17;
1646 spec->autocfg.speaker_pins[3] = 0x19;
1647 spec->autocfg.speaker_pins[4] = 0x1a;
1650 static void alc889_intel_init_hook(struct hda_codec *codec)
1652 alc889_coef_init(codec);
1653 alc_automute_amp(codec);
1656 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1658 struct alc_spec *spec = codec->spec;
1660 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1661 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1662 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1663 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1667 * ALC888 Acer Aspire 4930G model
1670 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1671 /* Front Mic: set to PIN_IN (empty by default) */
1672 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1673 /* Unselect Front Mic by default in input mixer 3 */
1674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1675 /* Enable unsolicited event for HP jack */
1676 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1677 /* Connect Internal HP to front */
1678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1679 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1680 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1681 /* Connect HP out to front */
1682 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1684 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1689 * ALC888 Acer Aspire 6530G model
1692 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1693 /* Bias voltage on for external mic port */
1694 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1695 /* Front Mic: set to PIN_IN (empty by default) */
1696 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1697 /* Unselect Front Mic by default in input mixer 3 */
1698 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1699 /* Enable unsolicited event for HP jack */
1700 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1701 /* Enable speaker output */
1702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1703 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1704 /* Enable headphone output */
1705 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1707 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1712 * ALC889 Acer Aspire 8930G model
1715 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1716 /* Front Mic: set to PIN_IN (empty by default) */
1717 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1718 /* Unselect Front Mic by default in input mixer 3 */
1719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1720 /* Enable unsolicited event for HP jack */
1721 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1722 /* Connect Internal Front to Front */
1723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1724 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1725 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1726 /* Connect Internal Rear to Rear */
1727 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1728 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1729 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1730 /* Connect Internal CLFE to CLFE */
1731 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1732 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1733 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1734 /* Connect HP out to Front */
1735 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1737 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1738 /* Enable all DACs */
1739 /* DAC DISABLE/MUTE 1? */
1740 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1741 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1742 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1743 /* DAC DISABLE/MUTE 2? */
1744 /* some bit here disables the other DACs. Init=0x4900 */
1745 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1746 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1748 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1749 * which makes the stereo useless. However, either the mic or the ALC889
1750 * makes the signal become a difference/sum signal instead of standard
1751 * stereo, which is annoying. So instead we flip this bit which makes the
1752 * codec replicate the sum signal to both channels, turning it into a
1755 /* DMIC_CONTROL? Init value = 0x0001 */
1756 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1757 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1761 static struct hda_input_mux alc888_2_capture_sources[2] = {
1762 /* Front mic only available on one ADC */
1769 { "Front Mic", 0xb },
1782 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1783 /* Interal mic only available on one ADC */
1790 { "Input Mix", 0xa },
1800 { "Input Mix", 0xa },
1805 static struct hda_input_mux alc889_capture_sources[3] = {
1806 /* Digital mic only available on first "ADC" */
1813 { "Front Mic", 0xb },
1814 { "Input Mix", 0xa },
1823 { "Input Mix", 0xa },
1832 { "Input Mix", 0xa },
1837 static struct snd_kcontrol_new alc888_base_mixer[] = {
1838 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1839 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1840 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1841 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1842 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1844 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1845 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1846 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1847 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1848 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1849 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1850 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1851 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1852 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1853 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1854 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1855 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1859 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1860 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1861 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1862 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1863 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1864 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1866 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1867 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1868 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1869 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1870 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1872 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1873 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1878 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1880 struct alc_spec *spec = codec->spec;
1882 spec->autocfg.hp_pins[0] = 0x15;
1883 spec->autocfg.speaker_pins[0] = 0x14;
1884 spec->autocfg.speaker_pins[1] = 0x16;
1885 spec->autocfg.speaker_pins[2] = 0x17;
1888 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1890 struct alc_spec *spec = codec->spec;
1892 spec->autocfg.hp_pins[0] = 0x15;
1893 spec->autocfg.speaker_pins[0] = 0x14;
1894 spec->autocfg.speaker_pins[1] = 0x16;
1895 spec->autocfg.speaker_pins[2] = 0x17;
1898 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1900 struct alc_spec *spec = codec->spec;
1902 spec->autocfg.hp_pins[0] = 0x15;
1903 spec->autocfg.speaker_pins[0] = 0x14;
1904 spec->autocfg.speaker_pins[1] = 0x16;
1905 spec->autocfg.speaker_pins[2] = 0x1b;
1909 * ALC880 3-stack model
1911 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1912 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1913 * F-Mic = 0x1b, HP = 0x19
1916 static hda_nid_t alc880_dac_nids[4] = {
1917 /* front, rear, clfe, rear_surr */
1918 0x02, 0x05, 0x04, 0x03
1921 static hda_nid_t alc880_adc_nids[3] = {
1926 /* The datasheet says the node 0x07 is connected from inputs,
1927 * but it shows zero connection in the real implementation on some devices.
1928 * Note: this is a 915GAV bug, fixed on 915GLV
1930 static hda_nid_t alc880_adc_nids_alt[2] = {
1935 #define ALC880_DIGOUT_NID 0x06
1936 #define ALC880_DIGIN_NID 0x0a
1938 static struct hda_input_mux alc880_capture_source = {
1942 { "Front Mic", 0x3 },
1948 /* channel source setting (2/6 channel selection for 3-stack) */
1950 static struct hda_verb alc880_threestack_ch2_init[] = {
1951 /* set line-in to input, mute it */
1952 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1953 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1954 /* set mic-in to input vref 80%, mute it */
1955 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1956 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1961 static struct hda_verb alc880_threestack_ch6_init[] = {
1962 /* set line-in to output, unmute it */
1963 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1964 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1965 /* set mic-in to output, unmute it */
1966 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1967 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1971 static struct hda_channel_mode alc880_threestack_modes[2] = {
1972 { 2, alc880_threestack_ch2_init },
1973 { 6, alc880_threestack_ch6_init },
1976 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1977 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1978 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1979 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1980 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1981 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1982 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1983 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1984 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1985 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1986 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1988 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1991 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1992 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1993 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1996 .name = "Channel Mode",
1997 .info = alc_ch_mode_info,
1998 .get = alc_ch_mode_get,
1999 .put = alc_ch_mode_put,
2004 /* capture mixer elements */
2005 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2006 struct snd_ctl_elem_info *uinfo)
2008 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2009 struct alc_spec *spec = codec->spec;
2012 mutex_lock(&codec->control_mutex);
2013 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2015 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2016 mutex_unlock(&codec->control_mutex);
2020 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2021 unsigned int size, unsigned int __user *tlv)
2023 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2024 struct alc_spec *spec = codec->spec;
2027 mutex_lock(&codec->control_mutex);
2028 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2030 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2031 mutex_unlock(&codec->control_mutex);
2035 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2036 struct snd_ctl_elem_value *ucontrol);
2038 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2039 struct snd_ctl_elem_value *ucontrol,
2042 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2043 struct alc_spec *spec = codec->spec;
2044 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2047 mutex_lock(&codec->control_mutex);
2048 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2050 err = func(kcontrol, ucontrol);
2051 mutex_unlock(&codec->control_mutex);
2055 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2056 struct snd_ctl_elem_value *ucontrol)
2058 return alc_cap_getput_caller(kcontrol, ucontrol,
2059 snd_hda_mixer_amp_volume_get);
2062 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2063 struct snd_ctl_elem_value *ucontrol)
2065 return alc_cap_getput_caller(kcontrol, ucontrol,
2066 snd_hda_mixer_amp_volume_put);
2069 /* capture mixer elements */
2070 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2072 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2073 struct snd_ctl_elem_value *ucontrol)
2075 return alc_cap_getput_caller(kcontrol, ucontrol,
2076 snd_hda_mixer_amp_switch_get);
2079 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2080 struct snd_ctl_elem_value *ucontrol)
2082 return alc_cap_getput_caller(kcontrol, ucontrol,
2083 snd_hda_mixer_amp_switch_put);
2086 #define _DEFINE_CAPMIX(num) \
2088 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2089 .name = "Capture Switch", \
2090 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2092 .info = alc_cap_sw_info, \
2093 .get = alc_cap_sw_get, \
2094 .put = alc_cap_sw_put, \
2097 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2098 .name = "Capture Volume", \
2099 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2100 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2101 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2103 .info = alc_cap_vol_info, \
2104 .get = alc_cap_vol_get, \
2105 .put = alc_cap_vol_put, \
2106 .tlv = { .c = alc_cap_vol_tlv }, \
2109 #define _DEFINE_CAPSRC(num) \
2111 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2112 /* .name = "Capture Source", */ \
2113 .name = "Input Source", \
2115 .info = alc_mux_enum_info, \
2116 .get = alc_mux_enum_get, \
2117 .put = alc_mux_enum_put, \
2120 #define DEFINE_CAPMIX(num) \
2121 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2122 _DEFINE_CAPMIX(num), \
2123 _DEFINE_CAPSRC(num), \
2127 #define DEFINE_CAPMIX_NOSRC(num) \
2128 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2129 _DEFINE_CAPMIX(num), \
2133 /* up to three ADCs */
2137 DEFINE_CAPMIX_NOSRC(1);
2138 DEFINE_CAPMIX_NOSRC(2);
2139 DEFINE_CAPMIX_NOSRC(3);
2142 * ALC880 5-stack model
2144 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2146 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2147 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2150 /* additional mixers to alc880_three_stack_mixer */
2151 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2152 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2153 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2157 /* channel source setting (6/8 channel selection for 5-stack) */
2159 static struct hda_verb alc880_fivestack_ch6_init[] = {
2160 /* set line-in to input, mute it */
2161 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2162 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2167 static struct hda_verb alc880_fivestack_ch8_init[] = {
2168 /* set line-in to output, unmute it */
2169 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2170 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2174 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2175 { 6, alc880_fivestack_ch6_init },
2176 { 8, alc880_fivestack_ch8_init },
2181 * ALC880 6-stack model
2183 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2184 * Side = 0x05 (0x0f)
2185 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2186 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2189 static hda_nid_t alc880_6st_dac_nids[4] = {
2190 /* front, rear, clfe, rear_surr */
2191 0x02, 0x03, 0x04, 0x05
2194 static struct hda_input_mux alc880_6stack_capture_source = {
2198 { "Front Mic", 0x1 },
2204 /* fixed 8-channels */
2205 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2209 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2210 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2211 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2212 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2213 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2214 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2215 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2216 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2217 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2218 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2219 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2220 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2221 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2222 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2223 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2224 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2226 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2227 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2229 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2230 .name = "Channel Mode",
2231 .info = alc_ch_mode_info,
2232 .get = alc_ch_mode_get,
2233 .put = alc_ch_mode_put,
2242 * W810 has rear IO for:
2245 * Center/LFE (DAC 04)
2248 * The system also has a pair of internal speakers, and a headphone jack.
2249 * These are both connected to Line2 on the codec, hence to DAC 02.
2251 * There is a variable resistor to control the speaker or headphone
2252 * volume. This is a hardware-only device without a software API.
2254 * Plugging headphones in will disable the internal speakers. This is
2255 * implemented in hardware, not via the driver using jack sense. In
2256 * a similar fashion, plugging into the rear socket marked "front" will
2257 * disable both the speakers and headphones.
2259 * For input, there's a microphone jack, and an "audio in" jack.
2260 * These may not do anything useful with this driver yet, because I
2261 * haven't setup any initialization verbs for these yet...
2264 static hda_nid_t alc880_w810_dac_nids[3] = {
2265 /* front, rear/surround, clfe */
2269 /* fixed 6 channels */
2270 static struct hda_channel_mode alc880_w810_modes[1] = {
2274 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2275 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2276 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2277 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2278 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2279 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2280 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2281 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2282 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2283 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2284 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2292 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2293 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2297 static hda_nid_t alc880_z71v_dac_nids[1] = {
2300 #define ALC880_Z71V_HP_DAC 0x03
2302 /* fixed 2 channels */
2303 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2307 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2308 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2309 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2310 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2311 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2321 * ALC880 F1734 model
2323 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2324 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2327 static hda_nid_t alc880_f1734_dac_nids[1] = {
2330 #define ALC880_F1734_HP_DAC 0x02
2332 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2333 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2334 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2335 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2336 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 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("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2340 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2344 static struct hda_input_mux alc880_f1734_capture_source = {
2356 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2357 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2358 * Mic = 0x18, Line = 0x1a
2361 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2362 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2364 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2365 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2366 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2367 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2368 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2369 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2370 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2371 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2372 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2373 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2374 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2375 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2376 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2377 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2378 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2380 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2381 .name = "Channel Mode",
2382 .info = alc_ch_mode_info,
2383 .get = alc_ch_mode_get,
2384 .put = alc_ch_mode_put,
2390 * ALC880 ASUS W1V model
2392 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2393 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2394 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2397 /* additional mixers to alc880_asus_mixer */
2398 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2399 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2400 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2405 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2406 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2407 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2408 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2409 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2410 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2411 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2412 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2413 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2414 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2419 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2420 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2421 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2422 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2423 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2424 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2425 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2426 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2427 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2428 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2429 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2430 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2431 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2433 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2434 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2437 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2438 .name = "Channel Mode",
2439 .info = alc_ch_mode_info,
2440 .get = alc_ch_mode_get,
2441 .put = alc_ch_mode_put,
2446 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2447 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2448 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2449 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2450 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2451 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2452 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2453 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2454 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2455 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2456 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2460 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2461 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2462 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2463 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2464 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2471 * virtual master controls
2475 * slave controls for virtual master
2477 static const char *alc_slave_vols[] = {
2478 "Front Playback Volume",
2479 "Surround Playback Volume",
2480 "Center Playback Volume",
2481 "LFE Playback Volume",
2482 "Side Playback Volume",
2483 "Headphone Playback Volume",
2484 "Speaker Playback Volume",
2485 "Mono Playback Volume",
2486 "Line-Out Playback Volume",
2487 "PCM Playback Volume",
2491 static const char *alc_slave_sws[] = {
2492 "Front Playback Switch",
2493 "Surround Playback Switch",
2494 "Center Playback Switch",
2495 "LFE Playback Switch",
2496 "Side Playback Switch",
2497 "Headphone Playback Switch",
2498 "Speaker Playback Switch",
2499 "Mono Playback Switch",
2500 "IEC958 Playback Switch",
2501 "Line-Out Playback Switch",
2502 "PCM Playback Switch",
2507 * build control elements
2510 #define NID_MAPPING (-1)
2512 #define SUBDEV_SPEAKER_ (0 << 6)
2513 #define SUBDEV_HP_ (1 << 6)
2514 #define SUBDEV_LINE_ (2 << 6)
2515 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2516 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2517 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2519 static void alc_free_kctls(struct hda_codec *codec);
2521 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2522 /* additional beep mixers; the actual parameters are overwritten at build */
2523 static struct snd_kcontrol_new alc_beep_mixer[] = {
2524 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2525 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2530 static int alc_build_controls(struct hda_codec *codec)
2532 struct alc_spec *spec = codec->spec;
2533 struct snd_kcontrol *kctl;
2534 struct snd_kcontrol_new *knew;
2539 for (i = 0; i < spec->num_mixers; i++) {
2540 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2544 if (spec->cap_mixer) {
2545 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2549 if (spec->multiout.dig_out_nid) {
2550 err = snd_hda_create_spdif_out_ctls(codec,
2551 spec->multiout.dig_out_nid);
2554 if (!spec->no_analog) {
2555 err = snd_hda_create_spdif_share_sw(codec,
2559 spec->multiout.share_spdif = 1;
2562 if (spec->dig_in_nid) {
2563 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2568 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2569 /* create beep controls if needed */
2570 if (spec->beep_amp) {
2571 struct snd_kcontrol_new *knew;
2572 for (knew = alc_beep_mixer; knew->name; knew++) {
2573 struct snd_kcontrol *kctl;
2574 kctl = snd_ctl_new1(knew, codec);
2577 kctl->private_value = spec->beep_amp;
2578 err = snd_hda_ctl_add(codec, 0, kctl);
2585 /* if we have no master control, let's create it */
2586 if (!spec->no_analog &&
2587 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2588 unsigned int vmaster_tlv[4];
2589 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2590 HDA_OUTPUT, vmaster_tlv);
2591 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2592 vmaster_tlv, alc_slave_vols);
2596 if (!spec->no_analog &&
2597 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2598 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2599 NULL, alc_slave_sws);
2604 /* assign Capture Source enums to NID */
2605 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2607 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2608 for (i = 0; kctl && i < kctl->count; i++) {
2609 hda_nid_t *nids = spec->capsrc_nids;
2611 nids = spec->adc_nids;
2612 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2616 if (spec->cap_mixer) {
2617 const char *kname = kctl ? kctl->id.name : NULL;
2618 for (knew = spec->cap_mixer; knew->name; knew++) {
2619 if (kname && strcmp(knew->name, kname) == 0)
2621 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2622 for (i = 0; kctl && i < kctl->count; i++) {
2623 err = snd_hda_add_nid(codec, kctl, i,
2631 /* other nid->control mapping */
2632 for (i = 0; i < spec->num_mixers; i++) {
2633 for (knew = spec->mixers[i]; knew->name; knew++) {
2634 if (knew->iface != NID_MAPPING)
2636 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2639 u = knew->subdevice;
2640 for (j = 0; j < 4; j++, u >>= 8) {
2645 case SUBDEV_SPEAKER_:
2646 nid = spec->autocfg.speaker_pins[nid];
2649 nid = spec->autocfg.line_out_pins[nid];
2652 nid = spec->autocfg.hp_pins[nid];
2657 err = snd_hda_add_nid(codec, kctl, 0, nid);
2661 u = knew->private_value;
2662 for (j = 0; j < 4; j++, u >>= 8) {
2666 err = snd_hda_add_nid(codec, kctl, 0, nid);
2673 alc_free_kctls(codec); /* no longer needed */
2680 * initialize the codec volumes, etc
2684 * generic initialization of ADC, input mixers and output mixers
2686 static struct hda_verb alc880_volume_init_verbs[] = {
2688 * Unmute ADC0-2 and set the default input to mic-in
2690 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2692 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2693 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2694 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2695 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2697 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2699 * Note: PASD motherboards uses the Line In 2 as the input for front
2702 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2705 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2706 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2707 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2712 * Set up output mixers (0x0c - 0x0f)
2714 /* set vol=0 to output mixers */
2715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2716 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2717 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2718 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2719 /* set up input amps for analog loopback */
2720 /* Amp Indices: DAC = 0, mixer = 1 */
2721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2724 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2728 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2734 * 3-stack pin configuration:
2735 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2737 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2739 * preset connection lists of input pins
2740 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2742 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2743 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2744 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2747 * Set pin mode and muting
2749 /* set front pin widgets 0x14 for output */
2750 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2751 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2752 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2753 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2754 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2755 /* Mic2 (as headphone out) for HP output */
2756 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2757 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2758 /* Line In pin widget for input */
2759 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2760 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2761 /* Line2 (as front mic) pin widget for input and vref at 80% */
2762 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2763 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2764 /* CD pin widget for input */
2765 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2771 * 5-stack pin configuration:
2772 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2773 * line-in/side = 0x1a, f-mic = 0x1b
2775 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2777 * preset connection lists of input pins
2778 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2780 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2781 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2784 * Set pin mode and muting
2786 /* set pin widgets 0x14-0x17 for output */
2787 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2789 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2790 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2791 /* unmute pins for output (no gain on this amp) */
2792 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2794 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2795 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2797 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2800 /* Mic2 (as headphone out) for HP output */
2801 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2802 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2803 /* Line In pin widget for input */
2804 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2806 /* Line2 (as front mic) pin widget for input and vref at 80% */
2807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2808 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2809 /* CD pin widget for input */
2810 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2816 * W810 pin configuration:
2817 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2819 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2820 /* hphone/speaker input selector: front DAC */
2821 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2826 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2827 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2828 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2830 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2831 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2837 * Z71V pin configuration:
2838 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2840 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2842 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2843 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2844 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2846 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2847 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2848 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2849 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2855 * 6-stack pin configuration:
2856 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2857 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2859 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2860 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2866 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2867 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2868 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2869 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2871 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2873 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2874 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2875 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2876 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2877 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2878 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2879 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2885 * Uniwill pin configuration:
2886 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2889 static struct hda_verb alc880_uniwill_init_verbs[] = {
2890 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2892 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2893 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2894 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2895 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2896 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2897 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2898 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2899 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2905 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2907 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2908 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2910 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2911 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2913 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2914 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2915 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2917 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2918 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2925 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2927 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2928 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2930 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2931 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2932 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2933 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2934 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2935 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2938 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2939 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2940 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2941 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2943 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2944 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2947 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2948 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2950 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2951 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2956 static struct hda_verb alc880_beep_init_verbs[] = {
2957 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2961 /* auto-toggle front mic */
2962 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2964 unsigned int present;
2967 present = snd_hda_jack_detect(codec, 0x18);
2968 bits = present ? HDA_AMP_MUTE : 0;
2969 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2972 static void alc880_uniwill_setup(struct hda_codec *codec)
2974 struct alc_spec *spec = codec->spec;
2976 spec->autocfg.hp_pins[0] = 0x14;
2977 spec->autocfg.speaker_pins[0] = 0x15;
2978 spec->autocfg.speaker_pins[0] = 0x16;
2981 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2983 alc_automute_amp(codec);
2984 alc880_uniwill_mic_automute(codec);
2987 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2990 /* Looks like the unsol event is incompatible with the standard
2991 * definition. 4bit tag is placed at 28 bit!
2993 switch (res >> 28) {
2994 case ALC880_MIC_EVENT:
2995 alc880_uniwill_mic_automute(codec);
2998 alc_automute_amp_unsol_event(codec, res);
3003 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3005 struct alc_spec *spec = codec->spec;
3007 spec->autocfg.hp_pins[0] = 0x14;
3008 spec->autocfg.speaker_pins[0] = 0x15;
3011 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3013 unsigned int present;
3015 present = snd_hda_codec_read(codec, 0x21, 0,
3016 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3017 present &= HDA_AMP_VOLMASK;
3018 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3019 HDA_AMP_VOLMASK, present);
3020 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3021 HDA_AMP_VOLMASK, present);
3024 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3027 /* Looks like the unsol event is incompatible with the standard
3028 * definition. 4bit tag is placed at 28 bit!
3030 if ((res >> 28) == ALC880_DCVOL_EVENT)
3031 alc880_uniwill_p53_dcvol_automute(codec);
3033 alc_automute_amp_unsol_event(codec, res);
3037 * F1734 pin configuration:
3038 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3040 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3041 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3042 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3043 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3044 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3045 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3047 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3049 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3052 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3053 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3054 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3055 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3056 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3057 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3058 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3059 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3060 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3062 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3063 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3069 * ASUS pin configuration:
3070 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3072 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3073 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3074 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3075 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3076 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3078 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3079 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3081 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3082 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3083 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3084 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3085 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3087 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3088 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3089 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3090 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3091 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3092 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3093 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3094 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3095 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3100 /* Enable GPIO mask and set output */
3101 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3102 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3103 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3105 /* Clevo m520g init */
3106 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3107 /* headphone output */
3108 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3110 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3111 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3113 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3114 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3116 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3117 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3118 /* Mic1 (rear panel) */
3119 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3120 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3121 /* Mic2 (front panel) */
3122 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3123 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3125 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3127 /* change to EAPD mode */
3128 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3129 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3134 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3135 /* change to EAPD mode */
3136 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3137 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3139 /* Headphone output */
3140 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3142 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3143 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3145 /* Line In pin widget for input */
3146 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3147 /* CD pin widget for input */
3148 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3149 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3150 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3152 /* change to EAPD mode */
3153 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3154 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3160 * LG m1 express dual
3163 * Rear Line-In/Out (blue): 0x14
3164 * Build-in Mic-In: 0x15
3166 * HP-Out (green): 0x1b
3167 * Mic-In/Out (red): 0x19
3171 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3172 static hda_nid_t alc880_lg_dac_nids[3] = {
3176 /* seems analog CD is not working */
3177 static struct hda_input_mux alc880_lg_capture_source = {
3182 { "Internal Mic", 0x6 },
3186 /* 2,4,6 channel modes */
3187 static struct hda_verb alc880_lg_ch2_init[] = {
3188 /* set line-in and mic-in to input */
3189 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3190 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3194 static struct hda_verb alc880_lg_ch4_init[] = {
3195 /* set line-in to out and mic-in to input */
3196 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3197 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3201 static struct hda_verb alc880_lg_ch6_init[] = {
3202 /* set line-in and mic-in to output */
3203 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3204 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3208 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3209 { 2, alc880_lg_ch2_init },
3210 { 4, alc880_lg_ch4_init },
3211 { 6, alc880_lg_ch6_init },
3214 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3216 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3217 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3218 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3219 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3220 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3221 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3222 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3225 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3226 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3227 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3228 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3230 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3231 .name = "Channel Mode",
3232 .info = alc_ch_mode_info,
3233 .get = alc_ch_mode_get,
3234 .put = alc_ch_mode_put,
3239 static struct hda_verb alc880_lg_init_verbs[] = {
3240 /* set capture source to mic-in */
3241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3242 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3243 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3244 /* mute all amp mixer inputs */
3245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3248 /* line-in to input */
3249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3250 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3252 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3255 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3256 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3257 /* mic-in to input */
3258 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3259 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3260 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3263 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3264 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3266 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3270 /* toggle speaker-output according to the hp-jack state */
3271 static void alc880_lg_setup(struct hda_codec *codec)
3273 struct alc_spec *spec = codec->spec;
3275 spec->autocfg.hp_pins[0] = 0x1b;
3276 spec->autocfg.speaker_pins[0] = 0x17;
3285 * Built-in Mic-In: 0x19
3291 static struct hda_input_mux alc880_lg_lw_capture_source = {
3295 { "Internal Mic", 0x1 },
3300 #define alc880_lg_lw_modes alc880_threestack_modes
3302 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3303 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3304 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3305 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3306 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3307 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3308 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3309 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3310 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3311 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3312 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3314 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3315 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3316 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3318 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3319 .name = "Channel Mode",
3320 .info = alc_ch_mode_info,
3321 .get = alc_ch_mode_get,
3322 .put = alc_ch_mode_put,
3327 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3328 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3329 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3330 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3332 /* set capture source to mic-in */
3333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3335 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3339 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3341 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3342 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3343 /* mic-in to input */
3344 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3345 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3347 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3348 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3350 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3354 /* toggle speaker-output according to the hp-jack state */
3355 static void alc880_lg_lw_setup(struct hda_codec *codec)
3357 struct alc_spec *spec = codec->spec;
3359 spec->autocfg.hp_pins[0] = 0x1b;
3360 spec->autocfg.speaker_pins[0] = 0x14;
3363 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3364 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3365 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3367 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3368 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3369 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3373 static struct hda_input_mux alc880_medion_rim_capture_source = {
3377 { "Internal Mic", 0x1 },
3381 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3382 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3384 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3385 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3387 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3388 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3389 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3390 /* Mic2 (as headphone out) for HP output */
3391 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3392 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3393 /* Internal Speaker */
3394 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3395 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3397 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3398 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3400 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3404 /* toggle speaker-output according to the hp-jack state */
3405 static void alc880_medion_rim_automute(struct hda_codec *codec)
3407 struct alc_spec *spec = codec->spec;
3408 alc_automute_amp(codec);
3410 if (spec->jack_present)
3411 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3413 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3416 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3419 /* Looks like the unsol event is incompatible with the standard
3420 * definition. 4bit tag is placed at 28 bit!
3422 if ((res >> 28) == ALC880_HP_EVENT)
3423 alc880_medion_rim_automute(codec);
3426 static void alc880_medion_rim_setup(struct hda_codec *codec)
3428 struct alc_spec *spec = codec->spec;
3430 spec->autocfg.hp_pins[0] = 0x14;
3431 spec->autocfg.speaker_pins[0] = 0x1b;
3434 #ifdef CONFIG_SND_HDA_POWER_SAVE
3435 static struct hda_amp_list alc880_loopbacks[] = {
3436 { 0x0b, HDA_INPUT, 0 },
3437 { 0x0b, HDA_INPUT, 1 },
3438 { 0x0b, HDA_INPUT, 2 },
3439 { 0x0b, HDA_INPUT, 3 },
3440 { 0x0b, HDA_INPUT, 4 },
3444 static struct hda_amp_list alc880_lg_loopbacks[] = {
3445 { 0x0b, HDA_INPUT, 1 },
3446 { 0x0b, HDA_INPUT, 6 },
3447 { 0x0b, HDA_INPUT, 7 },
3456 static int alc_init(struct hda_codec *codec)
3458 struct alc_spec *spec = codec->spec;
3462 alc_auto_init_amp(codec, spec->init_amp);
3464 for (i = 0; i < spec->num_init_verbs; i++)
3465 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3467 if (spec->init_hook)
3468 spec->init_hook(codec);
3473 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3475 struct alc_spec *spec = codec->spec;
3477 if (spec->unsol_event)
3478 spec->unsol_event(codec, res);
3481 #ifdef CONFIG_SND_HDA_POWER_SAVE
3482 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3484 struct alc_spec *spec = codec->spec;
3485 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3490 * Analog playback callbacks
3492 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3493 struct hda_codec *codec,
3494 struct snd_pcm_substream *substream)
3496 struct alc_spec *spec = codec->spec;
3497 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3501 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3502 struct hda_codec *codec,
3503 unsigned int stream_tag,
3504 unsigned int format,
3505 struct snd_pcm_substream *substream)
3507 struct alc_spec *spec = codec->spec;
3508 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3509 stream_tag, format, substream);
3512 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3513 struct hda_codec *codec,
3514 struct snd_pcm_substream *substream)
3516 struct alc_spec *spec = codec->spec;
3517 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3523 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3524 struct hda_codec *codec,
3525 struct snd_pcm_substream *substream)
3527 struct alc_spec *spec = codec->spec;
3528 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3531 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3532 struct hda_codec *codec,
3533 unsigned int stream_tag,
3534 unsigned int format,
3535 struct snd_pcm_substream *substream)
3537 struct alc_spec *spec = codec->spec;
3538 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3539 stream_tag, format, substream);
3542 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3543 struct hda_codec *codec,
3544 struct snd_pcm_substream *substream)
3546 struct alc_spec *spec = codec->spec;
3547 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3550 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3551 struct hda_codec *codec,
3552 struct snd_pcm_substream *substream)
3554 struct alc_spec *spec = codec->spec;
3555 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3561 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3562 struct hda_codec *codec,
3563 unsigned int stream_tag,
3564 unsigned int format,
3565 struct snd_pcm_substream *substream)
3567 struct alc_spec *spec = codec->spec;
3569 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3570 stream_tag, 0, format);
3574 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3575 struct hda_codec *codec,
3576 struct snd_pcm_substream *substream)
3578 struct alc_spec *spec = codec->spec;
3580 snd_hda_codec_cleanup_stream(codec,
3581 spec->adc_nids[substream->number + 1]);
3588 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3592 /* NID is set in alc_build_pcms */
3594 .open = alc880_playback_pcm_open,
3595 .prepare = alc880_playback_pcm_prepare,
3596 .cleanup = alc880_playback_pcm_cleanup
3600 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3604 /* NID is set in alc_build_pcms */
3607 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3611 /* NID is set in alc_build_pcms */
3614 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3615 .substreams = 2, /* can be overridden */
3618 /* NID is set in alc_build_pcms */
3620 .prepare = alc880_alt_capture_pcm_prepare,
3621 .cleanup = alc880_alt_capture_pcm_cleanup
3625 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3629 /* NID is set in alc_build_pcms */
3631 .open = alc880_dig_playback_pcm_open,
3632 .close = alc880_dig_playback_pcm_close,
3633 .prepare = alc880_dig_playback_pcm_prepare,
3634 .cleanup = alc880_dig_playback_pcm_cleanup
3638 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3642 /* NID is set in alc_build_pcms */
3645 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3646 static struct hda_pcm_stream alc_pcm_null_stream = {
3652 static int alc_build_pcms(struct hda_codec *codec)
3654 struct alc_spec *spec = codec->spec;
3655 struct hda_pcm *info = spec->pcm_rec;
3658 codec->num_pcms = 1;
3659 codec->pcm_info = info;
3661 if (spec->no_analog)
3664 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3665 "%s Analog", codec->chip_name);
3666 info->name = spec->stream_name_analog;
3668 if (spec->stream_analog_playback) {
3669 if (snd_BUG_ON(!spec->multiout.dac_nids))
3671 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3672 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3674 if (spec->stream_analog_capture) {
3675 if (snd_BUG_ON(!spec->adc_nids))
3677 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3678 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3681 if (spec->channel_mode) {
3682 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3683 for (i = 0; i < spec->num_channel_mode; i++) {
3684 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3685 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3691 /* SPDIF for stream index #1 */
3692 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3693 snprintf(spec->stream_name_digital,
3694 sizeof(spec->stream_name_digital),
3695 "%s Digital", codec->chip_name);
3696 codec->num_pcms = 2;
3697 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3698 info = spec->pcm_rec + 1;
3699 info->name = spec->stream_name_digital;
3700 if (spec->dig_out_type)
3701 info->pcm_type = spec->dig_out_type;
3703 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3704 if (spec->multiout.dig_out_nid &&
3705 spec->stream_digital_playback) {
3706 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3707 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3709 if (spec->dig_in_nid &&
3710 spec->stream_digital_capture) {
3711 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3712 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3714 /* FIXME: do we need this for all Realtek codec models? */
3715 codec->spdif_status_reset = 1;
3718 if (spec->no_analog)
3721 /* If the use of more than one ADC is requested for the current
3722 * model, configure a second analog capture-only PCM.
3724 /* Additional Analaog capture for index #2 */
3725 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3726 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3727 codec->num_pcms = 3;
3728 info = spec->pcm_rec + 2;
3729 info->name = spec->stream_name_analog;
3730 if (spec->alt_dac_nid) {
3731 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3732 *spec->stream_analog_alt_playback;
3733 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3736 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3737 alc_pcm_null_stream;
3738 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3740 if (spec->num_adc_nids > 1) {
3741 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3742 *spec->stream_analog_alt_capture;
3743 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3745 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3746 spec->num_adc_nids - 1;
3748 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3749 alc_pcm_null_stream;
3750 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3757 static inline void alc_shutup(struct hda_codec *codec)
3759 snd_hda_shutup_pins(codec);
3762 static void alc_free_kctls(struct hda_codec *codec)
3764 struct alc_spec *spec = codec->spec;
3766 if (spec->kctls.list) {
3767 struct snd_kcontrol_new *kctl = spec->kctls.list;
3769 for (i = 0; i < spec->kctls.used; i++)
3770 kfree(kctl[i].name);
3772 snd_array_free(&spec->kctls);
3775 static void alc_free(struct hda_codec *codec)
3777 struct alc_spec *spec = codec->spec;
3783 alc_free_kctls(codec);
3785 snd_hda_detach_beep_device(codec);
3788 #ifdef CONFIG_SND_HDA_POWER_SAVE
3789 static void alc_power_eapd(struct hda_codec *codec)
3791 /* We currently only handle front, HP */
3792 switch (codec->vendor_id) {
3794 set_eapd(codec, 0x0f, 0);
3795 set_eapd(codec, 0x10, 0);
3808 set_eapd(codec, 0x14, 0);
3809 set_eapd(codec, 0x15, 0);
3814 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3816 struct alc_spec *spec = codec->spec;
3818 if (spec && spec->power_hook)
3819 spec->power_hook(codec);
3824 #ifdef SND_HDA_NEEDS_RESUME
3825 static int alc_resume(struct hda_codec *codec)
3827 codec->patch_ops.init(codec);
3828 snd_hda_codec_resume_amp(codec);
3829 snd_hda_codec_resume_cache(codec);
3836 static struct hda_codec_ops alc_patch_ops = {
3837 .build_controls = alc_build_controls,
3838 .build_pcms = alc_build_pcms,
3841 .unsol_event = alc_unsol_event,
3842 #ifdef SND_HDA_NEEDS_RESUME
3843 .resume = alc_resume,
3845 #ifdef CONFIG_SND_HDA_POWER_SAVE
3846 .suspend = alc_suspend,
3847 .check_power_status = alc_check_power_status,
3849 .reboot_notify = alc_shutup,
3852 /* replace the codec chip_name with the given string */
3853 static int alc_codec_rename(struct hda_codec *codec, const char *name)
3855 kfree(codec->chip_name);
3856 codec->chip_name = kstrdup(name, GFP_KERNEL);
3857 if (!codec->chip_name) {
3865 * Test configuration for debugging
3867 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3870 #ifdef CONFIG_SND_DEBUG
3871 static hda_nid_t alc880_test_dac_nids[4] = {
3872 0x02, 0x03, 0x04, 0x05
3875 static struct hda_input_mux alc880_test_capture_source = {
3884 { "Surround", 0x6 },
3888 static struct hda_channel_mode alc880_test_modes[4] = {
3895 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3896 struct snd_ctl_elem_info *uinfo)
3898 static char *texts[] = {
3899 "N/A", "Line Out", "HP Out",
3900 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3902 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3904 uinfo->value.enumerated.items = 8;
3905 if (uinfo->value.enumerated.item >= 8)
3906 uinfo->value.enumerated.item = 7;
3907 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3911 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3912 struct snd_ctl_elem_value *ucontrol)
3914 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3915 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3916 unsigned int pin_ctl, item = 0;
3918 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3919 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3920 if (pin_ctl & AC_PINCTL_OUT_EN) {
3921 if (pin_ctl & AC_PINCTL_HP_EN)
3925 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3926 switch (pin_ctl & AC_PINCTL_VREFEN) {
3927 case AC_PINCTL_VREF_HIZ: item = 3; break;
3928 case AC_PINCTL_VREF_50: item = 4; break;
3929 case AC_PINCTL_VREF_GRD: item = 5; break;
3930 case AC_PINCTL_VREF_80: item = 6; break;
3931 case AC_PINCTL_VREF_100: item = 7; break;
3934 ucontrol->value.enumerated.item[0] = item;
3938 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3939 struct snd_ctl_elem_value *ucontrol)
3941 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3942 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3943 static unsigned int ctls[] = {
3944 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3945 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3946 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3947 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3948 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3949 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3951 unsigned int old_ctl, new_ctl;
3953 old_ctl = snd_hda_codec_read(codec, nid, 0,
3954 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3955 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3956 if (old_ctl != new_ctl) {
3958 snd_hda_codec_write_cache(codec, nid, 0,
3959 AC_VERB_SET_PIN_WIDGET_CONTROL,
3961 val = ucontrol->value.enumerated.item[0] >= 3 ?
3963 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3970 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3971 struct snd_ctl_elem_info *uinfo)
3973 static char *texts[] = {
3974 "Front", "Surround", "CLFE", "Side"
3976 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3978 uinfo->value.enumerated.items = 4;
3979 if (uinfo->value.enumerated.item >= 4)
3980 uinfo->value.enumerated.item = 3;
3981 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3985 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3986 struct snd_ctl_elem_value *ucontrol)
3988 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3989 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3992 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3993 ucontrol->value.enumerated.item[0] = sel & 3;
3997 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3998 struct snd_ctl_elem_value *ucontrol)
4000 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4001 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4004 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4005 if (ucontrol->value.enumerated.item[0] != sel) {
4006 sel = ucontrol->value.enumerated.item[0] & 3;
4007 snd_hda_codec_write_cache(codec, nid, 0,
4008 AC_VERB_SET_CONNECT_SEL, sel);
4014 #define PIN_CTL_TEST(xname,nid) { \
4015 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4017 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4018 .info = alc_test_pin_ctl_info, \
4019 .get = alc_test_pin_ctl_get, \
4020 .put = alc_test_pin_ctl_put, \
4021 .private_value = nid \
4024 #define PIN_SRC_TEST(xname,nid) { \
4025 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4027 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4028 .info = alc_test_pin_src_info, \
4029 .get = alc_test_pin_src_get, \
4030 .put = alc_test_pin_src_put, \
4031 .private_value = nid \
4034 static struct snd_kcontrol_new alc880_test_mixer[] = {
4035 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4036 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4037 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4038 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4039 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4040 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4041 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4042 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4043 PIN_CTL_TEST("Front Pin Mode", 0x14),
4044 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4045 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4046 PIN_CTL_TEST("Side Pin Mode", 0x17),
4047 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4048 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4049 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4050 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4051 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4052 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4053 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4054 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4055 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4056 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4057 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4058 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4059 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4060 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4061 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4062 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4063 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4064 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4066 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4067 .name = "Channel Mode",
4068 .info = alc_ch_mode_info,
4069 .get = alc_ch_mode_get,
4070 .put = alc_ch_mode_put,
4075 static struct hda_verb alc880_test_init_verbs[] = {
4076 /* Unmute inputs of 0x0c - 0x0f */
4077 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4078 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4080 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4082 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4085 /* Vol output for 0x0c-0x0f */
4086 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4088 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4089 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4090 /* Set output pins 0x14-0x17 */
4091 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4092 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4093 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4094 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4095 /* Unmute output pins 0x14-0x17 */
4096 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4097 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4098 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4099 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4100 /* Set input pins 0x18-0x1c */
4101 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4102 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4103 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4104 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4105 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4106 /* Mute input pins 0x18-0x1b */
4107 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4108 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4109 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4110 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4113 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4115 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4116 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4117 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4118 /* Analog input/passthru */
4119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4123 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4131 static const char *alc880_models[ALC880_MODEL_LAST] = {
4132 [ALC880_3ST] = "3stack",
4133 [ALC880_TCL_S700] = "tcl",
4134 [ALC880_3ST_DIG] = "3stack-digout",
4135 [ALC880_CLEVO] = "clevo",
4136 [ALC880_5ST] = "5stack",
4137 [ALC880_5ST_DIG] = "5stack-digout",
4138 [ALC880_W810] = "w810",
4139 [ALC880_Z71V] = "z71v",
4140 [ALC880_6ST] = "6stack",
4141 [ALC880_6ST_DIG] = "6stack-digout",
4142 [ALC880_ASUS] = "asus",
4143 [ALC880_ASUS_W1V] = "asus-w1v",
4144 [ALC880_ASUS_DIG] = "asus-dig",
4145 [ALC880_ASUS_DIG2] = "asus-dig2",
4146 [ALC880_UNIWILL_DIG] = "uniwill",
4147 [ALC880_UNIWILL_P53] = "uniwill-p53",
4148 [ALC880_FUJITSU] = "fujitsu",
4149 [ALC880_F1734] = "F1734",
4151 [ALC880_LG_LW] = "lg-lw",
4152 [ALC880_MEDION_RIM] = "medion",
4153 #ifdef CONFIG_SND_DEBUG
4154 [ALC880_TEST] = "test",
4156 [ALC880_AUTO] = "auto",
4159 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4160 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4161 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4162 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4163 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4164 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4165 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4166 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4167 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4168 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4169 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4170 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4171 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4172 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4173 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4174 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4175 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4176 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4177 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4178 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4179 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4180 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4181 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4182 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4183 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4184 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4185 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4186 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4187 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4188 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4189 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4190 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4191 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4192 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4193 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4194 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4195 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4196 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4197 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4198 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4199 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4200 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4201 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4202 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4203 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4204 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4205 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4206 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4207 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4208 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4209 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4210 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4211 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4212 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4213 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4214 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4215 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4216 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4217 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4218 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4219 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4220 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4221 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4222 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4223 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4224 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4225 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4226 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4227 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4229 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4230 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4231 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4236 * ALC880 codec presets
4238 static struct alc_config_preset alc880_presets[] = {
4240 .mixers = { alc880_three_stack_mixer },
4241 .init_verbs = { alc880_volume_init_verbs,
4242 alc880_pin_3stack_init_verbs },
4243 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4244 .dac_nids = alc880_dac_nids,
4245 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4246 .channel_mode = alc880_threestack_modes,
4248 .input_mux = &alc880_capture_source,
4250 [ALC880_3ST_DIG] = {
4251 .mixers = { alc880_three_stack_mixer },
4252 .init_verbs = { alc880_volume_init_verbs,
4253 alc880_pin_3stack_init_verbs },
4254 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4255 .dac_nids = alc880_dac_nids,
4256 .dig_out_nid = ALC880_DIGOUT_NID,
4257 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4258 .channel_mode = alc880_threestack_modes,
4260 .input_mux = &alc880_capture_source,
4262 [ALC880_TCL_S700] = {
4263 .mixers = { alc880_tcl_s700_mixer },
4264 .init_verbs = { alc880_volume_init_verbs,
4265 alc880_pin_tcl_S700_init_verbs,
4266 alc880_gpio2_init_verbs },
4267 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4268 .dac_nids = alc880_dac_nids,
4269 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4270 .num_adc_nids = 1, /* single ADC */
4272 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4273 .channel_mode = alc880_2_jack_modes,
4274 .input_mux = &alc880_capture_source,
4277 .mixers = { alc880_three_stack_mixer,
4278 alc880_five_stack_mixer},
4279 .init_verbs = { alc880_volume_init_verbs,
4280 alc880_pin_5stack_init_verbs },
4281 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4282 .dac_nids = alc880_dac_nids,
4283 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4284 .channel_mode = alc880_fivestack_modes,
4285 .input_mux = &alc880_capture_source,
4287 [ALC880_5ST_DIG] = {
4288 .mixers = { alc880_three_stack_mixer,
4289 alc880_five_stack_mixer },
4290 .init_verbs = { alc880_volume_init_verbs,
4291 alc880_pin_5stack_init_verbs },
4292 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4293 .dac_nids = alc880_dac_nids,
4294 .dig_out_nid = ALC880_DIGOUT_NID,
4295 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4296 .channel_mode = alc880_fivestack_modes,
4297 .input_mux = &alc880_capture_source,
4300 .mixers = { alc880_six_stack_mixer },
4301 .init_verbs = { alc880_volume_init_verbs,
4302 alc880_pin_6stack_init_verbs },
4303 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4304 .dac_nids = alc880_6st_dac_nids,
4305 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4306 .channel_mode = alc880_sixstack_modes,
4307 .input_mux = &alc880_6stack_capture_source,
4309 [ALC880_6ST_DIG] = {
4310 .mixers = { alc880_six_stack_mixer },
4311 .init_verbs = { alc880_volume_init_verbs,
4312 alc880_pin_6stack_init_verbs },
4313 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4314 .dac_nids = alc880_6st_dac_nids,
4315 .dig_out_nid = ALC880_DIGOUT_NID,
4316 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4317 .channel_mode = alc880_sixstack_modes,
4318 .input_mux = &alc880_6stack_capture_source,
4321 .mixers = { alc880_w810_base_mixer },
4322 .init_verbs = { alc880_volume_init_verbs,
4323 alc880_pin_w810_init_verbs,
4324 alc880_gpio2_init_verbs },
4325 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4326 .dac_nids = alc880_w810_dac_nids,
4327 .dig_out_nid = ALC880_DIGOUT_NID,
4328 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4329 .channel_mode = alc880_w810_modes,
4330 .input_mux = &alc880_capture_source,
4333 .mixers = { alc880_z71v_mixer },
4334 .init_verbs = { alc880_volume_init_verbs,
4335 alc880_pin_z71v_init_verbs },
4336 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4337 .dac_nids = alc880_z71v_dac_nids,
4338 .dig_out_nid = ALC880_DIGOUT_NID,
4340 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4341 .channel_mode = alc880_2_jack_modes,
4342 .input_mux = &alc880_capture_source,
4345 .mixers = { alc880_f1734_mixer },
4346 .init_verbs = { alc880_volume_init_verbs,
4347 alc880_pin_f1734_init_verbs },
4348 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4349 .dac_nids = alc880_f1734_dac_nids,
4351 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4352 .channel_mode = alc880_2_jack_modes,
4353 .input_mux = &alc880_f1734_capture_source,
4354 .unsol_event = alc880_uniwill_p53_unsol_event,
4355 .setup = alc880_uniwill_p53_setup,
4356 .init_hook = alc_automute_amp,
4359 .mixers = { alc880_asus_mixer },
4360 .init_verbs = { alc880_volume_init_verbs,
4361 alc880_pin_asus_init_verbs,
4362 alc880_gpio1_init_verbs },
4363 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4364 .dac_nids = alc880_asus_dac_nids,
4365 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4366 .channel_mode = alc880_asus_modes,
4368 .input_mux = &alc880_capture_source,
4370 [ALC880_ASUS_DIG] = {
4371 .mixers = { alc880_asus_mixer },
4372 .init_verbs = { alc880_volume_init_verbs,
4373 alc880_pin_asus_init_verbs,
4374 alc880_gpio1_init_verbs },
4375 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4376 .dac_nids = alc880_asus_dac_nids,
4377 .dig_out_nid = ALC880_DIGOUT_NID,
4378 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4379 .channel_mode = alc880_asus_modes,
4381 .input_mux = &alc880_capture_source,
4383 [ALC880_ASUS_DIG2] = {
4384 .mixers = { alc880_asus_mixer },
4385 .init_verbs = { alc880_volume_init_verbs,
4386 alc880_pin_asus_init_verbs,
4387 alc880_gpio2_init_verbs }, /* use GPIO2 */
4388 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4389 .dac_nids = alc880_asus_dac_nids,
4390 .dig_out_nid = ALC880_DIGOUT_NID,
4391 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4392 .channel_mode = alc880_asus_modes,
4394 .input_mux = &alc880_capture_source,
4396 [ALC880_ASUS_W1V] = {
4397 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4398 .init_verbs = { alc880_volume_init_verbs,
4399 alc880_pin_asus_init_verbs,
4400 alc880_gpio1_init_verbs },
4401 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4402 .dac_nids = alc880_asus_dac_nids,
4403 .dig_out_nid = ALC880_DIGOUT_NID,
4404 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4405 .channel_mode = alc880_asus_modes,
4407 .input_mux = &alc880_capture_source,
4409 [ALC880_UNIWILL_DIG] = {
4410 .mixers = { alc880_asus_mixer },
4411 .init_verbs = { alc880_volume_init_verbs,
4412 alc880_pin_asus_init_verbs },
4413 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4414 .dac_nids = alc880_asus_dac_nids,
4415 .dig_out_nid = ALC880_DIGOUT_NID,
4416 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4417 .channel_mode = alc880_asus_modes,
4419 .input_mux = &alc880_capture_source,
4421 [ALC880_UNIWILL] = {
4422 .mixers = { alc880_uniwill_mixer },
4423 .init_verbs = { alc880_volume_init_verbs,
4424 alc880_uniwill_init_verbs },
4425 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4426 .dac_nids = alc880_asus_dac_nids,
4427 .dig_out_nid = ALC880_DIGOUT_NID,
4428 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4429 .channel_mode = alc880_threestack_modes,
4431 .input_mux = &alc880_capture_source,
4432 .unsol_event = alc880_uniwill_unsol_event,
4433 .setup = alc880_uniwill_setup,
4434 .init_hook = alc880_uniwill_init_hook,
4436 [ALC880_UNIWILL_P53] = {
4437 .mixers = { alc880_uniwill_p53_mixer },
4438 .init_verbs = { alc880_volume_init_verbs,
4439 alc880_uniwill_p53_init_verbs },
4440 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4441 .dac_nids = alc880_asus_dac_nids,
4442 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4443 .channel_mode = alc880_threestack_modes,
4444 .input_mux = &alc880_capture_source,
4445 .unsol_event = alc880_uniwill_p53_unsol_event,
4446 .setup = alc880_uniwill_p53_setup,
4447 .init_hook = alc_automute_amp,
4449 [ALC880_FUJITSU] = {
4450 .mixers = { alc880_fujitsu_mixer },
4451 .init_verbs = { alc880_volume_init_verbs,
4452 alc880_uniwill_p53_init_verbs,
4453 alc880_beep_init_verbs },
4454 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4455 .dac_nids = alc880_dac_nids,
4456 .dig_out_nid = ALC880_DIGOUT_NID,
4457 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4458 .channel_mode = alc880_2_jack_modes,
4459 .input_mux = &alc880_capture_source,
4460 .unsol_event = alc880_uniwill_p53_unsol_event,
4461 .setup = alc880_uniwill_p53_setup,
4462 .init_hook = alc_automute_amp,
4465 .mixers = { alc880_three_stack_mixer },
4466 .init_verbs = { alc880_volume_init_verbs,
4467 alc880_pin_clevo_init_verbs },
4468 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4469 .dac_nids = alc880_dac_nids,
4471 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4472 .channel_mode = alc880_threestack_modes,
4474 .input_mux = &alc880_capture_source,
4477 .mixers = { alc880_lg_mixer },
4478 .init_verbs = { alc880_volume_init_verbs,
4479 alc880_lg_init_verbs },
4480 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4481 .dac_nids = alc880_lg_dac_nids,
4482 .dig_out_nid = ALC880_DIGOUT_NID,
4483 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4484 .channel_mode = alc880_lg_ch_modes,
4486 .input_mux = &alc880_lg_capture_source,
4487 .unsol_event = alc_automute_amp_unsol_event,
4488 .setup = alc880_lg_setup,
4489 .init_hook = alc_automute_amp,
4490 #ifdef CONFIG_SND_HDA_POWER_SAVE
4491 .loopbacks = alc880_lg_loopbacks,
4495 .mixers = { alc880_lg_lw_mixer },
4496 .init_verbs = { alc880_volume_init_verbs,
4497 alc880_lg_lw_init_verbs },
4498 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4499 .dac_nids = alc880_dac_nids,
4500 .dig_out_nid = ALC880_DIGOUT_NID,
4501 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4502 .channel_mode = alc880_lg_lw_modes,
4503 .input_mux = &alc880_lg_lw_capture_source,
4504 .unsol_event = alc_automute_amp_unsol_event,
4505 .setup = alc880_lg_lw_setup,
4506 .init_hook = alc_automute_amp,
4508 [ALC880_MEDION_RIM] = {
4509 .mixers = { alc880_medion_rim_mixer },
4510 .init_verbs = { alc880_volume_init_verbs,
4511 alc880_medion_rim_init_verbs,
4512 alc_gpio2_init_verbs },
4513 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4514 .dac_nids = alc880_dac_nids,
4515 .dig_out_nid = ALC880_DIGOUT_NID,
4516 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4517 .channel_mode = alc880_2_jack_modes,
4518 .input_mux = &alc880_medion_rim_capture_source,
4519 .unsol_event = alc880_medion_rim_unsol_event,
4520 .setup = alc880_medion_rim_setup,
4521 .init_hook = alc880_medion_rim_automute,
4523 #ifdef CONFIG_SND_DEBUG
4525 .mixers = { alc880_test_mixer },
4526 .init_verbs = { alc880_test_init_verbs },
4527 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4528 .dac_nids = alc880_test_dac_nids,
4529 .dig_out_nid = ALC880_DIGOUT_NID,
4530 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4531 .channel_mode = alc880_test_modes,
4532 .input_mux = &alc880_test_capture_source,
4538 * Automatic parse of I/O pins from the BIOS configuration
4543 ALC_CTL_WIDGET_MUTE,
4546 static struct snd_kcontrol_new alc880_control_templates[] = {
4547 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4548 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4549 HDA_BIND_MUTE(NULL, 0, 0, 0),
4552 /* add dynamic controls */
4553 static int add_control(struct alc_spec *spec, int type, const char *name,
4556 struct snd_kcontrol_new *knew;
4558 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4559 knew = snd_array_new(&spec->kctls);
4562 *knew = alc880_control_templates[type];
4563 knew->name = kstrdup(name, GFP_KERNEL);
4566 if (get_amp_nid_(val))
4567 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4568 knew->private_value = val;
4572 static int add_control_with_pfx(struct alc_spec *spec, int type,
4573 const char *pfx, const char *dir,
4574 const char *sfx, unsigned long val)
4577 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4578 return add_control(spec, type, name, val);
4581 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4582 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4583 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4584 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4586 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4587 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4588 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4589 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4590 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4591 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4592 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4593 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4594 #define ALC880_PIN_CD_NID 0x1c
4596 /* fill in the dac_nids table from the parsed pin configuration */
4597 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4598 const struct auto_pin_cfg *cfg)
4604 memset(assigned, 0, sizeof(assigned));
4605 spec->multiout.dac_nids = spec->private_dac_nids;
4607 /* check the pins hardwired to audio widget */
4608 for (i = 0; i < cfg->line_outs; i++) {
4609 nid = cfg->line_out_pins[i];
4610 if (alc880_is_fixed_pin(nid)) {
4611 int idx = alc880_fixed_pin_idx(nid);
4612 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4616 /* left pins can be connect to any audio widget */
4617 for (i = 0; i < cfg->line_outs; i++) {
4618 nid = cfg->line_out_pins[i];
4619 if (alc880_is_fixed_pin(nid))
4621 /* search for an empty channel */
4622 for (j = 0; j < cfg->line_outs; j++) {
4624 spec->multiout.dac_nids[i] =
4625 alc880_idx_to_dac(j);
4631 spec->multiout.num_dacs = cfg->line_outs;
4635 /* add playback controls from the parsed DAC table */
4636 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4637 const struct auto_pin_cfg *cfg)
4639 static const char *chname[4] = {
4640 "Front", "Surround", NULL /*CLFE*/, "Side"
4645 for (i = 0; i < cfg->line_outs; i++) {
4646 if (!spec->multiout.dac_nids[i])
4648 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4651 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4653 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4657 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4659 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4663 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4665 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4669 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4671 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4677 if (cfg->line_outs == 1 &&
4678 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4682 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4683 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4687 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4688 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4697 /* add playback controls for speaker and HP outputs */
4698 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4707 if (alc880_is_fixed_pin(pin)) {
4708 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4709 /* specify the DAC as the extra output */
4710 if (!spec->multiout.hp_nid)
4711 spec->multiout.hp_nid = nid;
4713 spec->multiout.extra_out_nid[0] = nid;
4714 /* control HP volume/switch on the output mixer amp */
4715 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4716 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4717 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4720 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4721 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4724 } else if (alc880_is_multi_pin(pin)) {
4725 /* set manual connection */
4726 /* we have only a switch on HP-out PIN */
4727 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4728 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4735 /* create input playback/capture controls for the given pin */
4736 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4737 const char *ctlname,
4738 int idx, hda_nid_t mix_nid)
4742 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4743 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4746 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4747 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4753 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4755 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4756 return (pincap & AC_PINCAP_IN) != 0;
4759 /* create playback/capture controls for input pins */
4760 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4761 const struct auto_pin_cfg *cfg,
4763 hda_nid_t cap1, hda_nid_t cap2)
4765 struct alc_spec *spec = codec->spec;
4766 struct hda_input_mux *imux = &spec->private_imux[0];
4769 for (i = 0; i < AUTO_PIN_LAST; i++) {
4772 pin = cfg->input_pins[i];
4773 if (!alc_is_input_pin(codec, pin))
4777 idx = get_connection_index(codec, mixer, pin);
4779 err = new_analog_input(spec, pin,
4780 auto_pin_cfg_labels[i],
4789 idx = get_connection_index(codec, cap1, pin);
4790 if (idx < 0 && cap2)
4791 idx = get_connection_index(codec, cap2, pin);
4793 imux->items[imux->num_items].label =
4794 auto_pin_cfg_labels[i];
4795 imux->items[imux->num_items].index = idx;
4802 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4803 const struct auto_pin_cfg *cfg)
4805 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4808 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4809 unsigned int pin_type)
4811 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4814 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4818 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4819 hda_nid_t nid, int pin_type,
4822 alc_set_pin_output(codec, nid, pin_type);
4823 /* need the manual connection? */
4824 if (alc880_is_multi_pin(nid)) {
4825 struct alc_spec *spec = codec->spec;
4826 int idx = alc880_multi_pin_idx(nid);
4827 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4828 AC_VERB_SET_CONNECT_SEL,
4829 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4833 static int get_pin_type(int line_out_type)
4835 if (line_out_type == AUTO_PIN_HP_OUT)
4841 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4843 struct alc_spec *spec = codec->spec;
4846 for (i = 0; i < spec->autocfg.line_outs; i++) {
4847 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4848 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4849 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4853 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4855 struct alc_spec *spec = codec->spec;
4858 pin = spec->autocfg.speaker_pins[0];
4859 if (pin) /* connect to front */
4860 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4861 pin = spec->autocfg.hp_pins[0];
4862 if (pin) /* connect to front */
4863 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4866 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4868 struct alc_spec *spec = codec->spec;
4871 for (i = 0; i < AUTO_PIN_LAST; i++) {
4872 hda_nid_t nid = spec->autocfg.input_pins[i];
4873 if (alc_is_input_pin(codec, nid)) {
4874 alc_set_input_pin(codec, nid, i);
4875 if (nid != ALC880_PIN_CD_NID &&
4876 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4877 snd_hda_codec_write(codec, nid, 0,
4878 AC_VERB_SET_AMP_GAIN_MUTE,
4884 /* parse the BIOS configuration and set up the alc_spec */
4885 /* return 1 if successful, 0 if the proper config is not found,
4886 * or a negative error code
4888 static int alc880_parse_auto_config(struct hda_codec *codec)
4890 struct alc_spec *spec = codec->spec;
4892 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4894 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4898 if (!spec->autocfg.line_outs)
4899 return 0; /* can't find valid BIOS pin config */
4901 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4904 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4907 err = alc880_auto_create_extra_out(spec,
4908 spec->autocfg.speaker_pins[0],
4912 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4916 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4920 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4922 /* check multiple SPDIF-out (for recent codecs) */
4923 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4925 err = snd_hda_get_connections(codec,
4926 spec->autocfg.dig_out_pins[i],
4931 spec->multiout.dig_out_nid = dig_nid;
4933 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4934 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4936 spec->slave_dig_outs[i - 1] = dig_nid;
4939 if (spec->autocfg.dig_in_pin)
4940 spec->dig_in_nid = ALC880_DIGIN_NID;
4942 if (spec->kctls.list)
4943 add_mixer(spec, spec->kctls.list);
4945 add_verb(spec, alc880_volume_init_verbs);
4947 spec->num_mux_defs = 1;
4948 spec->input_mux = &spec->private_imux[0];
4950 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4955 /* additional initialization for auto-configuration model */
4956 static void alc880_auto_init(struct hda_codec *codec)
4958 struct alc_spec *spec = codec->spec;
4959 alc880_auto_init_multi_out(codec);
4960 alc880_auto_init_extra_out(codec);
4961 alc880_auto_init_analog_input(codec);
4962 if (spec->unsol_event)
4963 alc_inithook(codec);
4966 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4967 * one of two digital mic pins, e.g. on ALC272
4969 static void fixup_automic_adc(struct hda_codec *codec)
4971 struct alc_spec *spec = codec->spec;
4974 for (i = 0; i < spec->num_adc_nids; i++) {
4975 hda_nid_t cap = spec->capsrc_nids ?
4976 spec->capsrc_nids[i] : spec->adc_nids[i];
4979 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4982 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4985 spec->int_mic.mux_idx = iidx;
4986 spec->ext_mic.mux_idx = eidx;
4987 if (spec->capsrc_nids)
4988 spec->capsrc_nids += i;
4989 spec->adc_nids += i;
4990 spec->num_adc_nids = 1;
4993 snd_printd(KERN_INFO "hda_codec: %s: "
4994 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4995 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4996 spec->auto_mic = 0; /* disable auto-mic to be sure */
4999 /* choose the ADC/MUX containing the input pin and initialize the setup */
5000 static void fixup_single_adc(struct hda_codec *codec)
5002 struct alc_spec *spec = codec->spec;
5006 /* search for the input pin; there must be only one */
5007 for (i = 0; i < AUTO_PIN_LAST; i++) {
5008 if (spec->autocfg.input_pins[i]) {
5009 pin = spec->autocfg.input_pins[i];
5016 /* set the default connection to that pin */
5017 for (i = 0; i < spec->num_adc_nids; i++) {
5018 hda_nid_t cap = spec->capsrc_nids ?
5019 spec->capsrc_nids[i] : spec->adc_nids[i];
5022 idx = get_connection_index(codec, cap, pin);
5025 /* use only this ADC */
5026 if (spec->capsrc_nids)
5027 spec->capsrc_nids += i;
5028 spec->adc_nids += i;
5029 spec->num_adc_nids = 1;
5030 /* select or unmute this route */
5031 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5032 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5035 snd_hda_codec_write_cache(codec, cap, 0,
5036 AC_VERB_SET_CONNECT_SEL, idx);
5042 static void set_capture_mixer(struct hda_codec *codec)
5044 struct alc_spec *spec = codec->spec;
5045 static struct snd_kcontrol_new *caps[2][3] = {
5046 { alc_capture_mixer_nosrc1,
5047 alc_capture_mixer_nosrc2,
5048 alc_capture_mixer_nosrc3 },
5049 { alc_capture_mixer1,
5051 alc_capture_mixer3 },
5053 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5056 fixup_automic_adc(codec);
5057 else if (spec->input_mux) {
5058 if (spec->input_mux->num_items > 1)
5060 else if (spec->input_mux->num_items == 1)
5061 fixup_single_adc(codec);
5063 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
5067 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5068 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5071 struct alc_spec *spec = codec->spec;
5073 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5075 for (n = 0; n < num_nids; n++) {
5077 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5081 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5084 nconns = snd_hda_get_connections(codec, cap, conn,
5088 nconns = snd_hda_get_connections(codec, cap, conn,
5093 if (!fallback_adc) {
5097 for (i = 0; i < AUTO_PIN_LAST; i++) {
5098 hda_nid_t nid = spec->autocfg.input_pins[i];
5101 for (j = 0; j < nconns; j++) {
5108 if (i >= AUTO_PIN_LAST) {
5109 int num_adcs = spec->num_adc_nids;
5110 spec->private_adc_nids[num_adcs] = adc;
5111 spec->private_capsrc_nids[num_adcs] = cap;
5112 spec->num_adc_nids++;
5113 spec->adc_nids = spec->private_adc_nids;
5115 spec->capsrc_nids = spec->private_capsrc_nids;
5118 if (!spec->num_adc_nids) {
5119 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5120 " using fallback 0x%x\n",
5121 codec->chip_name, fallback_adc);
5122 spec->private_adc_nids[0] = fallback_adc;
5123 spec->adc_nids = spec->private_adc_nids;
5124 if (fallback_adc != fallback_cap) {
5125 spec->private_capsrc_nids[0] = fallback_cap;
5126 spec->capsrc_nids = spec->private_adc_nids;
5131 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5132 #define set_beep_amp(spec, nid, idx, dir) \
5133 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5135 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5139 * OK, here we have finally the patch for ALC880
5142 static int patch_alc880(struct hda_codec *codec)
5144 struct alc_spec *spec;
5148 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5154 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5157 if (board_config < 0) {
5158 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5160 board_config = ALC880_AUTO;
5163 if (board_config == ALC880_AUTO) {
5164 /* automatic parse from the BIOS config */
5165 err = alc880_parse_auto_config(codec);
5171 "hda_codec: Cannot set up configuration "
5172 "from BIOS. Using 3-stack mode...\n");
5173 board_config = ALC880_3ST;
5177 err = snd_hda_attach_beep_device(codec, 0x1);
5183 if (board_config != ALC880_AUTO)
5184 setup_preset(codec, &alc880_presets[board_config]);
5186 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5187 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5188 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5190 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5191 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5193 if (!spec->adc_nids && spec->input_mux) {
5194 /* check whether NID 0x07 is valid */
5195 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5197 wcap = get_wcaps_type(wcap);
5198 if (wcap != AC_WID_AUD_IN) {
5199 spec->adc_nids = alc880_adc_nids_alt;
5200 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5202 spec->adc_nids = alc880_adc_nids;
5203 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5206 set_capture_mixer(codec);
5207 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5209 spec->vmaster_nid = 0x0c;
5211 codec->patch_ops = alc_patch_ops;
5212 if (board_config == ALC880_AUTO)
5213 spec->init_hook = alc880_auto_init;
5214 #ifdef CONFIG_SND_HDA_POWER_SAVE
5215 if (!spec->loopback.amplist)
5216 spec->loopback.amplist = alc880_loopbacks;
5227 static hda_nid_t alc260_dac_nids[1] = {
5232 static hda_nid_t alc260_adc_nids[1] = {
5237 static hda_nid_t alc260_adc_nids_alt[1] = {
5242 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5243 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5245 static hda_nid_t alc260_dual_adc_nids[2] = {
5250 #define ALC260_DIGOUT_NID 0x03
5251 #define ALC260_DIGIN_NID 0x06
5253 static struct hda_input_mux alc260_capture_source = {
5257 { "Front Mic", 0x1 },
5263 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5264 * headphone jack and the internal CD lines since these are the only pins at
5265 * which audio can appear. For flexibility, also allow the option of
5266 * recording the mixer output on the second ADC (ADC0 doesn't have a
5267 * connection to the mixer output).
5269 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5273 { "Mic/Line", 0x0 },
5275 { "Headphone", 0x2 },
5281 { "Mic/Line", 0x0 },
5283 { "Headphone", 0x2 },
5290 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5291 * the Fujitsu S702x, but jacks are marked differently.
5293 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5300 { "Headphone", 0x5 },
5309 { "Headphone", 0x6 },
5315 /* Maxdata Favorit 100XS */
5316 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5320 { "Line/Mic", 0x0 },
5327 { "Line/Mic", 0x0 },
5335 * This is just place-holder, so there's something for alc_build_pcms to look
5336 * at when it calculates the maximum number of channels. ALC260 has no mixer
5337 * element which allows changing the channel mode, so the verb list is
5340 static struct hda_channel_mode alc260_modes[1] = {
5345 /* Mixer combinations
5347 * basic: base_output + input + pc_beep + capture
5348 * HP: base_output + input + capture_alt
5349 * HP_3013: hp_3013 + input + capture
5350 * fujitsu: fujitsu + capture
5351 * acer: acer + capture
5354 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5355 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5356 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5357 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5358 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5359 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5360 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5364 static struct snd_kcontrol_new alc260_input_mixer[] = {
5365 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5366 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5367 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5368 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5369 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5370 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5371 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5372 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5376 /* update HP, line and mono out pins according to the master switch */
5377 static void alc260_hp_master_update(struct hda_codec *codec,
5378 hda_nid_t hp, hda_nid_t line,
5381 struct alc_spec *spec = codec->spec;
5382 unsigned int val = spec->master_sw ? PIN_HP : 0;
5383 /* change HP and line-out pins */
5384 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5386 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5388 /* mono (speaker) depending on the HP jack sense */
5389 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5390 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5394 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5395 struct snd_ctl_elem_value *ucontrol)
5397 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5398 struct alc_spec *spec = codec->spec;
5399 *ucontrol->value.integer.value = spec->master_sw;
5403 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5404 struct snd_ctl_elem_value *ucontrol)
5406 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5407 struct alc_spec *spec = codec->spec;
5408 int val = !!*ucontrol->value.integer.value;
5409 hda_nid_t hp, line, mono;
5411 if (val == spec->master_sw)
5413 spec->master_sw = val;
5414 hp = (kcontrol->private_value >> 16) & 0xff;
5415 line = (kcontrol->private_value >> 8) & 0xff;
5416 mono = kcontrol->private_value & 0xff;
5417 alc260_hp_master_update(codec, hp, line, mono);
5421 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5423 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5424 .name = "Master Playback Switch",
5425 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5426 .info = snd_ctl_boolean_mono_info,
5427 .get = alc260_hp_master_sw_get,
5428 .put = alc260_hp_master_sw_put,
5429 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5431 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5432 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5433 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5434 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5435 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5437 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5441 static struct hda_verb alc260_hp_unsol_verbs[] = {
5442 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5446 static void alc260_hp_automute(struct hda_codec *codec)
5448 struct alc_spec *spec = codec->spec;
5450 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5451 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5454 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5456 if ((res >> 26) == ALC880_HP_EVENT)
5457 alc260_hp_automute(codec);
5460 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5462 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5463 .name = "Master Playback Switch",
5464 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5465 .info = snd_ctl_boolean_mono_info,
5466 .get = alc260_hp_master_sw_get,
5467 .put = alc260_hp_master_sw_put,
5468 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5470 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5471 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5472 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5473 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5474 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5475 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5476 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5477 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5481 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5482 .ops = &snd_hda_bind_vol,
5484 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5485 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5486 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5491 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5492 .ops = &snd_hda_bind_sw,
5494 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5495 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5500 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5501 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5502 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5503 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5504 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5508 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5509 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5513 static void alc260_hp_3013_automute(struct hda_codec *codec)
5515 struct alc_spec *spec = codec->spec;
5517 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5518 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5521 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5524 if ((res >> 26) == ALC880_HP_EVENT)
5525 alc260_hp_3013_automute(codec);
5528 static void alc260_hp_3012_automute(struct hda_codec *codec)
5530 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5532 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5534 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5536 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5540 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5543 if ((res >> 26) == ALC880_HP_EVENT)
5544 alc260_hp_3012_automute(codec);
5547 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5548 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5550 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5551 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5552 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5553 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5554 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5555 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5556 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5557 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5558 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5559 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5560 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5564 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5565 * versions of the ALC260 don't act on requests to enable mic bias from NID
5566 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5567 * datasheet doesn't mention this restriction. At this stage it's not clear
5568 * whether this behaviour is intentional or is a hardware bug in chip
5569 * revisions available in early 2006. Therefore for now allow the
5570 * "Headphone Jack Mode" control to span all choices, but if it turns out
5571 * that the lack of mic bias for this NID is intentional we could change the
5572 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5574 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5575 * don't appear to make the mic bias available from the "line" jack, even
5576 * though the NID used for this jack (0x14) can supply it. The theory is
5577 * that perhaps Acer have included blocking capacitors between the ALC260
5578 * and the output jack. If this turns out to be the case for all such
5579 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5580 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5582 * The C20x Tablet series have a mono internal speaker which is controlled
5583 * via the chip's Mono sum widget and pin complex, so include the necessary
5584 * controls for such models. On models without a "mono speaker" the control
5585 * won't do anything.
5587 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5588 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5589 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5590 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5591 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5593 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5595 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5596 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5597 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5598 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5599 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5600 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5601 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5602 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5606 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5608 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5609 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5610 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5611 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5612 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5613 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5614 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5618 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5619 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5621 static struct snd_kcontrol_new alc260_will_mixer[] = {
5622 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5623 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5625 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5626 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5627 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5628 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5629 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5630 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5631 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5635 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5636 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5638 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5639 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5640 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5642 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5643 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5644 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5645 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5646 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5647 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5648 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5653 * initialization verbs
5655 static struct hda_verb alc260_init_verbs[] = {
5656 /* Line In pin widget for input */
5657 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5658 /* CD pin widget for input */
5659 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5660 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5661 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5662 /* Mic2 (front panel) pin widget for input and vref at 80% */
5663 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5664 /* LINE-2 is used for line-out in rear */
5665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5666 /* select line-out */
5667 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5669 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5671 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5673 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5674 /* mute capture amp left and right */
5675 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5676 /* set connection select to line in (default select for this ADC) */
5677 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5678 /* mute capture amp left and right */
5679 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5680 /* set connection select to line in (default select for this ADC) */
5681 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5682 /* set vol=0 Line-Out mixer amp left and right */
5683 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5684 /* unmute pin widget amp left and right (no gain on this amp) */
5685 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5686 /* set vol=0 HP mixer amp left and right */
5687 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5688 /* unmute pin widget amp left and right (no gain on this amp) */
5689 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5690 /* set vol=0 Mono mixer amp left and right */
5691 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5692 /* unmute pin widget amp left and right (no gain on this amp) */
5693 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5694 /* unmute LINE-2 out pin */
5695 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5696 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5699 /* mute analog inputs */
5700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5704 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5705 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5706 /* mute Front out path */
5707 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5708 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5709 /* mute Headphone out path */
5710 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5711 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5712 /* mute Mono out path */
5713 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5714 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5718 #if 0 /* should be identical with alc260_init_verbs? */
5719 static struct hda_verb alc260_hp_init_verbs[] = {
5720 /* Headphone and output */
5721 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5723 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5724 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5725 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5726 /* Mic2 (front panel) pin widget for input and vref at 80% */
5727 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5728 /* Line In pin widget for input */
5729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5730 /* Line-2 pin widget for output */
5731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5732 /* CD pin widget for input */
5733 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5734 /* unmute amp left and right */
5735 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5736 /* set connection select to line in (default select for this ADC) */
5737 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5738 /* unmute Line-Out mixer amp left and right (volume = 0) */
5739 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5740 /* mute pin widget amp left and right (no gain on this amp) */
5741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5742 /* unmute HP mixer amp left and right (volume = 0) */
5743 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5744 /* mute pin widget amp left and right (no gain on this amp) */
5745 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5746 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5749 /* mute analog inputs */
5750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5755 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5756 /* Unmute Front out path */
5757 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5758 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5759 /* Unmute Headphone out path */
5760 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5761 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5762 /* Unmute Mono out path */
5763 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5764 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5769 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5770 /* Line out and output */
5771 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5773 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5774 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5775 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5776 /* Mic2 (front panel) pin widget for input and vref at 80% */
5777 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5778 /* Line In pin widget for input */
5779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5780 /* Headphone pin widget for output */
5781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5782 /* CD pin widget for input */
5783 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5784 /* unmute amp left and right */
5785 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5786 /* set connection select to line in (default select for this ADC) */
5787 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5788 /* unmute Line-Out mixer amp left and right (volume = 0) */
5789 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5790 /* mute pin widget amp left and right (no gain on this amp) */
5791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5792 /* unmute HP mixer amp left and right (volume = 0) */
5793 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5794 /* mute pin widget amp left and right (no gain on this amp) */
5795 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5796 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5799 /* mute analog inputs */
5800 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5801 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5802 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5803 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5804 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5805 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5806 /* Unmute Front out path */
5807 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5808 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5809 /* Unmute Headphone out path */
5810 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5811 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5812 /* Unmute Mono out path */
5813 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5814 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5818 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5819 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5820 * audio = 0x16, internal speaker = 0x10.
5822 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5823 /* Disable all GPIOs */
5824 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5825 /* Internal speaker is connected to headphone pin */
5826 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5827 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5828 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5829 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5830 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5831 /* Ensure all other unused pins are disabled and muted. */
5832 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5833 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5834 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5835 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5836 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5837 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5838 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5841 /* Disable digital (SPDIF) pins */
5842 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5843 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5845 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5846 * when acting as an output.
5848 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5850 /* Start with output sum widgets muted and their output gains at min */
5851 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5852 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5854 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5855 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5857 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5858 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5859 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5861 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5862 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5863 /* Unmute Line1 pin widget output buffer since it starts as an output.
5864 * If the pin mode is changed by the user the pin mode control will
5865 * take care of enabling the pin's input/output buffers as needed.
5866 * Therefore there's no need to enable the input buffer at this
5869 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5870 /* Unmute input buffer of pin widget used for Line-in (no equiv
5873 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5875 /* Mute capture amp left and right */
5876 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5877 /* Set ADC connection select to match default mixer setting - line
5880 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5882 /* Do the same for the second ADC: mute capture input amp and
5883 * set ADC connection to line in (on mic1 pin)
5885 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5886 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5888 /* Mute all inputs to mixer widget (even unconnected ones) */
5889 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5890 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5891 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5892 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5893 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5894 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5896 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5901 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5902 * similar laptops (adapted from Fujitsu init verbs).
5904 static struct hda_verb alc260_acer_init_verbs[] = {
5905 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5906 * the headphone jack. Turn this on and rely on the standard mute
5907 * methods whenever the user wants to turn these outputs off.
5909 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5910 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5911 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5912 /* Internal speaker/Headphone jack is connected to Line-out pin */
5913 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5914 /* Internal microphone/Mic jack is connected to Mic1 pin */
5915 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5916 /* Line In jack is connected to Line1 pin */
5917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5918 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5919 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5920 /* Ensure all other unused pins are disabled and muted. */
5921 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5922 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5923 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5924 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5925 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5927 /* Disable digital (SPDIF) pins */
5928 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5929 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5931 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5932 * bus when acting as outputs.
5934 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5935 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5937 /* Start with output sum widgets muted and their output gains at min */
5938 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5939 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5940 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5941 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5942 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5943 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5944 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5945 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5946 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5948 /* Unmute Line-out pin widget amp left and right
5949 * (no equiv mixer ctrl)
5951 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5952 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5953 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5954 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5955 * inputs. If the pin mode is changed by the user the pin mode control
5956 * will take care of enabling the pin's input/output buffers as needed.
5957 * Therefore there's no need to enable the input buffer at this
5960 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5961 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5963 /* Mute capture amp left and right */
5964 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5965 /* Set ADC connection select to match default mixer setting - mic
5968 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5970 /* Do similar with the second ADC: mute capture input amp and
5971 * set ADC connection to mic to match ALSA's default state.
5973 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5974 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5976 /* Mute all inputs to mixer widget (even unconnected ones) */
5977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5980 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5982 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5983 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5984 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5989 /* Initialisation sequence for Maxdata Favorit 100XS
5990 * (adapted from Acer init verbs).
5992 static struct hda_verb alc260_favorit100_init_verbs[] = {
5993 /* GPIO 0 enables the output jack.
5994 * Turn this on and rely on the standard mute
5995 * methods whenever the user wants to turn these outputs off.
5997 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5998 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5999 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6000 /* Line/Mic input jack is connected to Mic1 pin */
6001 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6002 /* Ensure all other unused pins are disabled and muted. */
6003 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6004 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6005 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6006 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6007 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6008 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6009 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6010 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6011 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6012 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6013 /* Disable digital (SPDIF) pins */
6014 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6015 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6017 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6018 * bus when acting as outputs.
6020 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6021 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6023 /* Start with output sum widgets muted and their output gains at min */
6024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6025 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6026 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6027 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6028 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6029 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6030 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6031 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6032 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6034 /* Unmute Line-out pin widget amp left and right
6035 * (no equiv mixer ctrl)
6037 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6038 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6039 * inputs. If the pin mode is changed by the user the pin mode control
6040 * will take care of enabling the pin's input/output buffers as needed.
6041 * Therefore there's no need to enable the input buffer at this
6044 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6046 /* Mute capture amp left and right */
6047 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6048 /* Set ADC connection select to match default mixer setting - mic
6051 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6053 /* Do similar with the second ADC: mute capture input amp and
6054 * set ADC connection to mic to match ALSA's default state.
6056 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6057 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6059 /* Mute all inputs to mixer widget (even unconnected ones) */
6060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6063 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6064 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6065 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6067 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6072 static struct hda_verb alc260_will_verbs[] = {
6073 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6074 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6075 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6076 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6077 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6078 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6082 static struct hda_verb alc260_replacer_672v_verbs[] = {
6083 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6084 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6085 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6087 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6088 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6089 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6091 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6095 /* toggle speaker-output according to the hp-jack state */
6096 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6098 unsigned int present;
6100 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6101 present = snd_hda_jack_detect(codec, 0x0f);
6103 snd_hda_codec_write_cache(codec, 0x01, 0,
6104 AC_VERB_SET_GPIO_DATA, 1);
6105 snd_hda_codec_write_cache(codec, 0x0f, 0,
6106 AC_VERB_SET_PIN_WIDGET_CONTROL,
6109 snd_hda_codec_write_cache(codec, 0x01, 0,
6110 AC_VERB_SET_GPIO_DATA, 0);
6111 snd_hda_codec_write_cache(codec, 0x0f, 0,
6112 AC_VERB_SET_PIN_WIDGET_CONTROL,
6117 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6120 if ((res >> 26) == ALC880_HP_EVENT)
6121 alc260_replacer_672v_automute(codec);
6124 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6125 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6126 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6127 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6128 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6129 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6131 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6132 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6133 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6134 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6138 /* Test configuration for debugging, modelled after the ALC880 test
6141 #ifdef CONFIG_SND_DEBUG
6142 static hda_nid_t alc260_test_dac_nids[1] = {
6145 static hda_nid_t alc260_test_adc_nids[2] = {
6148 /* For testing the ALC260, each input MUX needs its own definition since
6149 * the signal assignments are different. This assumes that the first ADC
6152 static struct hda_input_mux alc260_test_capture_sources[2] = {
6156 { "MIC1 pin", 0x0 },
6157 { "MIC2 pin", 0x1 },
6158 { "LINE1 pin", 0x2 },
6159 { "LINE2 pin", 0x3 },
6161 { "LINE-OUT pin", 0x5 },
6162 { "HP-OUT pin", 0x6 },
6168 { "MIC1 pin", 0x0 },
6169 { "MIC2 pin", 0x1 },
6170 { "LINE1 pin", 0x2 },
6171 { "LINE2 pin", 0x3 },
6174 { "LINE-OUT pin", 0x6 },
6175 { "HP-OUT pin", 0x7 },
6179 static struct snd_kcontrol_new alc260_test_mixer[] = {
6180 /* Output driver widgets */
6181 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6182 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6183 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6184 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6185 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6186 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6188 /* Modes for retasking pin widgets
6189 * Note: the ALC260 doesn't seem to act on requests to enable mic
6190 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6191 * mention this restriction. At this stage it's not clear whether
6192 * this behaviour is intentional or is a hardware bug in chip
6193 * revisions available at least up until early 2006. Therefore for
6194 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6195 * choices, but if it turns out that the lack of mic bias for these
6196 * NIDs is intentional we could change their modes from
6197 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6199 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6200 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6201 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6202 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6203 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6204 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6206 /* Loopback mixer controls */
6207 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6208 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6209 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6210 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6211 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6212 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6213 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6214 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6215 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6216 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6217 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6218 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6219 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6220 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6222 /* Controls for GPIO pins, assuming they are configured as outputs */
6223 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6224 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6225 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6226 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6228 /* Switches to allow the digital IO pins to be enabled. The datasheet
6229 * is ambigious as to which NID is which; testing on laptops which
6230 * make this output available should provide clarification.
6232 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6233 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6235 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6236 * this output to turn on an external amplifier.
6238 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6239 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6243 static struct hda_verb alc260_test_init_verbs[] = {
6244 /* Enable all GPIOs as outputs with an initial value of 0 */
6245 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6246 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6247 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6249 /* Enable retasking pins as output, initially without power amp */
6250 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6251 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6252 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6253 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6254 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6255 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6257 /* Disable digital (SPDIF) pins initially, but users can enable
6258 * them via a mixer switch. In the case of SPDIF-out, this initverb
6259 * payload also sets the generation to 0, output to be in "consumer"
6260 * PCM format, copyright asserted, no pre-emphasis and no validity
6263 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6264 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6266 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6267 * OUT1 sum bus when acting as an output.
6269 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6270 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6271 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6272 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6274 /* Start with output sum widgets muted and their output gains at min */
6275 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6276 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6277 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6278 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6279 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6280 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6281 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6282 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6283 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6285 /* Unmute retasking pin widget output buffers since the default
6286 * state appears to be output. As the pin mode is changed by the
6287 * user the pin mode control will take care of enabling the pin's
6288 * input/output buffers as needed.
6290 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6291 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6292 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6293 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6294 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6295 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6296 /* Also unmute the mono-out pin widget */
6297 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6299 /* Mute capture amp left and right */
6300 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6301 /* Set ADC connection select to match default mixer setting (mic1
6304 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6306 /* Do the same for the second ADC: mute capture input amp and
6307 * set ADC connection to mic1 pin
6309 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6310 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6312 /* Mute all inputs to mixer widget (even unconnected ones) */
6313 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6314 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6315 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6316 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6318 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6319 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6320 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6326 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6327 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6329 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6330 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6333 * for BIOS auto-configuration
6336 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6337 const char *pfx, int *vol_bits)
6340 unsigned long vol_val, sw_val;
6343 if (nid >= 0x0f && nid < 0x11) {
6344 nid_vol = nid - 0x7;
6345 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6346 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6347 } else if (nid == 0x11) {
6348 nid_vol = nid - 0x7;
6349 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6350 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6351 } else if (nid >= 0x12 && nid <= 0x15) {
6353 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6354 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6358 if (!(*vol_bits & (1 << nid_vol))) {
6359 /* first control for the volume widget */
6360 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6363 *vol_bits |= (1 << nid_vol);
6365 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6371 /* add playback controls from the parsed DAC table */
6372 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6373 const struct auto_pin_cfg *cfg)
6379 spec->multiout.num_dacs = 1;
6380 spec->multiout.dac_nids = spec->private_dac_nids;
6381 spec->multiout.dac_nids[0] = 0x02;
6383 nid = cfg->line_out_pins[0];
6386 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6388 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6392 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6397 nid = cfg->speaker_pins[0];
6399 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6404 nid = cfg->hp_pins[0];
6406 err = alc260_add_playback_controls(spec, nid, "Headphone",
6414 /* create playback/capture controls for input pins */
6415 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6416 const struct auto_pin_cfg *cfg)
6418 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6421 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6422 hda_nid_t nid, int pin_type,
6425 alc_set_pin_output(codec, nid, pin_type);
6426 /* need the manual connection? */
6428 int idx = nid - 0x12;
6429 snd_hda_codec_write(codec, idx + 0x0b, 0,
6430 AC_VERB_SET_CONNECT_SEL, sel_idx);
6434 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6436 struct alc_spec *spec = codec->spec;
6439 nid = spec->autocfg.line_out_pins[0];
6441 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6442 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6445 nid = spec->autocfg.speaker_pins[0];
6447 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6449 nid = spec->autocfg.hp_pins[0];
6451 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6454 #define ALC260_PIN_CD_NID 0x16
6455 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6457 struct alc_spec *spec = codec->spec;
6460 for (i = 0; i < AUTO_PIN_LAST; i++) {
6461 hda_nid_t nid = spec->autocfg.input_pins[i];
6463 alc_set_input_pin(codec, nid, i);
6464 if (nid != ALC260_PIN_CD_NID &&
6465 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6466 snd_hda_codec_write(codec, nid, 0,
6467 AC_VERB_SET_AMP_GAIN_MUTE,
6474 * generic initialization of ADC, input mixers and output mixers
6476 static struct hda_verb alc260_volume_init_verbs[] = {
6478 * Unmute ADC0-1 and set the default input to mic-in
6480 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6481 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6482 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6483 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6485 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6487 * Note: PASD motherboards uses the Line In 2 as the input for
6488 * front panel mic (mic 2)
6490 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6491 /* mute analog inputs */
6492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6494 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6499 * Set up output mixers (0x08 - 0x0a)
6501 /* set vol=0 to output mixers */
6502 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6504 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6505 /* set up input amps for analog loopback */
6506 /* Amp Indices: DAC = 0, mixer = 1 */
6507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6509 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6511 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6512 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6517 static int alc260_parse_auto_config(struct hda_codec *codec)
6519 struct alc_spec *spec = codec->spec;
6521 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6523 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6527 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6530 if (!spec->kctls.list)
6531 return 0; /* can't find valid BIOS pin config */
6532 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6536 spec->multiout.max_channels = 2;
6538 if (spec->autocfg.dig_outs)
6539 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6540 if (spec->kctls.list)
6541 add_mixer(spec, spec->kctls.list);
6543 add_verb(spec, alc260_volume_init_verbs);
6545 spec->num_mux_defs = 1;
6546 spec->input_mux = &spec->private_imux[0];
6548 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6553 /* additional initialization for auto-configuration model */
6554 static void alc260_auto_init(struct hda_codec *codec)
6556 struct alc_spec *spec = codec->spec;
6557 alc260_auto_init_multi_out(codec);
6558 alc260_auto_init_analog_input(codec);
6559 if (spec->unsol_event)
6560 alc_inithook(codec);
6563 #ifdef CONFIG_SND_HDA_POWER_SAVE
6564 static struct hda_amp_list alc260_loopbacks[] = {
6565 { 0x07, HDA_INPUT, 0 },
6566 { 0x07, HDA_INPUT, 1 },
6567 { 0x07, HDA_INPUT, 2 },
6568 { 0x07, HDA_INPUT, 3 },
6569 { 0x07, HDA_INPUT, 4 },
6575 * ALC260 configurations
6577 static const char *alc260_models[ALC260_MODEL_LAST] = {
6578 [ALC260_BASIC] = "basic",
6580 [ALC260_HP_3013] = "hp-3013",
6581 [ALC260_HP_DC7600] = "hp-dc7600",
6582 [ALC260_FUJITSU_S702X] = "fujitsu",
6583 [ALC260_ACER] = "acer",
6584 [ALC260_WILL] = "will",
6585 [ALC260_REPLACER_672V] = "replacer",
6586 [ALC260_FAVORIT100] = "favorit100",
6587 #ifdef CONFIG_SND_DEBUG
6588 [ALC260_TEST] = "test",
6590 [ALC260_AUTO] = "auto",
6593 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6594 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6595 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6596 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6597 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6598 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6599 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6600 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6601 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6602 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6603 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6604 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6605 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6606 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6607 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6608 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6609 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6610 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6611 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6612 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6613 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6617 static struct alc_config_preset alc260_presets[] = {
6619 .mixers = { alc260_base_output_mixer,
6620 alc260_input_mixer },
6621 .init_verbs = { alc260_init_verbs },
6622 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6623 .dac_nids = alc260_dac_nids,
6624 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6625 .adc_nids = alc260_dual_adc_nids,
6626 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6627 .channel_mode = alc260_modes,
6628 .input_mux = &alc260_capture_source,
6631 .mixers = { alc260_hp_output_mixer,
6632 alc260_input_mixer },
6633 .init_verbs = { alc260_init_verbs,
6634 alc260_hp_unsol_verbs },
6635 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6636 .dac_nids = alc260_dac_nids,
6637 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6638 .adc_nids = alc260_adc_nids_alt,
6639 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6640 .channel_mode = alc260_modes,
6641 .input_mux = &alc260_capture_source,
6642 .unsol_event = alc260_hp_unsol_event,
6643 .init_hook = alc260_hp_automute,
6645 [ALC260_HP_DC7600] = {
6646 .mixers = { alc260_hp_dc7600_mixer,
6647 alc260_input_mixer },
6648 .init_verbs = { alc260_init_verbs,
6649 alc260_hp_dc7600_verbs },
6650 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6651 .dac_nids = alc260_dac_nids,
6652 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6653 .adc_nids = alc260_adc_nids_alt,
6654 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6655 .channel_mode = alc260_modes,
6656 .input_mux = &alc260_capture_source,
6657 .unsol_event = alc260_hp_3012_unsol_event,
6658 .init_hook = alc260_hp_3012_automute,
6660 [ALC260_HP_3013] = {
6661 .mixers = { alc260_hp_3013_mixer,
6662 alc260_input_mixer },
6663 .init_verbs = { alc260_hp_3013_init_verbs,
6664 alc260_hp_3013_unsol_verbs },
6665 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6666 .dac_nids = alc260_dac_nids,
6667 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6668 .adc_nids = alc260_adc_nids_alt,
6669 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6670 .channel_mode = alc260_modes,
6671 .input_mux = &alc260_capture_source,
6672 .unsol_event = alc260_hp_3013_unsol_event,
6673 .init_hook = alc260_hp_3013_automute,
6675 [ALC260_FUJITSU_S702X] = {
6676 .mixers = { alc260_fujitsu_mixer },
6677 .init_verbs = { alc260_fujitsu_init_verbs },
6678 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6679 .dac_nids = alc260_dac_nids,
6680 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6681 .adc_nids = alc260_dual_adc_nids,
6682 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6683 .channel_mode = alc260_modes,
6684 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6685 .input_mux = alc260_fujitsu_capture_sources,
6688 .mixers = { alc260_acer_mixer },
6689 .init_verbs = { alc260_acer_init_verbs },
6690 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6691 .dac_nids = alc260_dac_nids,
6692 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6693 .adc_nids = alc260_dual_adc_nids,
6694 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6695 .channel_mode = alc260_modes,
6696 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6697 .input_mux = alc260_acer_capture_sources,
6699 [ALC260_FAVORIT100] = {
6700 .mixers = { alc260_favorit100_mixer },
6701 .init_verbs = { alc260_favorit100_init_verbs },
6702 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6703 .dac_nids = alc260_dac_nids,
6704 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6705 .adc_nids = alc260_dual_adc_nids,
6706 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6707 .channel_mode = alc260_modes,
6708 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6709 .input_mux = alc260_favorit100_capture_sources,
6712 .mixers = { alc260_will_mixer },
6713 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6714 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6715 .dac_nids = alc260_dac_nids,
6716 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6717 .adc_nids = alc260_adc_nids,
6718 .dig_out_nid = ALC260_DIGOUT_NID,
6719 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6720 .channel_mode = alc260_modes,
6721 .input_mux = &alc260_capture_source,
6723 [ALC260_REPLACER_672V] = {
6724 .mixers = { alc260_replacer_672v_mixer },
6725 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6726 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6727 .dac_nids = alc260_dac_nids,
6728 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6729 .adc_nids = alc260_adc_nids,
6730 .dig_out_nid = ALC260_DIGOUT_NID,
6731 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6732 .channel_mode = alc260_modes,
6733 .input_mux = &alc260_capture_source,
6734 .unsol_event = alc260_replacer_672v_unsol_event,
6735 .init_hook = alc260_replacer_672v_automute,
6737 #ifdef CONFIG_SND_DEBUG
6739 .mixers = { alc260_test_mixer },
6740 .init_verbs = { alc260_test_init_verbs },
6741 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6742 .dac_nids = alc260_test_dac_nids,
6743 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6744 .adc_nids = alc260_test_adc_nids,
6745 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6746 .channel_mode = alc260_modes,
6747 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6748 .input_mux = alc260_test_capture_sources,
6753 static int patch_alc260(struct hda_codec *codec)
6755 struct alc_spec *spec;
6756 int err, board_config;
6758 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6764 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6767 if (board_config < 0) {
6768 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6770 board_config = ALC260_AUTO;
6773 if (board_config == ALC260_AUTO) {
6774 /* automatic parse from the BIOS config */
6775 err = alc260_parse_auto_config(codec);
6781 "hda_codec: Cannot set up configuration "
6782 "from BIOS. Using base mode...\n");
6783 board_config = ALC260_BASIC;
6787 err = snd_hda_attach_beep_device(codec, 0x1);
6793 if (board_config != ALC260_AUTO)
6794 setup_preset(codec, &alc260_presets[board_config]);
6796 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6797 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6799 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6800 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6802 if (!spec->adc_nids && spec->input_mux) {
6803 /* check whether NID 0x04 is valid */
6804 unsigned int wcap = get_wcaps(codec, 0x04);
6805 wcap = get_wcaps_type(wcap);
6807 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6808 spec->adc_nids = alc260_adc_nids_alt;
6809 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6811 spec->adc_nids = alc260_adc_nids;
6812 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6815 set_capture_mixer(codec);
6816 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6818 spec->vmaster_nid = 0x08;
6820 codec->patch_ops = alc_patch_ops;
6821 if (board_config == ALC260_AUTO)
6822 spec->init_hook = alc260_auto_init;
6823 #ifdef CONFIG_SND_HDA_POWER_SAVE
6824 if (!spec->loopback.amplist)
6825 spec->loopback.amplist = alc260_loopbacks;
6833 * ALC882/883/885/888/889 support
6835 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6836 * configuration. Each pin widget can choose any input DACs and a mixer.
6837 * Each ADC is connected from a mixer of all inputs. This makes possible
6838 * 6-channel independent captures.
6840 * In addition, an independent DAC for the multi-playback (not used in this
6843 #define ALC882_DIGOUT_NID 0x06
6844 #define ALC882_DIGIN_NID 0x0a
6845 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6846 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6847 #define ALC1200_DIGOUT_NID 0x10
6850 static struct hda_channel_mode alc882_ch_modes[1] = {
6855 static hda_nid_t alc882_dac_nids[4] = {
6856 /* front, rear, clfe, rear_surr */
6857 0x02, 0x03, 0x04, 0x05
6859 #define alc883_dac_nids alc882_dac_nids
6862 #define alc882_adc_nids alc880_adc_nids
6863 #define alc882_adc_nids_alt alc880_adc_nids_alt
6864 #define alc883_adc_nids alc882_adc_nids_alt
6865 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6866 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6867 #define alc889_adc_nids alc880_adc_nids
6869 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6870 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6871 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6872 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6873 #define alc889_capsrc_nids alc882_capsrc_nids
6876 /* FIXME: should be a matrix-type input source selection */
6878 static struct hda_input_mux alc882_capture_source = {
6882 { "Front Mic", 0x1 },
6888 #define alc883_capture_source alc882_capture_source
6890 static struct hda_input_mux alc889_capture_source = {
6893 { "Front Mic", 0x0 },
6899 static struct hda_input_mux mb5_capture_source = {
6908 static struct hda_input_mux macmini3_capture_source = {
6916 static struct hda_input_mux alc883_3stack_6ch_intel = {
6920 { "Front Mic", 0x0 },
6926 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6934 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6944 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6952 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6956 { "Front Mic", 0x1 },
6961 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6969 static struct hda_input_mux alc889A_mb31_capture_source = {
6973 /* Front Mic (0x01) unused */
6975 /* Line 2 (0x03) unused */
6976 /* CD (0x04) unused? */
6983 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6990 static struct hda_verb alc882_3ST_ch2_init[] = {
6991 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6992 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6993 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6994 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7001 static struct hda_verb alc882_3ST_ch4_init[] = {
7002 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7003 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7004 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7005 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7006 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7013 static struct hda_verb alc882_3ST_ch6_init[] = {
7014 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7015 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7016 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7017 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7018 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7019 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7023 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7024 { 2, alc882_3ST_ch2_init },
7025 { 4, alc882_3ST_ch4_init },
7026 { 6, alc882_3ST_ch6_init },
7029 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7034 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7035 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7036 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7037 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7038 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7039 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7046 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7047 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7048 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7049 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7050 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7051 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7052 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7059 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7060 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7061 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7062 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7063 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7064 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7065 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7066 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7070 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7071 { 2, alc883_3ST_ch2_clevo_init },
7072 { 4, alc883_3ST_ch4_clevo_init },
7073 { 6, alc883_3ST_ch6_clevo_init },
7080 static struct hda_verb alc882_sixstack_ch6_init[] = {
7081 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7082 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7083 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7084 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7091 static struct hda_verb alc882_sixstack_ch8_init[] = {
7092 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7093 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7094 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7095 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7099 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7100 { 6, alc882_sixstack_ch6_init },
7101 { 8, alc882_sixstack_ch8_init },
7105 /* Macbook Air 2,1 */
7107 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7112 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7118 static struct hda_verb alc885_mbp_ch2_init[] = {
7119 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7120 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7121 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7128 static struct hda_verb alc885_mbp_ch4_init[] = {
7129 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7130 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7131 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7132 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7133 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7137 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7138 { 2, alc885_mbp_ch2_init },
7139 { 4, alc885_mbp_ch4_init },
7144 * Speakers/Woofer/HP = Front
7147 static struct hda_verb alc885_mb5_ch2_init[] = {
7148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7149 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7155 * Speakers/HP = Front
7159 static struct hda_verb alc885_mb5_ch6_init[] = {
7160 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7161 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7162 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7166 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7167 { 2, alc885_mb5_ch2_init },
7168 { 6, alc885_mb5_ch6_init },
7171 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7176 static struct hda_verb alc883_4ST_ch2_init[] = {
7177 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7178 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7179 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7180 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7181 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7182 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7189 static struct hda_verb alc883_4ST_ch4_init[] = {
7190 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7191 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7192 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7193 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7194 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7195 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7196 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7203 static struct hda_verb alc883_4ST_ch6_init[] = {
7204 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7205 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7206 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7207 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7208 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7209 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7210 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7211 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7218 static struct hda_verb alc883_4ST_ch8_init[] = {
7219 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7220 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7221 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7222 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7223 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7224 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7225 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7226 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7227 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7231 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7232 { 2, alc883_4ST_ch2_init },
7233 { 4, alc883_4ST_ch4_init },
7234 { 6, alc883_4ST_ch6_init },
7235 { 8, alc883_4ST_ch8_init },
7242 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7243 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7244 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7245 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7246 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7253 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7254 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7255 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7256 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7257 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7258 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7265 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7266 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7267 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7268 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7269 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7270 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7271 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7275 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7276 { 2, alc883_3ST_ch2_intel_init },
7277 { 4, alc883_3ST_ch4_intel_init },
7278 { 6, alc883_3ST_ch6_intel_init },
7284 static struct hda_verb alc889_ch2_intel_init[] = {
7285 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7286 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7287 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7288 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7289 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7290 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7297 static struct hda_verb alc889_ch6_intel_init[] = {
7298 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7299 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7300 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7301 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7302 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7303 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7310 static struct hda_verb alc889_ch8_intel_init[] = {
7311 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7312 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7313 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7314 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7315 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7316 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7317 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7321 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7322 { 2, alc889_ch2_intel_init },
7323 { 6, alc889_ch6_intel_init },
7324 { 8, alc889_ch8_intel_init },
7330 static struct hda_verb alc883_sixstack_ch6_init[] = {
7331 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7332 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7333 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7334 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7341 static struct hda_verb alc883_sixstack_ch8_init[] = {
7342 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7343 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7344 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7345 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7349 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7350 { 6, alc883_sixstack_ch6_init },
7351 { 8, alc883_sixstack_ch8_init },
7355 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7356 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7358 static struct snd_kcontrol_new alc882_base_mixer[] = {
7359 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7360 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7361 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7362 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7363 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7364 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7365 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7366 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7367 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7368 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7369 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7370 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7371 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7372 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7373 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7375 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7376 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7377 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7378 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7379 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7383 /* Macbook Air 2,1 same control for HP and internal Speaker */
7385 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7386 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7387 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7392 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7393 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7394 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7395 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7396 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7397 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7398 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7399 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7401 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7402 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7403 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7407 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7408 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7409 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7410 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7411 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7412 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7413 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7414 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7415 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7416 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7417 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7419 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7425 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7426 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7427 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7428 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7429 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7430 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7431 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7432 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7433 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7434 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7435 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7436 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7440 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7441 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7442 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7443 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7444 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7446 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7448 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7449 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7454 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7455 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7456 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7457 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7458 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7459 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7460 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7462 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7467 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7468 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7469 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7470 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7471 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7472 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7473 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7474 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7476 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7477 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7478 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7479 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7480 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7484 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7485 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7487 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7488 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7489 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7490 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7491 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7492 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7493 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7494 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7495 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7496 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7497 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7499 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7500 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7504 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7505 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7506 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7507 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7508 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7509 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7510 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7511 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7513 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7514 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7518 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7520 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7521 .name = "Channel Mode",
7522 .info = alc_ch_mode_info,
7523 .get = alc_ch_mode_get,
7524 .put = alc_ch_mode_put,
7529 static struct hda_verb alc882_base_init_verbs[] = {
7530 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7534 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7535 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7537 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7541 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7543 /* Front Pin: output 0 (0x0c) */
7544 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7545 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7546 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7547 /* Rear Pin: output 1 (0x0d) */
7548 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7550 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7551 /* CLFE Pin: output 2 (0x0e) */
7552 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7553 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7554 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7555 /* Side Pin: output 3 (0x0f) */
7556 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7557 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7558 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7559 /* Mic (rear) pin: input vref at 80% */
7560 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7561 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7562 /* Front Mic pin: input vref at 80% */
7563 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7564 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7565 /* Line In pin: input */
7566 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7567 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7568 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7569 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7570 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7571 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7572 /* CD pin widget for input */
7573 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7575 /* FIXME: use matrix-type input source selection */
7576 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7578 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7581 /* ADC2: mute amp left and right */
7582 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7583 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7584 /* ADC3: mute amp left and right */
7585 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7586 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7591 static struct hda_verb alc882_adc1_init_verbs[] = {
7592 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7596 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7597 /* ADC1: mute amp left and right */
7598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7599 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7603 static struct hda_verb alc882_eapd_verbs[] = {
7604 /* change to EAPD mode */
7605 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7606 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7610 static struct hda_verb alc889_eapd_verbs[] = {
7611 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7612 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7616 static struct hda_verb alc_hp15_unsol_verbs[] = {
7617 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7618 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7622 static struct hda_verb alc885_init_verbs[] = {
7623 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7633 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7634 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7636 /* Front HP Pin: output 0 (0x0c) */
7637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7639 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7640 /* Front Pin: output 0 (0x0c) */
7641 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7642 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7643 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7644 /* Rear Pin: output 1 (0x0d) */
7645 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7647 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7648 /* CLFE Pin: output 2 (0x0e) */
7649 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7650 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7651 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7652 /* Side Pin: output 3 (0x0f) */
7653 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7654 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7655 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7656 /* Mic (rear) pin: input vref at 80% */
7657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7658 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7659 /* Front Mic pin: input vref at 80% */
7660 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7661 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7662 /* Line In pin: input */
7663 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7664 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7666 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7668 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7673 /* ADC2: mute amp left and right */
7674 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7675 /* ADC3: mute amp left and right */
7676 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7681 static struct hda_verb alc885_init_input_verbs[] = {
7682 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7683 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7684 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7689 /* Unmute Selector 24h and set the default input to front mic */
7690 static struct hda_verb alc889_init_input_verbs[] = {
7691 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7692 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7697 #define alc883_init_verbs alc882_base_init_verbs
7700 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7701 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7702 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7703 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7704 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7705 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7706 /* FIXME: this looks suspicious...
7707 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7708 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7713 static struct hda_verb alc882_macpro_init_verbs[] = {
7714 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7716 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7717 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7718 /* Front Pin: output 0 (0x0c) */
7719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7721 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7722 /* Front Mic pin: input vref at 80% */
7723 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7724 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7725 /* Speaker: output */
7726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7728 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7729 /* Headphone output (output 0 - 0x0c) */
7730 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7731 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7732 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7734 /* FIXME: use matrix-type input source selection */
7735 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7736 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7737 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7738 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7739 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7742 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7744 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7745 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7747 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7750 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7751 /* ADC1: mute amp left and right */
7752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7753 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7754 /* ADC2: mute amp left and right */
7755 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7756 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7757 /* ADC3: mute amp left and right */
7758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7759 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7765 static struct hda_verb alc885_mb5_init_verbs[] = {
7767 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7768 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7769 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7770 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7773 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7774 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7775 /* Surround mixer */
7776 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7778 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7780 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7781 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7784 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7785 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7786 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7787 /* Front Pin (0x0c) */
7788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7790 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7791 /* LFE Pin (0x0e) */
7792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7793 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7794 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7797 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7798 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7799 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7800 /* Front Mic pin: input vref at 80% */
7801 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7802 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7807 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7808 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7809 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7810 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7815 static struct hda_verb alc885_macmini3_init_verbs[] = {
7817 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7818 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7819 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7820 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7824 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7825 /* Surround mixer */
7826 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7827 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7828 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7830 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7831 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7832 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7834 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7835 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7836 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7837 /* Front Pin (0x0c) */
7838 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7839 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7840 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7841 /* LFE Pin (0x0e) */
7842 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7843 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7844 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7847 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7848 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7849 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7851 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7852 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7854 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7855 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7862 static struct hda_verb alc885_mba21_init_verbs[] = {
7863 /*Internal and HP Speaker Mixer*/
7864 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7865 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7866 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7867 /*Internal Speaker Pin (0x0c)*/
7868 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7869 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7870 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7871 /* HP Pin: output 0 (0x0e) */
7872 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7873 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7874 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7875 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7876 /* Line in (is hp when jack connected)*/
7877 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7878 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7884 /* Macbook Pro rev3 */
7885 static struct hda_verb alc885_mbp3_init_verbs[] = {
7886 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7891 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7892 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7893 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7895 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7896 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7898 /* Front Pin: output 0 (0x0c) */
7899 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7900 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7901 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7902 /* HP Pin: output 0 (0x0e) */
7903 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7904 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7905 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7906 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7907 /* Mic (rear) pin: input vref at 80% */
7908 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7909 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7910 /* Front Mic pin: input vref at 80% */
7911 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7912 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7913 /* Line In pin: use output 1 when in LineOut mode */
7914 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7915 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7916 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7918 /* FIXME: use matrix-type input source selection */
7919 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7920 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7921 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7922 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7923 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7924 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7926 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7927 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7928 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7929 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7935 /* ADC1: mute amp left and right */
7936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7937 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7938 /* ADC2: mute amp left and right */
7939 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7940 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7941 /* ADC3: mute amp left and right */
7942 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7943 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7949 static struct hda_verb alc885_imac91_init_verbs[] = {
7950 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7952 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7955 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7957 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7958 /* HP Pin: output 0 (0x0c) */
7959 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7960 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7961 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7962 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7963 /* Internal Speakers: output 0 (0x0d) */
7964 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7965 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7966 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7967 /* Mic (rear) pin: input vref at 80% */
7968 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7969 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7970 /* Front Mic pin: input vref at 80% */
7971 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7972 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7973 /* Line In pin: use output 1 when in LineOut mode */
7974 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7975 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7976 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7978 /* FIXME: use matrix-type input source selection */
7979 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7980 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7981 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7982 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7986 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7987 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7988 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7989 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7991 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7992 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7993 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7995 /* ADC1: mute amp left and right */
7996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7997 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7998 /* ADC2: mute amp left and right */
7999 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8000 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8001 /* ADC3: mute amp left and right */
8002 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8003 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8008 /* iMac 24 mixer. */
8009 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8010 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8011 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8015 /* iMac 24 init verbs. */
8016 static struct hda_verb alc885_imac24_init_verbs[] = {
8017 /* Internal speakers: output 0 (0x0c) */
8018 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8019 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8020 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8021 /* Internal speakers: output 0 (0x0c) */
8022 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8023 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8024 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8025 /* Headphone: output 0 (0x0c) */
8026 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8027 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8028 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8029 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8030 /* Front Mic: input vref at 80% */
8031 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8032 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8036 /* Toggle speaker-output according to the hp-jack state */
8037 static void alc885_imac24_setup(struct hda_codec *codec)
8039 struct alc_spec *spec = codec->spec;
8041 spec->autocfg.hp_pins[0] = 0x14;
8042 spec->autocfg.speaker_pins[0] = 0x18;
8043 spec->autocfg.speaker_pins[1] = 0x1a;
8046 #define alc885_mb5_setup alc885_imac24_setup
8047 #define alc885_macmini3_setup alc885_imac24_setup
8049 /* Macbook Air 2,1 */
8050 static void alc885_mba21_setup(struct hda_codec *codec)
8052 struct alc_spec *spec = codec->spec;
8054 spec->autocfg.hp_pins[0] = 0x14;
8055 spec->autocfg.speaker_pins[0] = 0x18;
8060 static void alc885_mbp3_setup(struct hda_codec *codec)
8062 struct alc_spec *spec = codec->spec;
8064 spec->autocfg.hp_pins[0] = 0x15;
8065 spec->autocfg.speaker_pins[0] = 0x14;
8068 static void alc885_imac91_setup(struct hda_codec *codec)
8070 struct alc_spec *spec = codec->spec;
8072 spec->autocfg.hp_pins[0] = 0x14;
8073 spec->autocfg.speaker_pins[0] = 0x15;
8074 spec->autocfg.speaker_pins[1] = 0x1a;
8077 static struct hda_verb alc882_targa_verbs[] = {
8078 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8081 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8082 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8084 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8085 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8086 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8088 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8092 /* toggle speaker-output according to the hp-jack state */
8093 static void alc882_targa_automute(struct hda_codec *codec)
8095 struct alc_spec *spec = codec->spec;
8096 alc_automute_amp(codec);
8097 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8098 spec->jack_present ? 1 : 3);
8101 static void alc882_targa_setup(struct hda_codec *codec)
8103 struct alc_spec *spec = codec->spec;
8105 spec->autocfg.hp_pins[0] = 0x14;
8106 spec->autocfg.speaker_pins[0] = 0x1b;
8109 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8111 if ((res >> 26) == ALC880_HP_EVENT)
8112 alc882_targa_automute(codec);
8115 static struct hda_verb alc882_asus_a7j_verbs[] = {
8116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8120 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8121 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8123 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8124 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8125 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8127 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8128 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8129 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8133 static struct hda_verb alc882_asus_a7m_verbs[] = {
8134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8135 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8137 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8139 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8141 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8142 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8143 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8145 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8146 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8147 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8151 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8153 unsigned int gpiostate, gpiomask, gpiodir;
8155 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8156 AC_VERB_GET_GPIO_DATA, 0);
8159 gpiostate |= (1 << pin);
8161 gpiostate &= ~(1 << pin);
8163 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8164 AC_VERB_GET_GPIO_MASK, 0);
8165 gpiomask |= (1 << pin);
8167 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8168 AC_VERB_GET_GPIO_DIRECTION, 0);
8169 gpiodir |= (1 << pin);
8172 snd_hda_codec_write(codec, codec->afg, 0,
8173 AC_VERB_SET_GPIO_MASK, gpiomask);
8174 snd_hda_codec_write(codec, codec->afg, 0,
8175 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8179 snd_hda_codec_write(codec, codec->afg, 0,
8180 AC_VERB_SET_GPIO_DATA, gpiostate);
8183 /* set up GPIO at initialization */
8184 static void alc885_macpro_init_hook(struct hda_codec *codec)
8186 alc882_gpio_mute(codec, 0, 0);
8187 alc882_gpio_mute(codec, 1, 0);
8190 /* set up GPIO and update auto-muting at initialization */
8191 static void alc885_imac24_init_hook(struct hda_codec *codec)
8193 alc885_macpro_init_hook(codec);
8194 alc_automute_amp(codec);
8198 * generic initialization of ADC, input mixers and output mixers
8200 static struct hda_verb alc883_auto_init_verbs[] = {
8202 * Unmute ADC0-2 and set the default input to mic-in
8204 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8205 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8206 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8207 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8210 * Set up output mixers (0x0c - 0x0f)
8212 /* set vol=0 to output mixers */
8213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8214 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8215 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8216 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8217 /* set up input amps for analog loopback */
8218 /* Amp Indices: DAC = 0, mixer = 1 */
8219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8220 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8221 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8222 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8223 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8224 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8225 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8226 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8227 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8228 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8230 /* FIXME: use matrix-type input source selection */
8231 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8233 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8235 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8239 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8240 static struct hda_verb alc889A_mb31_ch2_init[] = {
8241 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8242 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8243 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8244 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8248 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8249 static struct hda_verb alc889A_mb31_ch4_init[] = {
8250 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8251 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8252 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8253 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8257 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8258 static struct hda_verb alc889A_mb31_ch5_init[] = {
8259 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8260 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8261 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8262 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8266 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8267 static struct hda_verb alc889A_mb31_ch6_init[] = {
8268 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8269 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8275 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8276 { 2, alc889A_mb31_ch2_init },
8277 { 4, alc889A_mb31_ch4_init },
8278 { 5, alc889A_mb31_ch5_init },
8279 { 6, alc889A_mb31_ch6_init },
8282 static struct hda_verb alc883_medion_eapd_verbs[] = {
8283 /* eanable EAPD on medion laptop */
8284 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8285 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8289 #define alc883_base_mixer alc882_base_mixer
8291 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8292 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8293 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8294 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8295 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8296 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8297 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8300 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8302 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8303 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8304 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8308 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8309 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8310 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8311 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8312 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8314 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8316 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8317 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8318 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8322 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8323 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8324 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8325 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8326 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8328 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8329 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8330 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8331 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8332 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8336 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8338 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8340 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8341 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8342 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8343 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8344 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8345 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8346 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8347 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8348 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8349 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8353 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8354 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8355 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8356 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8357 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8358 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8359 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8360 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8361 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8363 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8364 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8365 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8366 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8367 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8368 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8369 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8370 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8371 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8372 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8376 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8377 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8378 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8379 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8380 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8381 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8383 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8384 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8385 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8386 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8389 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8390 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8391 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8392 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8393 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8394 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8395 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8396 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8400 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8401 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8402 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8403 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8404 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8405 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8407 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8408 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8409 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8410 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8411 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8412 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8413 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8414 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8416 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8417 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8418 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8419 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8420 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8424 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8425 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8426 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8427 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8428 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8429 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8430 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8431 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8432 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8433 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8434 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8435 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8436 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8437 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8439 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8441 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8442 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8443 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8447 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8448 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8449 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8450 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8451 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8452 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8453 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8454 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8455 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8456 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8457 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8458 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8459 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8460 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8461 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8463 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8468 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8469 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8471 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8472 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8473 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8474 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8476 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8477 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8478 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8479 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8480 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8484 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8485 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8486 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8487 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8488 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8489 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8493 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8494 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8495 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8496 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8497 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8498 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8500 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8501 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8505 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8506 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8507 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8509 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8510 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8511 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8512 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8513 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8514 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8518 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8519 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8521 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8522 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8523 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8526 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8527 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8531 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8532 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8533 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8535 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8536 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8538 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8543 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8544 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8545 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8546 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8547 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8548 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8549 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8550 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8551 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8553 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8554 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8558 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8559 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8560 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8561 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8562 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8563 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8564 0x0d, 1, 0x0, HDA_OUTPUT),
8565 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8566 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8567 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8568 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8569 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8570 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8571 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8572 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8573 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8574 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8575 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8577 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8578 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8579 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8583 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8585 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8586 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8587 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8588 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8589 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8591 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8592 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8593 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8594 /* Output switches */
8595 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8596 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8597 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8599 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8600 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8603 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8604 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8605 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8609 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8610 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8611 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8612 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8614 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8615 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8619 static struct hda_bind_ctls alc883_bind_cap_vol = {
8620 .ops = &snd_hda_bind_vol,
8622 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8623 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8628 static struct hda_bind_ctls alc883_bind_cap_switch = {
8629 .ops = &snd_hda_bind_sw,
8631 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8632 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8637 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8638 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8639 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8640 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8641 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8642 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8643 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8644 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8645 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8649 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8650 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8651 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8654 /* .name = "Capture Source", */
8655 .name = "Input Source",
8657 .info = alc_mux_enum_info,
8658 .get = alc_mux_enum_get,
8659 .put = alc_mux_enum_put,
8664 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8666 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8667 .name = "Channel Mode",
8668 .info = alc_ch_mode_info,
8669 .get = alc_ch_mode_get,
8670 .put = alc_ch_mode_put,
8675 /* toggle speaker-output according to the hp-jack state */
8676 static void alc883_mitac_setup(struct hda_codec *codec)
8678 struct alc_spec *spec = codec->spec;
8680 spec->autocfg.hp_pins[0] = 0x15;
8681 spec->autocfg.speaker_pins[0] = 0x14;
8682 spec->autocfg.speaker_pins[1] = 0x17;
8685 /* auto-toggle front mic */
8687 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8689 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8691 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8695 static struct hda_verb alc883_mitac_verbs[] = {
8697 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8700 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8701 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8703 /* enable unsolicited event */
8704 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8705 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8710 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8712 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8713 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8715 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8717 /* enable unsolicited event */
8719 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8720 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8726 static struct hda_verb alc883_clevo_m720_verbs[] = {
8728 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8731 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8734 /* enable unsolicited event */
8735 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8736 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8741 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8743 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8744 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8746 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8747 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8749 /* enable unsolicited event */
8750 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8755 static struct hda_verb alc883_targa_verbs[] = {
8756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8759 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8760 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8762 /* Connect Line-Out side jack (SPDIF) to Side */
8763 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8764 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8765 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8766 /* Connect Mic jack to CLFE */
8767 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8768 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8769 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8770 /* Connect Line-in jack to Surround */
8771 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8772 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8773 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8774 /* Connect HP out jack to Front */
8775 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8776 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8777 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8779 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8784 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8785 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8786 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8787 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8791 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8792 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8793 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8794 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8799 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8801 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8802 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8803 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8804 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8808 static struct hda_verb alc883_haier_w66_verbs[] = {
8809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8812 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8814 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8815 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8816 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8817 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8821 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8825 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8826 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8827 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8828 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8829 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8833 static struct hda_verb alc888_6st_dell_verbs[] = {
8834 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8838 static struct hda_verb alc883_vaiott_verbs[] = {
8840 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8841 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8843 /* enable unsolicited event */
8844 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8849 static void alc888_3st_hp_setup(struct hda_codec *codec)
8851 struct alc_spec *spec = codec->spec;
8853 spec->autocfg.hp_pins[0] = 0x1b;
8854 spec->autocfg.speaker_pins[0] = 0x14;
8855 spec->autocfg.speaker_pins[1] = 0x16;
8856 spec->autocfg.speaker_pins[2] = 0x18;
8859 static struct hda_verb alc888_3st_hp_verbs[] = {
8860 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8861 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8862 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8863 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8870 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8871 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8872 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8873 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8874 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8881 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8882 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8883 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8884 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8885 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8886 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8893 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8894 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8895 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8896 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8897 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8898 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8899 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8903 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8904 { 2, alc888_3st_hp_2ch_init },
8905 { 4, alc888_3st_hp_4ch_init },
8906 { 6, alc888_3st_hp_6ch_init },
8909 /* toggle front-jack and RCA according to the hp-jack state */
8910 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8912 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8914 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8915 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8916 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8917 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8920 /* toggle RCA according to the front-jack state */
8921 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8923 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8925 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8926 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8929 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8932 if ((res >> 26) == ALC880_HP_EVENT)
8933 alc888_lenovo_ms7195_front_automute(codec);
8934 if ((res >> 26) == ALC880_FRONT_EVENT)
8935 alc888_lenovo_ms7195_rca_automute(codec);
8938 static struct hda_verb alc883_medion_md2_verbs[] = {
8939 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8940 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8942 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8944 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8948 /* toggle speaker-output according to the hp-jack state */
8949 static void alc883_medion_md2_setup(struct hda_codec *codec)
8951 struct alc_spec *spec = codec->spec;
8953 spec->autocfg.hp_pins[0] = 0x14;
8954 spec->autocfg.speaker_pins[0] = 0x15;
8957 /* toggle speaker-output according to the hp-jack state */
8958 #define alc883_targa_init_hook alc882_targa_init_hook
8959 #define alc883_targa_unsol_event alc882_targa_unsol_event
8961 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8963 unsigned int present;
8965 present = snd_hda_jack_detect(codec, 0x18);
8966 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8967 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8970 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8972 struct alc_spec *spec = codec->spec;
8974 spec->autocfg.hp_pins[0] = 0x15;
8975 spec->autocfg.speaker_pins[0] = 0x14;
8978 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8980 alc_automute_amp(codec);
8981 alc883_clevo_m720_mic_automute(codec);
8984 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8987 switch (res >> 26) {
8988 case ALC880_MIC_EVENT:
8989 alc883_clevo_m720_mic_automute(codec);
8992 alc_automute_amp_unsol_event(codec, res);
8997 /* toggle speaker-output according to the hp-jack state */
8998 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9000 struct alc_spec *spec = codec->spec;
9002 spec->autocfg.hp_pins[0] = 0x14;
9003 spec->autocfg.speaker_pins[0] = 0x15;
9006 static void alc883_haier_w66_setup(struct hda_codec *codec)
9008 struct alc_spec *spec = codec->spec;
9010 spec->autocfg.hp_pins[0] = 0x1b;
9011 spec->autocfg.speaker_pins[0] = 0x14;
9014 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9016 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9018 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9019 HDA_AMP_MUTE, bits);
9022 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9024 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9026 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9027 HDA_AMP_MUTE, bits);
9028 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9029 HDA_AMP_MUTE, bits);
9032 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9035 if ((res >> 26) == ALC880_HP_EVENT)
9036 alc883_lenovo_101e_all_automute(codec);
9037 if ((res >> 26) == ALC880_FRONT_EVENT)
9038 alc883_lenovo_101e_ispeaker_automute(codec);
9041 /* toggle speaker-output according to the hp-jack state */
9042 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9044 struct alc_spec *spec = codec->spec;
9046 spec->autocfg.hp_pins[0] = 0x14;
9047 spec->autocfg.speaker_pins[0] = 0x15;
9048 spec->autocfg.speaker_pins[1] = 0x16;
9051 static struct hda_verb alc883_acer_eapd_verbs[] = {
9052 /* HP Pin: output 0 (0x0c) */
9053 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9054 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9055 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9056 /* Front Pin: output 0 (0x0c) */
9057 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9058 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9059 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9060 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9061 /* eanable EAPD on medion laptop */
9062 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9063 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9064 /* enable unsolicited event */
9065 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9069 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9070 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9071 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9072 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9076 static void alc888_6st_dell_setup(struct hda_codec *codec)
9078 struct alc_spec *spec = codec->spec;
9080 spec->autocfg.hp_pins[0] = 0x1b;
9081 spec->autocfg.speaker_pins[0] = 0x14;
9082 spec->autocfg.speaker_pins[1] = 0x15;
9083 spec->autocfg.speaker_pins[2] = 0x16;
9084 spec->autocfg.speaker_pins[3] = 0x17;
9087 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9089 struct alc_spec *spec = codec->spec;
9091 spec->autocfg.hp_pins[0] = 0x1b;
9092 spec->autocfg.speaker_pins[0] = 0x14;
9093 spec->autocfg.speaker_pins[1] = 0x15;
9094 spec->autocfg.speaker_pins[2] = 0x16;
9095 spec->autocfg.speaker_pins[3] = 0x17;
9096 spec->autocfg.speaker_pins[4] = 0x1a;
9099 static void alc883_vaiott_setup(struct hda_codec *codec)
9101 struct alc_spec *spec = codec->spec;
9103 spec->autocfg.hp_pins[0] = 0x15;
9104 spec->autocfg.speaker_pins[0] = 0x14;
9105 spec->autocfg.speaker_pins[1] = 0x17;
9108 static struct hda_verb alc888_asus_m90v_verbs[] = {
9109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9110 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9112 /* enable unsolicited event */
9113 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9114 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9118 static void alc883_mode2_setup(struct hda_codec *codec)
9120 struct alc_spec *spec = codec->spec;
9122 spec->autocfg.hp_pins[0] = 0x1b;
9123 spec->autocfg.speaker_pins[0] = 0x14;
9124 spec->autocfg.speaker_pins[1] = 0x15;
9125 spec->autocfg.speaker_pins[2] = 0x16;
9126 spec->ext_mic.pin = 0x18;
9127 spec->int_mic.pin = 0x19;
9128 spec->ext_mic.mux_idx = 0;
9129 spec->int_mic.mux_idx = 1;
9133 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9134 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9135 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9136 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9137 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9138 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9139 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9140 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9141 /* enable unsolicited event */
9142 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9146 static void alc883_eee1601_inithook(struct hda_codec *codec)
9148 struct alc_spec *spec = codec->spec;
9150 spec->autocfg.hp_pins[0] = 0x14;
9151 spec->autocfg.speaker_pins[0] = 0x1b;
9152 alc_automute_pin(codec);
9155 static struct hda_verb alc889A_mb31_verbs[] = {
9156 /* Init rear pin (used as headphone output) */
9157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9158 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9159 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9160 /* Init line pin (used as output in 4ch and 6ch mode) */
9161 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9162 /* Init line 2 pin (used as headphone out by default) */
9163 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9164 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9168 /* Mute speakers according to the headphone jack state */
9169 static void alc889A_mb31_automute(struct hda_codec *codec)
9171 unsigned int present;
9173 /* Mute only in 2ch or 4ch mode */
9174 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9176 present = snd_hda_jack_detect(codec, 0x15);
9177 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9178 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9179 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9180 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9184 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9186 if ((res >> 26) == ALC880_HP_EVENT)
9187 alc889A_mb31_automute(codec);
9191 #ifdef CONFIG_SND_HDA_POWER_SAVE
9192 #define alc882_loopbacks alc880_loopbacks
9195 /* pcm configuration: identical with ALC880 */
9196 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9197 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9198 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9199 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9201 static hda_nid_t alc883_slave_dig_outs[] = {
9202 ALC1200_DIGOUT_NID, 0,
9205 static hda_nid_t alc1200_slave_dig_outs[] = {
9206 ALC883_DIGOUT_NID, 0,
9210 * configuration and preset
9212 static const char *alc882_models[ALC882_MODEL_LAST] = {
9213 [ALC882_3ST_DIG] = "3stack-dig",
9214 [ALC882_6ST_DIG] = "6stack-dig",
9215 [ALC882_ARIMA] = "arima",
9216 [ALC882_W2JC] = "w2jc",
9217 [ALC882_TARGA] = "targa",
9218 [ALC882_ASUS_A7J] = "asus-a7j",
9219 [ALC882_ASUS_A7M] = "asus-a7m",
9220 [ALC885_MACPRO] = "macpro",
9221 [ALC885_MB5] = "mb5",
9222 [ALC885_MACMINI3] = "macmini3",
9223 [ALC885_MBA21] = "mba21",
9224 [ALC885_MBP3] = "mbp3",
9225 [ALC885_IMAC24] = "imac24",
9226 [ALC885_IMAC91] = "imac91",
9227 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9228 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9229 [ALC883_3ST_6ch] = "3stack-6ch",
9230 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9231 [ALC883_TARGA_DIG] = "targa-dig",
9232 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9233 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9234 [ALC883_ACER] = "acer",
9235 [ALC883_ACER_ASPIRE] = "acer-aspire",
9236 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9237 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9238 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9239 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9240 [ALC883_MEDION] = "medion",
9241 [ALC883_MEDION_MD2] = "medion-md2",
9242 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9243 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9244 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9245 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9246 [ALC888_LENOVO_SKY] = "lenovo-sky",
9247 [ALC883_HAIER_W66] = "haier-w66",
9248 [ALC888_3ST_HP] = "3stack-hp",
9249 [ALC888_6ST_DELL] = "6stack-dell",
9250 [ALC883_MITAC] = "mitac",
9251 [ALC883_CLEVO_M540R] = "clevo-m540r",
9252 [ALC883_CLEVO_M720] = "clevo-m720",
9253 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9254 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9255 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9256 [ALC889A_INTEL] = "intel-alc889a",
9257 [ALC889_INTEL] = "intel-x58",
9258 [ALC1200_ASUS_P5Q] = "asus-p5q",
9259 [ALC889A_MB31] = "mb31",
9260 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9261 [ALC882_AUTO] = "auto",
9264 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9265 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9267 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9268 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9269 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9270 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9271 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9272 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9273 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9274 ALC888_ACER_ASPIRE_4930G),
9275 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9276 ALC888_ACER_ASPIRE_4930G),
9277 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9278 ALC888_ACER_ASPIRE_8930G),
9279 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9280 ALC888_ACER_ASPIRE_8930G),
9281 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9282 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9283 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9284 ALC888_ACER_ASPIRE_6530G),
9285 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9286 ALC888_ACER_ASPIRE_6530G),
9287 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9288 ALC888_ACER_ASPIRE_7730G),
9289 /* default Acer -- disabled as it causes more problems.
9290 * model=auto should work fine now
9292 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9294 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9296 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9297 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9298 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9299 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9300 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9301 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9303 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9304 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9305 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9306 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9307 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9308 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9309 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9310 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9311 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9312 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9313 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9315 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9316 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9317 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9318 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9319 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9320 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9321 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9322 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9323 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9325 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9326 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9327 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9328 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9329 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9330 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9331 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9332 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9333 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9334 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9335 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9336 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9337 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9338 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9339 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9340 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9341 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9342 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9343 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9344 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9345 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9346 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9347 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9348 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9349 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9350 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9351 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9352 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9353 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9354 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9355 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9357 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9358 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9359 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9360 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9361 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9362 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9363 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9364 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9365 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9366 ALC883_FUJITSU_PI2515),
9367 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9368 ALC888_FUJITSU_XA3530),
9369 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9370 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9371 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9372 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9373 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9374 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9375 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9376 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9377 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9379 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9380 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9381 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9382 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9383 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9384 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9385 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9390 /* codec SSID table for Intel Mac */
9391 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9392 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9393 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9394 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9395 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9396 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9397 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9398 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9399 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9400 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9401 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9402 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9403 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9404 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9405 * so apparently no perfect solution yet
9407 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9408 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9409 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9413 static struct alc_config_preset alc882_presets[] = {
9414 [ALC882_3ST_DIG] = {
9415 .mixers = { alc882_base_mixer },
9416 .init_verbs = { alc882_base_init_verbs,
9417 alc882_adc1_init_verbs },
9418 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9419 .dac_nids = alc882_dac_nids,
9420 .dig_out_nid = ALC882_DIGOUT_NID,
9421 .dig_in_nid = ALC882_DIGIN_NID,
9422 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9423 .channel_mode = alc882_ch_modes,
9425 .input_mux = &alc882_capture_source,
9427 [ALC882_6ST_DIG] = {
9428 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9429 .init_verbs = { alc882_base_init_verbs,
9430 alc882_adc1_init_verbs },
9431 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9432 .dac_nids = alc882_dac_nids,
9433 .dig_out_nid = ALC882_DIGOUT_NID,
9434 .dig_in_nid = ALC882_DIGIN_NID,
9435 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9436 .channel_mode = alc882_sixstack_modes,
9437 .input_mux = &alc882_capture_source,
9440 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9441 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9442 alc882_eapd_verbs },
9443 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9444 .dac_nids = alc882_dac_nids,
9445 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9446 .channel_mode = alc882_sixstack_modes,
9447 .input_mux = &alc882_capture_source,
9450 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9451 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9452 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9453 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9454 .dac_nids = alc882_dac_nids,
9455 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9456 .channel_mode = alc880_threestack_modes,
9458 .input_mux = &alc882_capture_source,
9459 .dig_out_nid = ALC882_DIGOUT_NID,
9462 .mixers = { alc885_mba21_mixer },
9463 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9465 .dac_nids = alc882_dac_nids,
9466 .channel_mode = alc885_mba21_ch_modes,
9467 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9468 .input_mux = &alc882_capture_source,
9469 .unsol_event = alc_automute_amp_unsol_event,
9470 .setup = alc885_mba21_setup,
9471 .init_hook = alc_automute_amp,
9474 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9475 .init_verbs = { alc885_mbp3_init_verbs,
9476 alc880_gpio1_init_verbs },
9478 .dac_nids = alc882_dac_nids,
9480 .channel_mode = alc885_mbp_4ch_modes,
9481 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9482 .input_mux = &alc882_capture_source,
9483 .dig_out_nid = ALC882_DIGOUT_NID,
9484 .dig_in_nid = ALC882_DIGIN_NID,
9485 .unsol_event = alc_automute_amp_unsol_event,
9486 .setup = alc885_mbp3_setup,
9487 .init_hook = alc_automute_amp,
9490 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9491 .init_verbs = { alc885_mb5_init_verbs,
9492 alc880_gpio1_init_verbs },
9493 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9494 .dac_nids = alc882_dac_nids,
9495 .channel_mode = alc885_mb5_6ch_modes,
9496 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9497 .input_mux = &mb5_capture_source,
9498 .dig_out_nid = ALC882_DIGOUT_NID,
9499 .dig_in_nid = ALC882_DIGIN_NID,
9500 .unsol_event = alc_automute_amp_unsol_event,
9501 .setup = alc885_mb5_setup,
9502 .init_hook = alc_automute_amp,
9504 [ALC885_MACMINI3] = {
9505 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9506 .init_verbs = { alc885_macmini3_init_verbs,
9507 alc880_gpio1_init_verbs },
9508 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9509 .dac_nids = alc882_dac_nids,
9510 .channel_mode = alc885_macmini3_6ch_modes,
9511 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9512 .input_mux = &macmini3_capture_source,
9513 .dig_out_nid = ALC882_DIGOUT_NID,
9514 .dig_in_nid = ALC882_DIGIN_NID,
9515 .unsol_event = alc_automute_amp_unsol_event,
9516 .setup = alc885_macmini3_setup,
9517 .init_hook = alc_automute_amp,
9520 .mixers = { alc882_macpro_mixer },
9521 .init_verbs = { alc882_macpro_init_verbs },
9522 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9523 .dac_nids = alc882_dac_nids,
9524 .dig_out_nid = ALC882_DIGOUT_NID,
9525 .dig_in_nid = ALC882_DIGIN_NID,
9526 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9527 .channel_mode = alc882_ch_modes,
9528 .input_mux = &alc882_capture_source,
9529 .init_hook = alc885_macpro_init_hook,
9532 .mixers = { alc885_imac24_mixer },
9533 .init_verbs = { alc885_imac24_init_verbs },
9534 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9535 .dac_nids = alc882_dac_nids,
9536 .dig_out_nid = ALC882_DIGOUT_NID,
9537 .dig_in_nid = ALC882_DIGIN_NID,
9538 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9539 .channel_mode = alc882_ch_modes,
9540 .input_mux = &alc882_capture_source,
9541 .unsol_event = alc_automute_amp_unsol_event,
9542 .setup = alc885_imac24_setup,
9543 .init_hook = alc885_imac24_init_hook,
9546 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9547 .init_verbs = { alc885_imac91_init_verbs,
9548 alc880_gpio1_init_verbs },
9549 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9550 .dac_nids = alc882_dac_nids,
9551 .channel_mode = alc885_mbp_4ch_modes,
9552 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9553 .input_mux = &alc882_capture_source,
9554 .dig_out_nid = ALC882_DIGOUT_NID,
9555 .dig_in_nid = ALC882_DIGIN_NID,
9556 .unsol_event = alc_automute_amp_unsol_event,
9557 .setup = alc885_imac91_setup,
9558 .init_hook = alc_automute_amp,
9561 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9562 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9563 alc880_gpio3_init_verbs, alc882_targa_verbs},
9564 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9565 .dac_nids = alc882_dac_nids,
9566 .dig_out_nid = ALC882_DIGOUT_NID,
9567 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9568 .adc_nids = alc882_adc_nids,
9569 .capsrc_nids = alc882_capsrc_nids,
9570 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9571 .channel_mode = alc882_3ST_6ch_modes,
9573 .input_mux = &alc882_capture_source,
9574 .unsol_event = alc882_targa_unsol_event,
9575 .setup = alc882_targa_setup,
9576 .init_hook = alc882_targa_automute,
9578 [ALC882_ASUS_A7J] = {
9579 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9580 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9581 alc882_asus_a7j_verbs},
9582 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9583 .dac_nids = alc882_dac_nids,
9584 .dig_out_nid = ALC882_DIGOUT_NID,
9585 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9586 .adc_nids = alc882_adc_nids,
9587 .capsrc_nids = alc882_capsrc_nids,
9588 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9589 .channel_mode = alc882_3ST_6ch_modes,
9591 .input_mux = &alc882_capture_source,
9593 [ALC882_ASUS_A7M] = {
9594 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9595 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9596 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9597 alc882_asus_a7m_verbs },
9598 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9599 .dac_nids = alc882_dac_nids,
9600 .dig_out_nid = ALC882_DIGOUT_NID,
9601 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9602 .channel_mode = alc880_threestack_modes,
9604 .input_mux = &alc882_capture_source,
9606 [ALC883_3ST_2ch_DIG] = {
9607 .mixers = { alc883_3ST_2ch_mixer },
9608 .init_verbs = { alc883_init_verbs },
9609 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9610 .dac_nids = alc883_dac_nids,
9611 .dig_out_nid = ALC883_DIGOUT_NID,
9612 .dig_in_nid = ALC883_DIGIN_NID,
9613 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9614 .channel_mode = alc883_3ST_2ch_modes,
9615 .input_mux = &alc883_capture_source,
9617 [ALC883_3ST_6ch_DIG] = {
9618 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9619 .init_verbs = { alc883_init_verbs },
9620 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9621 .dac_nids = alc883_dac_nids,
9622 .dig_out_nid = ALC883_DIGOUT_NID,
9623 .dig_in_nid = ALC883_DIGIN_NID,
9624 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9625 .channel_mode = alc883_3ST_6ch_modes,
9627 .input_mux = &alc883_capture_source,
9629 [ALC883_3ST_6ch] = {
9630 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9631 .init_verbs = { alc883_init_verbs },
9632 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9633 .dac_nids = alc883_dac_nids,
9634 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9635 .channel_mode = alc883_3ST_6ch_modes,
9637 .input_mux = &alc883_capture_source,
9639 [ALC883_3ST_6ch_INTEL] = {
9640 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9641 .init_verbs = { alc883_init_verbs },
9642 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9643 .dac_nids = alc883_dac_nids,
9644 .dig_out_nid = ALC883_DIGOUT_NID,
9645 .dig_in_nid = ALC883_DIGIN_NID,
9646 .slave_dig_outs = alc883_slave_dig_outs,
9647 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9648 .channel_mode = alc883_3ST_6ch_intel_modes,
9650 .input_mux = &alc883_3stack_6ch_intel,
9653 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9654 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9655 alc_hp15_unsol_verbs },
9656 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9657 .dac_nids = alc883_dac_nids,
9658 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9659 .adc_nids = alc889_adc_nids,
9660 .dig_out_nid = ALC883_DIGOUT_NID,
9661 .dig_in_nid = ALC883_DIGIN_NID,
9662 .slave_dig_outs = alc883_slave_dig_outs,
9663 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9664 .channel_mode = alc889_8ch_intel_modes,
9665 .capsrc_nids = alc889_capsrc_nids,
9666 .input_mux = &alc889_capture_source,
9667 .setup = alc889_automute_setup,
9668 .init_hook = alc_automute_amp,
9669 .unsol_event = alc_automute_amp_unsol_event,
9673 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9674 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9675 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9676 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9677 .dac_nids = alc883_dac_nids,
9678 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9679 .adc_nids = alc889_adc_nids,
9680 .dig_out_nid = ALC883_DIGOUT_NID,
9681 .dig_in_nid = ALC883_DIGIN_NID,
9682 .slave_dig_outs = alc883_slave_dig_outs,
9683 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9684 .channel_mode = alc889_8ch_intel_modes,
9685 .capsrc_nids = alc889_capsrc_nids,
9686 .input_mux = &alc889_capture_source,
9687 .setup = alc889_automute_setup,
9688 .init_hook = alc889_intel_init_hook,
9689 .unsol_event = alc_automute_amp_unsol_event,
9692 [ALC883_6ST_DIG] = {
9693 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9694 .init_verbs = { alc883_init_verbs },
9695 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9696 .dac_nids = alc883_dac_nids,
9697 .dig_out_nid = ALC883_DIGOUT_NID,
9698 .dig_in_nid = ALC883_DIGIN_NID,
9699 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9700 .channel_mode = alc883_sixstack_modes,
9701 .input_mux = &alc883_capture_source,
9703 [ALC883_TARGA_DIG] = {
9704 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9705 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9706 alc883_targa_verbs},
9707 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9708 .dac_nids = alc883_dac_nids,
9709 .dig_out_nid = ALC883_DIGOUT_NID,
9710 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9711 .channel_mode = alc883_3ST_6ch_modes,
9713 .input_mux = &alc883_capture_source,
9714 .unsol_event = alc883_targa_unsol_event,
9715 .setup = alc882_targa_setup,
9716 .init_hook = alc882_targa_automute,
9718 [ALC883_TARGA_2ch_DIG] = {
9719 .mixers = { alc883_targa_2ch_mixer},
9720 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9721 alc883_targa_verbs},
9722 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9723 .dac_nids = alc883_dac_nids,
9724 .adc_nids = alc883_adc_nids_alt,
9725 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9726 .capsrc_nids = alc883_capsrc_nids,
9727 .dig_out_nid = ALC883_DIGOUT_NID,
9728 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9729 .channel_mode = alc883_3ST_2ch_modes,
9730 .input_mux = &alc883_capture_source,
9731 .unsol_event = alc883_targa_unsol_event,
9732 .setup = alc882_targa_setup,
9733 .init_hook = alc882_targa_automute,
9735 [ALC883_TARGA_8ch_DIG] = {
9736 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9737 alc883_chmode_mixer },
9738 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9739 alc883_targa_verbs },
9740 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9741 .dac_nids = alc883_dac_nids,
9742 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9743 .adc_nids = alc883_adc_nids_rev,
9744 .capsrc_nids = alc883_capsrc_nids_rev,
9745 .dig_out_nid = ALC883_DIGOUT_NID,
9746 .dig_in_nid = ALC883_DIGIN_NID,
9747 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9748 .channel_mode = alc883_4ST_8ch_modes,
9750 .input_mux = &alc883_capture_source,
9751 .unsol_event = alc883_targa_unsol_event,
9752 .setup = alc882_targa_setup,
9753 .init_hook = alc882_targa_automute,
9756 .mixers = { alc883_base_mixer },
9757 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9758 * and the headphone jack. Turn this on and rely on the
9759 * standard mute methods whenever the user wants to turn
9760 * these outputs off.
9762 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9763 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9764 .dac_nids = alc883_dac_nids,
9765 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9766 .channel_mode = alc883_3ST_2ch_modes,
9767 .input_mux = &alc883_capture_source,
9769 [ALC883_ACER_ASPIRE] = {
9770 .mixers = { alc883_acer_aspire_mixer },
9771 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9772 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9773 .dac_nids = alc883_dac_nids,
9774 .dig_out_nid = ALC883_DIGOUT_NID,
9775 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9776 .channel_mode = alc883_3ST_2ch_modes,
9777 .input_mux = &alc883_capture_source,
9778 .unsol_event = alc_automute_amp_unsol_event,
9779 .setup = alc883_acer_aspire_setup,
9780 .init_hook = alc_automute_amp,
9782 [ALC888_ACER_ASPIRE_4930G] = {
9783 .mixers = { alc888_base_mixer,
9784 alc883_chmode_mixer },
9785 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9786 alc888_acer_aspire_4930g_verbs },
9787 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9788 .dac_nids = alc883_dac_nids,
9789 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9790 .adc_nids = alc883_adc_nids_rev,
9791 .capsrc_nids = alc883_capsrc_nids_rev,
9792 .dig_out_nid = ALC883_DIGOUT_NID,
9793 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9794 .channel_mode = alc883_3ST_6ch_modes,
9796 .const_channel_count = 6,
9798 ARRAY_SIZE(alc888_2_capture_sources),
9799 .input_mux = alc888_2_capture_sources,
9800 .unsol_event = alc_automute_amp_unsol_event,
9801 .setup = alc888_acer_aspire_4930g_setup,
9802 .init_hook = alc_automute_amp,
9804 [ALC888_ACER_ASPIRE_6530G] = {
9805 .mixers = { alc888_acer_aspire_6530_mixer },
9806 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9807 alc888_acer_aspire_6530g_verbs },
9808 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9809 .dac_nids = alc883_dac_nids,
9810 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9811 .adc_nids = alc883_adc_nids_rev,
9812 .capsrc_nids = alc883_capsrc_nids_rev,
9813 .dig_out_nid = ALC883_DIGOUT_NID,
9814 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9815 .channel_mode = alc883_3ST_2ch_modes,
9817 ARRAY_SIZE(alc888_2_capture_sources),
9818 .input_mux = alc888_acer_aspire_6530_sources,
9819 .unsol_event = alc_automute_amp_unsol_event,
9820 .setup = alc888_acer_aspire_6530g_setup,
9821 .init_hook = alc_automute_amp,
9823 [ALC888_ACER_ASPIRE_8930G] = {
9824 .mixers = { alc889_acer_aspire_8930g_mixer,
9825 alc883_chmode_mixer },
9826 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9827 alc889_acer_aspire_8930g_verbs,
9829 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9830 .dac_nids = alc883_dac_nids,
9831 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9832 .adc_nids = alc889_adc_nids,
9833 .capsrc_nids = alc889_capsrc_nids,
9834 .dig_out_nid = ALC883_DIGOUT_NID,
9835 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9836 .channel_mode = alc883_3ST_6ch_modes,
9838 .const_channel_count = 6,
9840 ARRAY_SIZE(alc889_capture_sources),
9841 .input_mux = alc889_capture_sources,
9842 .unsol_event = alc_automute_amp_unsol_event,
9843 .setup = alc889_acer_aspire_8930g_setup,
9844 .init_hook = alc_automute_amp,
9845 #ifdef CONFIG_SND_HDA_POWER_SAVE
9846 .power_hook = alc_power_eapd,
9849 [ALC888_ACER_ASPIRE_7730G] = {
9850 .mixers = { alc883_3ST_6ch_mixer,
9851 alc883_chmode_mixer },
9852 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9853 alc888_acer_aspire_7730G_verbs },
9854 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9855 .dac_nids = alc883_dac_nids,
9856 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9857 .adc_nids = alc883_adc_nids_rev,
9858 .capsrc_nids = alc883_capsrc_nids_rev,
9859 .dig_out_nid = ALC883_DIGOUT_NID,
9860 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9861 .channel_mode = alc883_3ST_6ch_modes,
9863 .const_channel_count = 6,
9864 .input_mux = &alc883_capture_source,
9865 .unsol_event = alc_automute_amp_unsol_event,
9866 .setup = alc888_acer_aspire_6530g_setup,
9867 .init_hook = alc_automute_amp,
9870 .mixers = { alc883_fivestack_mixer,
9871 alc883_chmode_mixer },
9872 .init_verbs = { alc883_init_verbs,
9873 alc883_medion_eapd_verbs },
9874 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9875 .dac_nids = alc883_dac_nids,
9876 .adc_nids = alc883_adc_nids_alt,
9877 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9878 .capsrc_nids = alc883_capsrc_nids,
9879 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9880 .channel_mode = alc883_sixstack_modes,
9881 .input_mux = &alc883_capture_source,
9883 [ALC883_MEDION_MD2] = {
9884 .mixers = { alc883_medion_md2_mixer},
9885 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9886 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9887 .dac_nids = alc883_dac_nids,
9888 .dig_out_nid = ALC883_DIGOUT_NID,
9889 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9890 .channel_mode = alc883_3ST_2ch_modes,
9891 .input_mux = &alc883_capture_source,
9892 .unsol_event = alc_automute_amp_unsol_event,
9893 .setup = alc883_medion_md2_setup,
9894 .init_hook = alc_automute_amp,
9896 [ALC883_LAPTOP_EAPD] = {
9897 .mixers = { alc883_base_mixer },
9898 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9899 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9900 .dac_nids = alc883_dac_nids,
9901 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9902 .channel_mode = alc883_3ST_2ch_modes,
9903 .input_mux = &alc883_capture_source,
9905 [ALC883_CLEVO_M540R] = {
9906 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9907 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9908 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9909 .dac_nids = alc883_dac_nids,
9910 .dig_out_nid = ALC883_DIGOUT_NID,
9911 .dig_in_nid = ALC883_DIGIN_NID,
9912 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9913 .channel_mode = alc883_3ST_6ch_clevo_modes,
9915 .input_mux = &alc883_capture_source,
9916 /* This machine has the hardware HP auto-muting, thus
9917 * we need no software mute via unsol event
9920 [ALC883_CLEVO_M720] = {
9921 .mixers = { alc883_clevo_m720_mixer },
9922 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9923 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9924 .dac_nids = alc883_dac_nids,
9925 .dig_out_nid = ALC883_DIGOUT_NID,
9926 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9927 .channel_mode = alc883_3ST_2ch_modes,
9928 .input_mux = &alc883_capture_source,
9929 .unsol_event = alc883_clevo_m720_unsol_event,
9930 .setup = alc883_clevo_m720_setup,
9931 .init_hook = alc883_clevo_m720_init_hook,
9933 [ALC883_LENOVO_101E_2ch] = {
9934 .mixers = { alc883_lenovo_101e_2ch_mixer},
9935 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9936 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9937 .dac_nids = alc883_dac_nids,
9938 .adc_nids = alc883_adc_nids_alt,
9939 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9940 .capsrc_nids = alc883_capsrc_nids,
9941 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9942 .channel_mode = alc883_3ST_2ch_modes,
9943 .input_mux = &alc883_lenovo_101e_capture_source,
9944 .unsol_event = alc883_lenovo_101e_unsol_event,
9945 .init_hook = alc883_lenovo_101e_all_automute,
9947 [ALC883_LENOVO_NB0763] = {
9948 .mixers = { alc883_lenovo_nb0763_mixer },
9949 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9950 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9951 .dac_nids = alc883_dac_nids,
9952 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9953 .channel_mode = alc883_3ST_2ch_modes,
9955 .input_mux = &alc883_lenovo_nb0763_capture_source,
9956 .unsol_event = alc_automute_amp_unsol_event,
9957 .setup = alc883_medion_md2_setup,
9958 .init_hook = alc_automute_amp,
9960 [ALC888_LENOVO_MS7195_DIG] = {
9961 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9962 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9963 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9964 .dac_nids = alc883_dac_nids,
9965 .dig_out_nid = ALC883_DIGOUT_NID,
9966 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9967 .channel_mode = alc883_3ST_6ch_modes,
9969 .input_mux = &alc883_capture_source,
9970 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9971 .init_hook = alc888_lenovo_ms7195_front_automute,
9973 [ALC883_HAIER_W66] = {
9974 .mixers = { alc883_targa_2ch_mixer},
9975 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9976 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9977 .dac_nids = alc883_dac_nids,
9978 .dig_out_nid = ALC883_DIGOUT_NID,
9979 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9980 .channel_mode = alc883_3ST_2ch_modes,
9981 .input_mux = &alc883_capture_source,
9982 .unsol_event = alc_automute_amp_unsol_event,
9983 .setup = alc883_haier_w66_setup,
9984 .init_hook = alc_automute_amp,
9987 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9988 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9989 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9990 .dac_nids = alc883_dac_nids,
9991 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9992 .channel_mode = alc888_3st_hp_modes,
9994 .input_mux = &alc883_capture_source,
9995 .unsol_event = alc_automute_amp_unsol_event,
9996 .setup = alc888_3st_hp_setup,
9997 .init_hook = alc_automute_amp,
9999 [ALC888_6ST_DELL] = {
10000 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10001 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10002 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10003 .dac_nids = alc883_dac_nids,
10004 .dig_out_nid = ALC883_DIGOUT_NID,
10005 .dig_in_nid = ALC883_DIGIN_NID,
10006 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10007 .channel_mode = alc883_sixstack_modes,
10008 .input_mux = &alc883_capture_source,
10009 .unsol_event = alc_automute_amp_unsol_event,
10010 .setup = alc888_6st_dell_setup,
10011 .init_hook = alc_automute_amp,
10014 .mixers = { alc883_mitac_mixer },
10015 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10016 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10017 .dac_nids = alc883_dac_nids,
10018 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10019 .channel_mode = alc883_3ST_2ch_modes,
10020 .input_mux = &alc883_capture_source,
10021 .unsol_event = alc_automute_amp_unsol_event,
10022 .setup = alc883_mitac_setup,
10023 .init_hook = alc_automute_amp,
10025 [ALC883_FUJITSU_PI2515] = {
10026 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10027 .init_verbs = { alc883_init_verbs,
10028 alc883_2ch_fujitsu_pi2515_verbs},
10029 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10030 .dac_nids = alc883_dac_nids,
10031 .dig_out_nid = ALC883_DIGOUT_NID,
10032 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10033 .channel_mode = alc883_3ST_2ch_modes,
10034 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10035 .unsol_event = alc_automute_amp_unsol_event,
10036 .setup = alc883_2ch_fujitsu_pi2515_setup,
10037 .init_hook = alc_automute_amp,
10039 [ALC888_FUJITSU_XA3530] = {
10040 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10041 .init_verbs = { alc883_init_verbs,
10042 alc888_fujitsu_xa3530_verbs },
10043 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10044 .dac_nids = alc883_dac_nids,
10045 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10046 .adc_nids = alc883_adc_nids_rev,
10047 .capsrc_nids = alc883_capsrc_nids_rev,
10048 .dig_out_nid = ALC883_DIGOUT_NID,
10049 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10050 .channel_mode = alc888_4ST_8ch_intel_modes,
10052 ARRAY_SIZE(alc888_2_capture_sources),
10053 .input_mux = alc888_2_capture_sources,
10054 .unsol_event = alc_automute_amp_unsol_event,
10055 .setup = alc888_fujitsu_xa3530_setup,
10056 .init_hook = alc_automute_amp,
10058 [ALC888_LENOVO_SKY] = {
10059 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10060 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10061 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10062 .dac_nids = alc883_dac_nids,
10063 .dig_out_nid = ALC883_DIGOUT_NID,
10064 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10065 .channel_mode = alc883_sixstack_modes,
10067 .input_mux = &alc883_lenovo_sky_capture_source,
10068 .unsol_event = alc_automute_amp_unsol_event,
10069 .setup = alc888_lenovo_sky_setup,
10070 .init_hook = alc_automute_amp,
10072 [ALC888_ASUS_M90V] = {
10073 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10074 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10075 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10076 .dac_nids = alc883_dac_nids,
10077 .dig_out_nid = ALC883_DIGOUT_NID,
10078 .dig_in_nid = ALC883_DIGIN_NID,
10079 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10080 .channel_mode = alc883_3ST_6ch_modes,
10082 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10083 .unsol_event = alc_sku_unsol_event,
10084 .setup = alc883_mode2_setup,
10085 .init_hook = alc_inithook,
10087 [ALC888_ASUS_EEE1601] = {
10088 .mixers = { alc883_asus_eee1601_mixer },
10089 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10090 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10091 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10092 .dac_nids = alc883_dac_nids,
10093 .dig_out_nid = ALC883_DIGOUT_NID,
10094 .dig_in_nid = ALC883_DIGIN_NID,
10095 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10096 .channel_mode = alc883_3ST_2ch_modes,
10098 .input_mux = &alc883_asus_eee1601_capture_source,
10099 .unsol_event = alc_sku_unsol_event,
10100 .init_hook = alc883_eee1601_inithook,
10102 [ALC1200_ASUS_P5Q] = {
10103 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10104 .init_verbs = { alc883_init_verbs },
10105 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10106 .dac_nids = alc883_dac_nids,
10107 .dig_out_nid = ALC1200_DIGOUT_NID,
10108 .dig_in_nid = ALC883_DIGIN_NID,
10109 .slave_dig_outs = alc1200_slave_dig_outs,
10110 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10111 .channel_mode = alc883_sixstack_modes,
10112 .input_mux = &alc883_capture_source,
10115 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10116 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10117 alc880_gpio1_init_verbs },
10118 .adc_nids = alc883_adc_nids,
10119 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10120 .capsrc_nids = alc883_capsrc_nids,
10121 .dac_nids = alc883_dac_nids,
10122 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10123 .channel_mode = alc889A_mb31_6ch_modes,
10124 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10125 .input_mux = &alc889A_mb31_capture_source,
10126 .dig_out_nid = ALC883_DIGOUT_NID,
10127 .unsol_event = alc889A_mb31_unsol_event,
10128 .init_hook = alc889A_mb31_automute,
10130 [ALC883_SONY_VAIO_TT] = {
10131 .mixers = { alc883_vaiott_mixer },
10132 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10133 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10134 .dac_nids = alc883_dac_nids,
10135 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10136 .channel_mode = alc883_3ST_2ch_modes,
10137 .input_mux = &alc883_capture_source,
10138 .unsol_event = alc_automute_amp_unsol_event,
10139 .setup = alc883_vaiott_setup,
10140 .init_hook = alc_automute_amp,
10149 PINFIX_ABIT_AW9D_MAX
10152 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10153 { 0x15, 0x01080104 }, /* side */
10154 { 0x16, 0x01011012 }, /* rear */
10155 { 0x17, 0x01016011 }, /* clfe */
10159 static const struct alc_fixup alc882_fixups[] = {
10160 [PINFIX_ABIT_AW9D_MAX] = {
10161 .pins = alc882_abit_aw9d_pinfix
10165 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10166 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10171 * BIOS auto configuration
10173 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10174 const struct auto_pin_cfg *cfg)
10176 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10179 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10180 hda_nid_t nid, int pin_type,
10183 /* set as output */
10184 struct alc_spec *spec = codec->spec;
10187 alc_set_pin_output(codec, nid, pin_type);
10188 if (spec->multiout.dac_nids[dac_idx] == 0x25)
10191 if (spec->multiout.num_dacs >= dac_idx)
10193 idx = spec->multiout.dac_nids[dac_idx] - 2;
10195 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10199 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10201 struct alc_spec *spec = codec->spec;
10204 for (i = 0; i <= HDA_SIDE; i++) {
10205 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10206 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10208 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10213 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10215 struct alc_spec *spec = codec->spec;
10218 pin = spec->autocfg.hp_pins[0];
10219 if (pin) /* connect to front */
10221 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10222 pin = spec->autocfg.speaker_pins[0];
10224 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10227 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10229 struct alc_spec *spec = codec->spec;
10232 for (i = 0; i < AUTO_PIN_LAST; i++) {
10233 hda_nid_t nid = spec->autocfg.input_pins[i];
10236 alc_set_input_pin(codec, nid, i);
10237 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10238 snd_hda_codec_write(codec, nid, 0,
10239 AC_VERB_SET_AMP_GAIN_MUTE,
10244 static void alc882_auto_init_input_src(struct hda_codec *codec)
10246 struct alc_spec *spec = codec->spec;
10249 for (c = 0; c < spec->num_adc_nids; c++) {
10250 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10251 hda_nid_t nid = spec->capsrc_nids[c];
10252 unsigned int mux_idx;
10253 const struct hda_input_mux *imux;
10254 int conns, mute, idx, item;
10256 conns = snd_hda_get_connections(codec, nid, conn_list,
10257 ARRAY_SIZE(conn_list));
10260 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10261 imux = &spec->input_mux[mux_idx];
10262 if (!imux->num_items && mux_idx > 0)
10263 imux = &spec->input_mux[0];
10264 for (idx = 0; idx < conns; idx++) {
10265 /* if the current connection is the selected one,
10266 * unmute it as default - otherwise mute it
10268 mute = AMP_IN_MUTE(idx);
10269 for (item = 0; item < imux->num_items; item++) {
10270 if (imux->items[item].index == idx) {
10271 if (spec->cur_mux[c] == item)
10272 mute = AMP_IN_UNMUTE(idx);
10276 /* check if we have a selector or mixer
10277 * we could check for the widget type instead, but
10278 * just check for Amp-In presence (in case of mixer
10279 * without amp-in there is something wrong, this
10280 * function shouldn't be used or capsrc nid is wrong)
10282 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10283 snd_hda_codec_write(codec, nid, 0,
10284 AC_VERB_SET_AMP_GAIN_MUTE,
10286 else if (mute != AMP_IN_MUTE(idx))
10287 snd_hda_codec_write(codec, nid, 0,
10288 AC_VERB_SET_CONNECT_SEL,
10294 /* add mic boosts if needed */
10295 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10297 struct alc_spec *spec = codec->spec;
10301 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10302 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10303 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10305 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10309 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10310 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10311 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10313 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10320 /* almost identical with ALC880 parser... */
10321 static int alc882_parse_auto_config(struct hda_codec *codec)
10323 struct alc_spec *spec = codec->spec;
10324 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10327 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10331 if (!spec->autocfg.line_outs)
10332 return 0; /* can't find valid BIOS pin config */
10334 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10337 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10340 err = alc880_auto_create_extra_out(spec,
10341 spec->autocfg.speaker_pins[0],
10345 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10349 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10353 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10355 /* check multiple SPDIF-out (for recent codecs) */
10356 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10358 err = snd_hda_get_connections(codec,
10359 spec->autocfg.dig_out_pins[i],
10364 spec->multiout.dig_out_nid = dig_nid;
10366 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10367 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10369 spec->slave_dig_outs[i - 1] = dig_nid;
10372 if (spec->autocfg.dig_in_pin)
10373 spec->dig_in_nid = ALC880_DIGIN_NID;
10375 if (spec->kctls.list)
10376 add_mixer(spec, spec->kctls.list);
10378 add_verb(spec, alc883_auto_init_verbs);
10379 /* if ADC 0x07 is available, initialize it, too */
10380 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10381 add_verb(spec, alc882_adc1_init_verbs);
10383 spec->num_mux_defs = 1;
10384 spec->input_mux = &spec->private_imux[0];
10386 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10388 err = alc_auto_add_mic_boost(codec);
10392 return 1; /* config found */
10395 /* additional initialization for auto-configuration model */
10396 static void alc882_auto_init(struct hda_codec *codec)
10398 struct alc_spec *spec = codec->spec;
10399 alc882_auto_init_multi_out(codec);
10400 alc882_auto_init_hp_out(codec);
10401 alc882_auto_init_analog_input(codec);
10402 alc882_auto_init_input_src(codec);
10403 if (spec->unsol_event)
10404 alc_inithook(codec);
10407 static int patch_alc882(struct hda_codec *codec)
10409 struct alc_spec *spec;
10410 int err, board_config;
10412 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10416 codec->spec = spec;
10418 alc_auto_parse_customize_define(codec);
10420 switch (codec->vendor_id) {
10425 /* ALC883 and variants */
10426 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10430 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10434 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10435 board_config = snd_hda_check_board_codec_sid_config(codec,
10436 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10438 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10439 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10441 board_config = ALC882_AUTO;
10444 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10446 if (board_config == ALC882_AUTO) {
10447 /* automatic parse from the BIOS config */
10448 err = alc882_parse_auto_config(codec);
10454 "hda_codec: Cannot set up configuration "
10455 "from BIOS. Using base mode...\n");
10456 board_config = ALC882_3ST_DIG;
10460 err = snd_hda_attach_beep_device(codec, 0x1);
10466 if (board_config != ALC882_AUTO)
10467 setup_preset(codec, &alc882_presets[board_config]);
10469 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10470 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10471 /* FIXME: setup DAC5 */
10472 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10473 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10475 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10476 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10478 if (codec->vendor_id == 0x10ec0888)
10479 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10481 if (!spec->adc_nids && spec->input_mux) {
10483 spec->num_adc_nids = 0;
10484 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10485 const struct hda_input_mux *imux = spec->input_mux;
10487 hda_nid_t items[16];
10488 hda_nid_t nid = alc882_adc_nids[i];
10489 unsigned int wcap = get_wcaps(codec, nid);
10491 wcap = get_wcaps_type(wcap);
10492 if (wcap != AC_WID_AUD_IN)
10494 spec->private_adc_nids[spec->num_adc_nids] = nid;
10495 err = snd_hda_get_connections(codec, nid, &cap, 1);
10498 err = snd_hda_get_connections(codec, cap, items,
10499 ARRAY_SIZE(items));
10502 for (j = 0; j < imux->num_items; j++)
10503 if (imux->items[j].index >= err)
10505 if (j < imux->num_items)
10507 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10508 spec->num_adc_nids++;
10510 spec->adc_nids = spec->private_adc_nids;
10511 spec->capsrc_nids = spec->private_capsrc_nids;
10514 set_capture_mixer(codec);
10516 if (spec->cdefine.enable_pcbeep)
10517 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10519 spec->vmaster_nid = 0x0c;
10521 codec->patch_ops = alc_patch_ops;
10522 if (board_config == ALC882_AUTO)
10523 spec->init_hook = alc882_auto_init;
10524 #ifdef CONFIG_SND_HDA_POWER_SAVE
10525 if (!spec->loopback.amplist)
10526 spec->loopback.amplist = alc882_loopbacks;
10537 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10538 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10540 #define alc262_dac_nids alc260_dac_nids
10541 #define alc262_adc_nids alc882_adc_nids
10542 #define alc262_adc_nids_alt alc882_adc_nids_alt
10543 #define alc262_capsrc_nids alc882_capsrc_nids
10544 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10546 #define alc262_modes alc260_modes
10547 #define alc262_capture_source alc882_capture_source
10549 static hda_nid_t alc262_dmic_adc_nids[1] = {
10554 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10556 static struct snd_kcontrol_new alc262_base_mixer[] = {
10557 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10558 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10559 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10560 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10561 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10562 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10564 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10565 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10566 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10567 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10568 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10569 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10570 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10571 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10572 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10576 /* update HP, line and mono-out pins according to the master switch */
10577 static void alc262_hp_master_update(struct hda_codec *codec)
10579 struct alc_spec *spec = codec->spec;
10580 int val = spec->master_sw;
10582 /* HP & line-out */
10583 snd_hda_codec_write_cache(codec, 0x1b, 0,
10584 AC_VERB_SET_PIN_WIDGET_CONTROL,
10586 snd_hda_codec_write_cache(codec, 0x15, 0,
10587 AC_VERB_SET_PIN_WIDGET_CONTROL,
10589 /* mono (speaker) depending on the HP jack sense */
10590 val = val && !spec->jack_present;
10591 snd_hda_codec_write_cache(codec, 0x16, 0,
10592 AC_VERB_SET_PIN_WIDGET_CONTROL,
10593 val ? PIN_OUT : 0);
10596 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10598 struct alc_spec *spec = codec->spec;
10600 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10601 alc262_hp_master_update(codec);
10604 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10606 if ((res >> 26) != ALC880_HP_EVENT)
10608 alc262_hp_bpc_automute(codec);
10611 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10613 struct alc_spec *spec = codec->spec;
10615 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10616 alc262_hp_master_update(codec);
10619 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10622 if ((res >> 26) != ALC880_HP_EVENT)
10624 alc262_hp_wildwest_automute(codec);
10627 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10629 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10630 struct snd_ctl_elem_value *ucontrol)
10632 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10633 struct alc_spec *spec = codec->spec;
10634 int val = !!*ucontrol->value.integer.value;
10636 if (val == spec->master_sw)
10638 spec->master_sw = val;
10639 alc262_hp_master_update(codec);
10643 #define ALC262_HP_MASTER_SWITCH \
10645 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10646 .name = "Master Playback Switch", \
10647 .info = snd_ctl_boolean_mono_info, \
10648 .get = alc262_hp_master_sw_get, \
10649 .put = alc262_hp_master_sw_put, \
10652 .iface = NID_MAPPING, \
10653 .name = "Master Playback Switch", \
10654 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10658 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10659 ALC262_HP_MASTER_SWITCH,
10660 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10661 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10662 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10663 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10665 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10669 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10670 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10671 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10672 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10673 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10674 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10675 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10676 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10677 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10678 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10682 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10683 ALC262_HP_MASTER_SWITCH,
10684 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10685 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10686 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10687 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10688 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10690 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10692 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10693 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10694 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10695 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10696 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10697 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10698 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10702 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10703 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10704 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10705 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10709 /* mute/unmute internal speaker according to the hp jack and mute state */
10710 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10712 struct alc_spec *spec = codec->spec;
10714 spec->autocfg.hp_pins[0] = 0x15;
10715 spec->autocfg.speaker_pins[0] = 0x14;
10718 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10719 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10720 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10721 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10722 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10723 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10724 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10725 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10729 static struct hda_verb alc262_hp_t5735_verbs[] = {
10730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10733 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10737 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10738 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10739 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10740 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10741 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10742 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10743 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10747 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10748 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10749 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10750 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10751 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10752 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10753 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10755 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10756 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10757 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10761 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10768 /* bind hp and internal speaker mute (with plug check) as master switch */
10769 static void alc262_hippo_master_update(struct hda_codec *codec)
10771 struct alc_spec *spec = codec->spec;
10772 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10773 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10774 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10778 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10779 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10780 HDA_AMP_MUTE, mute);
10781 /* mute internal speaker per jack sense */
10782 if (spec->jack_present)
10783 mute = HDA_AMP_MUTE;
10785 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10786 HDA_AMP_MUTE, mute);
10787 if (speaker_nid && speaker_nid != line_nid)
10788 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10789 HDA_AMP_MUTE, mute);
10792 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10794 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10795 struct snd_ctl_elem_value *ucontrol)
10797 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10798 struct alc_spec *spec = codec->spec;
10799 int val = !!*ucontrol->value.integer.value;
10801 if (val == spec->master_sw)
10803 spec->master_sw = val;
10804 alc262_hippo_master_update(codec);
10808 #define ALC262_HIPPO_MASTER_SWITCH \
10810 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10811 .name = "Master Playback Switch", \
10812 .info = snd_ctl_boolean_mono_info, \
10813 .get = alc262_hippo_master_sw_get, \
10814 .put = alc262_hippo_master_sw_put, \
10817 .iface = NID_MAPPING, \
10818 .name = "Master Playback Switch", \
10819 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10820 (SUBDEV_SPEAKER(0) << 16), \
10823 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10824 ALC262_HIPPO_MASTER_SWITCH,
10825 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10826 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10827 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10828 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10829 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10832 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10833 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10834 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10835 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10836 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10840 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10841 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10842 ALC262_HIPPO_MASTER_SWITCH,
10843 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10844 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10845 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10846 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10849 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10850 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10851 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10852 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10856 /* mute/unmute internal speaker according to the hp jack and mute state */
10857 static void alc262_hippo_automute(struct hda_codec *codec)
10859 struct alc_spec *spec = codec->spec;
10860 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10862 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10863 alc262_hippo_master_update(codec);
10866 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10868 if ((res >> 26) != ALC880_HP_EVENT)
10870 alc262_hippo_automute(codec);
10873 static void alc262_hippo_setup(struct hda_codec *codec)
10875 struct alc_spec *spec = codec->spec;
10877 spec->autocfg.hp_pins[0] = 0x15;
10878 spec->autocfg.speaker_pins[0] = 0x14;
10881 static void alc262_hippo1_setup(struct hda_codec *codec)
10883 struct alc_spec *spec = codec->spec;
10885 spec->autocfg.hp_pins[0] = 0x1b;
10886 spec->autocfg.speaker_pins[0] = 0x14;
10890 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10891 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10892 ALC262_HIPPO_MASTER_SWITCH,
10893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10895 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10896 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10900 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10901 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10902 ALC262_HIPPO_MASTER_SWITCH,
10903 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10906 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10907 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10911 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10912 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10913 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10914 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10915 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10916 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10917 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10918 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10920 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10921 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10922 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10923 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10927 static struct hda_verb alc262_tyan_verbs[] = {
10928 /* Headphone automute */
10929 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10930 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10931 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10933 /* P11 AUX_IN, white 4-pin connector */
10934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10935 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10936 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10937 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10942 /* unsolicited event for HP jack sensing */
10943 static void alc262_tyan_setup(struct hda_codec *codec)
10945 struct alc_spec *spec = codec->spec;
10947 spec->autocfg.hp_pins[0] = 0x1b;
10948 spec->autocfg.speaker_pins[0] = 0x15;
10952 #define alc262_capture_mixer alc882_capture_mixer
10953 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10956 * generic initialization of ADC, input mixers and output mixers
10958 static struct hda_verb alc262_init_verbs[] = {
10960 * Unmute ADC0-2 and set the default input to mic-in
10962 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10963 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10964 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10965 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10966 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10967 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10969 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10971 * Note: PASD motherboards uses the Line In 2 as the input for
10972 * front panel mic (mic 2)
10974 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10976 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10977 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10978 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10979 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10982 * Set up output mixers (0x0c - 0x0e)
10984 /* set vol=0 to output mixers */
10985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10986 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10987 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10988 /* set up input amps for analog loopback */
10989 /* Amp Indices: DAC = 0, mixer = 1 */
10990 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10991 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10992 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10993 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10994 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10995 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10997 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10998 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10999 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11000 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11001 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11002 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11004 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11006 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11007 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11008 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11010 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11011 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11013 /* FIXME: use matrix-type input source selection */
11014 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11015 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11016 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11017 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11018 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11019 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11021 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11022 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11023 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11024 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11026 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11027 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11034 static struct hda_verb alc262_eapd_verbs[] = {
11035 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11036 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11040 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11042 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11043 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11045 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11046 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11050 static struct hda_verb alc262_sony_unsol_verbs[] = {
11051 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11052 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11053 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11055 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11060 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11061 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11062 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11063 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11069 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11070 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11072 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11073 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11074 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11075 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11076 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11077 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11081 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11083 struct alc_spec *spec = codec->spec;
11085 spec->autocfg.hp_pins[0] = 0x15;
11086 spec->autocfg.speaker_pins[0] = 0x14;
11087 spec->ext_mic.pin = 0x18;
11088 spec->ext_mic.mux_idx = 0;
11089 spec->int_mic.pin = 0x12;
11090 spec->int_mic.mux_idx = 9;
11091 spec->auto_mic = 1;
11097 * 0x16 = internal speaker
11098 * 0x18 = external mic
11101 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11102 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11103 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11106 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11107 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11109 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11110 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11114 static struct hda_verb alc262_nec_verbs[] = {
11115 /* Unmute Speaker */
11116 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11119 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11120 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11122 /* External mic to headphone */
11123 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11124 /* External mic to speaker */
11125 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11131 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11132 * 0x1b = port replicator headphone out
11135 #define ALC_HP_EVENT 0x37
11137 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11138 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11139 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11140 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11141 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11145 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11146 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11147 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11151 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11152 /* Front Mic pin: input vref at 50% */
11153 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11154 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11158 static struct hda_input_mux alc262_fujitsu_capture_source = {
11162 { "Int Mic", 0x1 },
11167 static struct hda_input_mux alc262_HP_capture_source = {
11171 { "Front Mic", 0x1 },
11178 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11182 { "Front Mic", 0x2 },
11188 /* mute/unmute internal speaker according to the hp jacks and mute state */
11189 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11191 struct alc_spec *spec = codec->spec;
11194 if (force || !spec->sense_updated) {
11195 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11196 snd_hda_jack_detect(codec, 0x1b);
11197 spec->sense_updated = 1;
11199 /* unmute internal speaker only if both HPs are unplugged and
11200 * master switch is on
11202 if (spec->jack_present)
11203 mute = HDA_AMP_MUTE;
11205 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11206 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11207 HDA_AMP_MUTE, mute);
11210 /* unsolicited event for HP jack sensing */
11211 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11214 if ((res >> 26) != ALC_HP_EVENT)
11216 alc262_fujitsu_automute(codec, 1);
11219 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11221 alc262_fujitsu_automute(codec, 1);
11224 /* bind volumes of both NID 0x0c and 0x0d */
11225 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11226 .ops = &snd_hda_bind_vol,
11228 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11229 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11234 /* mute/unmute internal speaker according to the hp jack and mute state */
11235 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11237 struct alc_spec *spec = codec->spec;
11240 if (force || !spec->sense_updated) {
11241 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11242 spec->sense_updated = 1;
11244 if (spec->jack_present) {
11245 /* mute internal speaker */
11246 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11247 HDA_AMP_MUTE, HDA_AMP_MUTE);
11248 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11249 HDA_AMP_MUTE, HDA_AMP_MUTE);
11251 /* unmute internal speaker if necessary */
11252 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11253 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11254 HDA_AMP_MUTE, mute);
11255 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11256 HDA_AMP_MUTE, mute);
11260 /* unsolicited event for HP jack sensing */
11261 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11264 if ((res >> 26) != ALC_HP_EVENT)
11266 alc262_lenovo_3000_automute(codec, 1);
11269 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11270 int dir, int idx, long *valp)
11274 for (i = 0; i < 2; i++, valp++)
11275 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11277 *valp ? 0 : HDA_AMP_MUTE);
11281 /* bind hp and internal speaker mute (with plug check) */
11282 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11283 struct snd_ctl_elem_value *ucontrol)
11285 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11286 long *valp = ucontrol->value.integer.value;
11289 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11290 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11292 alc262_fujitsu_automute(codec, 0);
11296 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11297 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11299 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11300 .name = "Master Playback Switch",
11301 .subdevice = HDA_SUBDEV_AMP_FLAG,
11302 .info = snd_hda_mixer_amp_switch_info,
11303 .get = snd_hda_mixer_amp_switch_get,
11304 .put = alc262_fujitsu_master_sw_put,
11305 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11308 .iface = NID_MAPPING,
11309 .name = "Master Playback Switch",
11310 .private_value = 0x1b,
11312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11314 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11317 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11318 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11319 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11323 /* bind hp and internal speaker mute (with plug check) */
11324 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11325 struct snd_ctl_elem_value *ucontrol)
11327 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11328 long *valp = ucontrol->value.integer.value;
11331 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11333 alc262_lenovo_3000_automute(codec, 0);
11337 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11338 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11340 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11341 .name = "Master Playback Switch",
11342 .subdevice = HDA_SUBDEV_AMP_FLAG,
11343 .info = snd_hda_mixer_amp_switch_info,
11344 .get = snd_hda_mixer_amp_switch_get,
11345 .put = alc262_lenovo_3000_master_sw_put,
11346 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11349 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11350 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11353 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11354 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11355 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11359 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11360 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11361 ALC262_HIPPO_MASTER_SWITCH,
11362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11364 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11365 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11366 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11367 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11371 /* additional init verbs for Benq laptops */
11372 static struct hda_verb alc262_EAPD_verbs[] = {
11373 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11374 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11378 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11379 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11380 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11382 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11383 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11387 /* Samsung Q1 Ultra Vista model setup */
11388 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11389 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11390 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11391 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11392 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11393 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11394 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11398 static struct hda_verb alc262_ultra_verbs[] = {
11400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11404 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11405 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11406 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11407 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11409 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11410 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11411 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11412 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11413 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11417 /* ADC, choose mic */
11418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11422 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11423 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11424 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11425 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11426 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11427 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11431 /* mute/unmute internal speaker according to the hp jack and mute state */
11432 static void alc262_ultra_automute(struct hda_codec *codec)
11434 struct alc_spec *spec = codec->spec;
11438 /* auto-mute only when HP is used as HP */
11439 if (!spec->cur_mux[0]) {
11440 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11441 if (spec->jack_present)
11442 mute = HDA_AMP_MUTE;
11444 /* mute/unmute internal speaker */
11445 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11446 HDA_AMP_MUTE, mute);
11447 /* mute/unmute HP */
11448 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11449 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11452 /* unsolicited event for HP jack sensing */
11453 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11456 if ((res >> 26) != ALC880_HP_EVENT)
11458 alc262_ultra_automute(codec);
11461 static struct hda_input_mux alc262_ultra_capture_source = {
11465 { "Headphone", 0x7 },
11469 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11470 struct snd_ctl_elem_value *ucontrol)
11472 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11473 struct alc_spec *spec = codec->spec;
11476 ret = alc_mux_enum_put(kcontrol, ucontrol);
11479 /* reprogram the HP pin as mic or HP according to the input source */
11480 snd_hda_codec_write_cache(codec, 0x15, 0,
11481 AC_VERB_SET_PIN_WIDGET_CONTROL,
11482 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11483 alc262_ultra_automute(codec); /* mute/unmute HP */
11487 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11488 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11489 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11491 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11492 .name = "Capture Source",
11493 .info = alc_mux_enum_info,
11494 .get = alc_mux_enum_get,
11495 .put = alc262_ultra_mux_enum_put,
11498 .iface = NID_MAPPING,
11499 .name = "Capture Source",
11500 .private_value = 0x15,
11505 /* We use two mixers depending on the output pin; 0x16 is a mono output
11506 * and thus it's bound with a different mixer.
11507 * This function returns which mixer amp should be used.
11509 static int alc262_check_volbit(hda_nid_t nid)
11513 else if (nid == 0x16)
11519 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11520 const char *pfx, int *vbits)
11525 vbit = alc262_check_volbit(nid);
11528 if (*vbits & vbit) /* a volume control for this mixer already there */
11532 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11534 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11535 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11538 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11546 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11548 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11549 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11552 /* add playback controls from the parsed DAC table */
11553 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11554 const struct auto_pin_cfg *cfg)
11560 spec->multiout.num_dacs = 1; /* only use one dac */
11561 spec->multiout.dac_nids = spec->private_dac_nids;
11562 spec->multiout.dac_nids[0] = 2;
11564 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11566 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11570 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11573 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11576 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11580 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11581 alc262_check_volbit(cfg->speaker_pins[0]) |
11582 alc262_check_volbit(cfg->hp_pins[0]);
11583 if (vbits == 1 || vbits == 2)
11584 pfx = "Master"; /* only one mixer is used */
11585 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11590 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11593 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11597 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11604 #define alc262_auto_create_input_ctls \
11605 alc882_auto_create_input_ctls
11608 * generic initialization of ADC, input mixers and output mixers
11610 static struct hda_verb alc262_volume_init_verbs[] = {
11612 * Unmute ADC0-2 and set the default input to mic-in
11614 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11616 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11617 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11618 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11619 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11621 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11623 * Note: PASD motherboards uses the Line In 2 as the input for
11624 * front panel mic (mic 2)
11626 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11630 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11631 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11634 * Set up output mixers (0x0c - 0x0f)
11636 /* set vol=0 to output mixers */
11637 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11638 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11639 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11641 /* set up input amps for analog loopback */
11642 /* Amp Indices: DAC = 0, mixer = 1 */
11643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11647 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11650 /* FIXME: use matrix-type input source selection */
11651 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11652 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11653 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11658 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11659 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11663 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11671 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11673 * Unmute ADC0-2 and set the default input to mic-in
11675 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11676 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11677 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11678 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11679 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11680 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11682 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11684 * Note: PASD motherboards uses the Line In 2 as the input for
11685 * front panel mic (mic 2)
11687 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11691 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11692 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11693 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11694 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11697 * Set up output mixers (0x0c - 0x0e)
11699 /* set vol=0 to output mixers */
11700 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11702 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11704 /* set up input amps for analog loopback */
11705 /* Amp Indices: DAC = 0, mixer = 1 */
11706 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11708 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11709 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11710 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11711 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11713 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11717 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11718 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11720 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11721 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11724 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11727 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11729 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11730 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11731 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11732 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11733 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11734 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11737 /* FIXME: use matrix-type input source selection */
11738 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11739 /* Input mixer1: only unmute Mic */
11740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11741 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11742 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11743 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11744 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11745 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11746 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11747 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11750 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11751 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11752 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11753 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11755 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11756 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11757 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11758 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11761 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11763 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11765 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11766 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11767 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11770 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11775 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11777 * Unmute ADC0-2 and set the default input to mic-in
11779 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11780 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11781 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11782 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11783 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11784 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11786 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11788 * Note: PASD motherboards uses the Line In 2 as the input for front
11789 * panel mic (mic 2)
11791 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11792 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11793 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11796 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11801 * Set up output mixers (0x0c - 0x0e)
11803 /* set vol=0 to output mixers */
11804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11805 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11806 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11808 /* set up input amps for analog loopback */
11809 /* Amp Indices: DAC = 0, mixer = 1 */
11810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11814 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11818 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11819 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11820 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11821 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11822 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11823 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11824 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11829 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11830 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11832 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11833 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11834 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11835 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11836 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11837 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11839 /* FIXME: use matrix-type input source selection */
11840 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11841 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11842 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11843 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11847 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11850 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11851 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11852 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11853 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11854 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11855 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11856 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11858 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11859 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11861 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11862 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11863 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11864 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11866 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11871 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11874 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11875 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11877 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11878 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11879 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11880 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11882 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11883 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11884 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11889 #ifdef CONFIG_SND_HDA_POWER_SAVE
11890 #define alc262_loopbacks alc880_loopbacks
11893 /* pcm configuration: identical with ALC880 */
11894 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11895 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11896 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11897 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11900 * BIOS auto configuration
11902 static int alc262_parse_auto_config(struct hda_codec *codec)
11904 struct alc_spec *spec = codec->spec;
11906 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11908 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11912 if (!spec->autocfg.line_outs) {
11913 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11914 spec->multiout.max_channels = 2;
11915 spec->no_analog = 1;
11918 return 0; /* can't find valid BIOS pin config */
11920 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11923 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11927 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11930 if (spec->autocfg.dig_outs) {
11931 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11932 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11934 if (spec->autocfg.dig_in_pin)
11935 spec->dig_in_nid = ALC262_DIGIN_NID;
11937 if (spec->kctls.list)
11938 add_mixer(spec, spec->kctls.list);
11940 add_verb(spec, alc262_volume_init_verbs);
11941 spec->num_mux_defs = 1;
11942 spec->input_mux = &spec->private_imux[0];
11944 err = alc_auto_add_mic_boost(codec);
11948 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11953 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11954 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11955 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11956 #define alc262_auto_init_input_src alc882_auto_init_input_src
11959 /* init callback for auto-configuration model -- overriding the default init */
11960 static void alc262_auto_init(struct hda_codec *codec)
11962 struct alc_spec *spec = codec->spec;
11963 alc262_auto_init_multi_out(codec);
11964 alc262_auto_init_hp_out(codec);
11965 alc262_auto_init_analog_input(codec);
11966 alc262_auto_init_input_src(codec);
11967 if (spec->unsol_event)
11968 alc_inithook(codec);
11972 * configuration and preset
11974 static const char *alc262_models[ALC262_MODEL_LAST] = {
11975 [ALC262_BASIC] = "basic",
11976 [ALC262_HIPPO] = "hippo",
11977 [ALC262_HIPPO_1] = "hippo_1",
11978 [ALC262_FUJITSU] = "fujitsu",
11979 [ALC262_HP_BPC] = "hp-bpc",
11980 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11981 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11982 [ALC262_HP_RP5700] = "hp-rp5700",
11983 [ALC262_BENQ_ED8] = "benq",
11984 [ALC262_BENQ_T31] = "benq-t31",
11985 [ALC262_SONY_ASSAMD] = "sony-assamd",
11986 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11987 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11988 [ALC262_ULTRA] = "ultra",
11989 [ALC262_LENOVO_3000] = "lenovo-3000",
11990 [ALC262_NEC] = "nec",
11991 [ALC262_TYAN] = "tyan",
11992 [ALC262_AUTO] = "auto",
11995 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11996 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11997 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11998 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12000 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12002 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12004 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12005 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12006 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12007 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12008 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12009 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12010 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12011 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12012 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12013 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12014 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12015 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12016 ALC262_HP_TC_T5735),
12017 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12018 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12019 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12020 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12021 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12022 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12023 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12024 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12025 #if 0 /* disable the quirk since model=auto works better in recent versions */
12026 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12027 ALC262_SONY_ASSAMD),
12029 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12030 ALC262_TOSHIBA_RX1),
12031 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12032 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12033 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12034 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12035 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12037 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12038 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12039 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12040 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12041 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12045 static struct alc_config_preset alc262_presets[] = {
12047 .mixers = { alc262_base_mixer },
12048 .init_verbs = { alc262_init_verbs },
12049 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12050 .dac_nids = alc262_dac_nids,
12052 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12053 .channel_mode = alc262_modes,
12054 .input_mux = &alc262_capture_source,
12057 .mixers = { alc262_hippo_mixer },
12058 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12059 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12060 .dac_nids = alc262_dac_nids,
12062 .dig_out_nid = ALC262_DIGOUT_NID,
12063 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12064 .channel_mode = alc262_modes,
12065 .input_mux = &alc262_capture_source,
12066 .unsol_event = alc262_hippo_unsol_event,
12067 .setup = alc262_hippo_setup,
12068 .init_hook = alc262_hippo_automute,
12070 [ALC262_HIPPO_1] = {
12071 .mixers = { alc262_hippo1_mixer },
12072 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12073 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12074 .dac_nids = alc262_dac_nids,
12076 .dig_out_nid = ALC262_DIGOUT_NID,
12077 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12078 .channel_mode = alc262_modes,
12079 .input_mux = &alc262_capture_source,
12080 .unsol_event = alc262_hippo_unsol_event,
12081 .setup = alc262_hippo1_setup,
12082 .init_hook = alc262_hippo_automute,
12084 [ALC262_FUJITSU] = {
12085 .mixers = { alc262_fujitsu_mixer },
12086 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12087 alc262_fujitsu_unsol_verbs },
12088 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12089 .dac_nids = alc262_dac_nids,
12091 .dig_out_nid = ALC262_DIGOUT_NID,
12092 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12093 .channel_mode = alc262_modes,
12094 .input_mux = &alc262_fujitsu_capture_source,
12095 .unsol_event = alc262_fujitsu_unsol_event,
12096 .init_hook = alc262_fujitsu_init_hook,
12098 [ALC262_HP_BPC] = {
12099 .mixers = { alc262_HP_BPC_mixer },
12100 .init_verbs = { alc262_HP_BPC_init_verbs },
12101 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12102 .dac_nids = alc262_dac_nids,
12104 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12105 .channel_mode = alc262_modes,
12106 .input_mux = &alc262_HP_capture_source,
12107 .unsol_event = alc262_hp_bpc_unsol_event,
12108 .init_hook = alc262_hp_bpc_automute,
12110 [ALC262_HP_BPC_D7000_WF] = {
12111 .mixers = { alc262_HP_BPC_WildWest_mixer },
12112 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12113 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12114 .dac_nids = alc262_dac_nids,
12116 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12117 .channel_mode = alc262_modes,
12118 .input_mux = &alc262_HP_D7000_capture_source,
12119 .unsol_event = alc262_hp_wildwest_unsol_event,
12120 .init_hook = alc262_hp_wildwest_automute,
12122 [ALC262_HP_BPC_D7000_WL] = {
12123 .mixers = { alc262_HP_BPC_WildWest_mixer,
12124 alc262_HP_BPC_WildWest_option_mixer },
12125 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12126 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12127 .dac_nids = alc262_dac_nids,
12129 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12130 .channel_mode = alc262_modes,
12131 .input_mux = &alc262_HP_D7000_capture_source,
12132 .unsol_event = alc262_hp_wildwest_unsol_event,
12133 .init_hook = alc262_hp_wildwest_automute,
12135 [ALC262_HP_TC_T5735] = {
12136 .mixers = { alc262_hp_t5735_mixer },
12137 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12138 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12139 .dac_nids = alc262_dac_nids,
12141 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12142 .channel_mode = alc262_modes,
12143 .input_mux = &alc262_capture_source,
12144 .unsol_event = alc_sku_unsol_event,
12145 .setup = alc262_hp_t5735_setup,
12146 .init_hook = alc_inithook,
12148 [ALC262_HP_RP5700] = {
12149 .mixers = { alc262_hp_rp5700_mixer },
12150 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12151 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12152 .dac_nids = alc262_dac_nids,
12153 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12154 .channel_mode = alc262_modes,
12155 .input_mux = &alc262_hp_rp5700_capture_source,
12157 [ALC262_BENQ_ED8] = {
12158 .mixers = { alc262_base_mixer },
12159 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12160 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12161 .dac_nids = alc262_dac_nids,
12163 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12164 .channel_mode = alc262_modes,
12165 .input_mux = &alc262_capture_source,
12167 [ALC262_SONY_ASSAMD] = {
12168 .mixers = { alc262_sony_mixer },
12169 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12170 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12171 .dac_nids = alc262_dac_nids,
12173 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12174 .channel_mode = alc262_modes,
12175 .input_mux = &alc262_capture_source,
12176 .unsol_event = alc262_hippo_unsol_event,
12177 .setup = alc262_hippo_setup,
12178 .init_hook = alc262_hippo_automute,
12180 [ALC262_BENQ_T31] = {
12181 .mixers = { alc262_benq_t31_mixer },
12182 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12183 alc_hp15_unsol_verbs },
12184 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12185 .dac_nids = alc262_dac_nids,
12187 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12188 .channel_mode = alc262_modes,
12189 .input_mux = &alc262_capture_source,
12190 .unsol_event = alc262_hippo_unsol_event,
12191 .setup = alc262_hippo_setup,
12192 .init_hook = alc262_hippo_automute,
12195 .mixers = { alc262_ultra_mixer },
12196 .cap_mixer = alc262_ultra_capture_mixer,
12197 .init_verbs = { alc262_ultra_verbs },
12198 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12199 .dac_nids = alc262_dac_nids,
12200 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12201 .channel_mode = alc262_modes,
12202 .input_mux = &alc262_ultra_capture_source,
12203 .adc_nids = alc262_adc_nids, /* ADC0 */
12204 .capsrc_nids = alc262_capsrc_nids,
12205 .num_adc_nids = 1, /* single ADC */
12206 .unsol_event = alc262_ultra_unsol_event,
12207 .init_hook = alc262_ultra_automute,
12209 [ALC262_LENOVO_3000] = {
12210 .mixers = { alc262_lenovo_3000_mixer },
12211 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12212 alc262_lenovo_3000_unsol_verbs,
12213 alc262_lenovo_3000_init_verbs },
12214 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12215 .dac_nids = alc262_dac_nids,
12217 .dig_out_nid = ALC262_DIGOUT_NID,
12218 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12219 .channel_mode = alc262_modes,
12220 .input_mux = &alc262_fujitsu_capture_source,
12221 .unsol_event = alc262_lenovo_3000_unsol_event,
12224 .mixers = { alc262_nec_mixer },
12225 .init_verbs = { alc262_nec_verbs },
12226 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12227 .dac_nids = alc262_dac_nids,
12229 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12230 .channel_mode = alc262_modes,
12231 .input_mux = &alc262_capture_source,
12233 [ALC262_TOSHIBA_S06] = {
12234 .mixers = { alc262_toshiba_s06_mixer },
12235 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12236 alc262_eapd_verbs },
12237 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12238 .capsrc_nids = alc262_dmic_capsrc_nids,
12239 .dac_nids = alc262_dac_nids,
12240 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12241 .num_adc_nids = 1, /* single ADC */
12242 .dig_out_nid = ALC262_DIGOUT_NID,
12243 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12244 .channel_mode = alc262_modes,
12245 .unsol_event = alc_sku_unsol_event,
12246 .setup = alc262_toshiba_s06_setup,
12247 .init_hook = alc_inithook,
12249 [ALC262_TOSHIBA_RX1] = {
12250 .mixers = { alc262_toshiba_rx1_mixer },
12251 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12252 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12253 .dac_nids = alc262_dac_nids,
12255 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12256 .channel_mode = alc262_modes,
12257 .input_mux = &alc262_capture_source,
12258 .unsol_event = alc262_hippo_unsol_event,
12259 .setup = alc262_hippo_setup,
12260 .init_hook = alc262_hippo_automute,
12263 .mixers = { alc262_tyan_mixer },
12264 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12265 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12266 .dac_nids = alc262_dac_nids,
12268 .dig_out_nid = ALC262_DIGOUT_NID,
12269 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12270 .channel_mode = alc262_modes,
12271 .input_mux = &alc262_capture_source,
12272 .unsol_event = alc_automute_amp_unsol_event,
12273 .setup = alc262_tyan_setup,
12274 .init_hook = alc_automute_amp,
12278 static int patch_alc262(struct hda_codec *codec)
12280 struct alc_spec *spec;
12284 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12288 codec->spec = spec;
12290 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12295 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12296 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12297 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12298 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12301 alc_auto_parse_customize_define(codec);
12303 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12305 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12309 if (board_config < 0) {
12310 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12312 board_config = ALC262_AUTO;
12315 if (board_config == ALC262_AUTO) {
12316 /* automatic parse from the BIOS config */
12317 err = alc262_parse_auto_config(codec);
12323 "hda_codec: Cannot set up configuration "
12324 "from BIOS. Using base mode...\n");
12325 board_config = ALC262_BASIC;
12329 if (!spec->no_analog) {
12330 err = snd_hda_attach_beep_device(codec, 0x1);
12337 if (board_config != ALC262_AUTO)
12338 setup_preset(codec, &alc262_presets[board_config]);
12340 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12341 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12343 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12344 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12346 if (!spec->adc_nids && spec->input_mux) {
12348 /* check whether the digital-mic has to be supported */
12349 for (i = 0; i < spec->input_mux->num_items; i++) {
12350 if (spec->input_mux->items[i].index >= 9)
12353 if (i < spec->input_mux->num_items) {
12354 /* use only ADC0 */
12355 spec->adc_nids = alc262_dmic_adc_nids;
12356 spec->num_adc_nids = 1;
12357 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12359 /* all analog inputs */
12360 /* check whether NID 0x07 is valid */
12361 unsigned int wcap = get_wcaps(codec, 0x07);
12364 wcap = get_wcaps_type(wcap);
12365 if (wcap != AC_WID_AUD_IN) {
12366 spec->adc_nids = alc262_adc_nids_alt;
12367 spec->num_adc_nids =
12368 ARRAY_SIZE(alc262_adc_nids_alt);
12369 spec->capsrc_nids = alc262_capsrc_nids_alt;
12371 spec->adc_nids = alc262_adc_nids;
12372 spec->num_adc_nids =
12373 ARRAY_SIZE(alc262_adc_nids);
12374 spec->capsrc_nids = alc262_capsrc_nids;
12378 if (!spec->cap_mixer && !spec->no_analog)
12379 set_capture_mixer(codec);
12380 if (!spec->no_analog && spec->cdefine.enable_pcbeep)
12381 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12383 spec->vmaster_nid = 0x0c;
12385 codec->patch_ops = alc_patch_ops;
12386 if (board_config == ALC262_AUTO)
12387 spec->init_hook = alc262_auto_init;
12388 #ifdef CONFIG_SND_HDA_POWER_SAVE
12389 if (!spec->loopback.amplist)
12390 spec->loopback.amplist = alc262_loopbacks;
12397 * ALC268 channel source setting (2 channel)
12399 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12400 #define alc268_modes alc260_modes
12402 static hda_nid_t alc268_dac_nids[2] = {
12407 static hda_nid_t alc268_adc_nids[2] = {
12412 static hda_nid_t alc268_adc_nids_alt[1] = {
12417 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12419 static struct snd_kcontrol_new alc268_base_mixer[] = {
12420 /* output mixer control */
12421 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12422 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12423 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12424 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12425 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12426 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12427 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12431 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12432 /* output mixer control */
12433 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12434 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12435 ALC262_HIPPO_MASTER_SWITCH,
12436 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12437 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12438 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12442 /* bind Beep switches of both NID 0x0f and 0x10 */
12443 static struct hda_bind_ctls alc268_bind_beep_sw = {
12444 .ops = &snd_hda_bind_sw,
12446 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12447 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12452 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12453 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12454 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12458 static struct hda_verb alc268_eapd_verbs[] = {
12459 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12460 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12464 /* Toshiba specific */
12465 static struct hda_verb alc268_toshiba_verbs[] = {
12466 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12470 /* Acer specific */
12471 /* bind volumes of both NID 0x02 and 0x03 */
12472 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12473 .ops = &snd_hda_bind_vol,
12475 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12476 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12481 /* mute/unmute internal speaker according to the hp jack and mute state */
12482 static void alc268_acer_automute(struct hda_codec *codec, int force)
12484 struct alc_spec *spec = codec->spec;
12487 if (force || !spec->sense_updated) {
12488 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12489 spec->sense_updated = 1;
12491 if (spec->jack_present)
12492 mute = HDA_AMP_MUTE; /* mute internal speaker */
12493 else /* unmute internal speaker if necessary */
12494 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12495 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12496 HDA_AMP_MUTE, mute);
12500 /* bind hp and internal speaker mute (with plug check) */
12501 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12502 struct snd_ctl_elem_value *ucontrol)
12504 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12505 long *valp = ucontrol->value.integer.value;
12508 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12510 alc268_acer_automute(codec, 0);
12514 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12515 /* output mixer control */
12516 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12518 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12519 .name = "Master Playback Switch",
12520 .subdevice = HDA_SUBDEV_AMP_FLAG,
12521 .info = snd_hda_mixer_amp_switch_info,
12522 .get = snd_hda_mixer_amp_switch_get,
12523 .put = alc268_acer_master_sw_put,
12524 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12526 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12530 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12531 /* output mixer control */
12532 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12534 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12535 .name = "Master Playback Switch",
12536 .subdevice = HDA_SUBDEV_AMP_FLAG,
12537 .info = snd_hda_mixer_amp_switch_info,
12538 .get = snd_hda_mixer_amp_switch_get,
12539 .put = alc268_acer_master_sw_put,
12540 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12542 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12543 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12544 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12548 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12549 /* output mixer control */
12550 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12552 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12553 .name = "Master Playback Switch",
12554 .subdevice = HDA_SUBDEV_AMP_FLAG,
12555 .info = snd_hda_mixer_amp_switch_info,
12556 .get = snd_hda_mixer_amp_switch_get,
12557 .put = alc268_acer_master_sw_put,
12558 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12560 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12561 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12565 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12566 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12567 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12568 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12569 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12570 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12571 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12575 static struct hda_verb alc268_acer_verbs[] = {
12576 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12577 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12579 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12580 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12581 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12582 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12586 /* unsolicited event for HP jack sensing */
12587 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12588 #define alc268_toshiba_setup alc262_hippo_setup
12589 #define alc268_toshiba_automute alc262_hippo_automute
12591 static void alc268_acer_unsol_event(struct hda_codec *codec,
12594 if ((res >> 26) != ALC880_HP_EVENT)
12596 alc268_acer_automute(codec, 1);
12599 static void alc268_acer_init_hook(struct hda_codec *codec)
12601 alc268_acer_automute(codec, 1);
12604 /* toggle speaker-output according to the hp-jack state */
12605 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12607 unsigned int present;
12608 unsigned char bits;
12610 present = snd_hda_jack_detect(codec, 0x15);
12611 bits = present ? HDA_AMP_MUTE : 0;
12612 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12613 HDA_AMP_MUTE, bits);
12614 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12615 HDA_AMP_MUTE, bits);
12618 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12621 switch (res >> 26) {
12622 case ALC880_HP_EVENT:
12623 alc268_aspire_one_speaker_automute(codec);
12625 case ALC880_MIC_EVENT:
12626 alc_mic_automute(codec);
12631 static void alc268_acer_lc_setup(struct hda_codec *codec)
12633 struct alc_spec *spec = codec->spec;
12634 spec->ext_mic.pin = 0x18;
12635 spec->ext_mic.mux_idx = 0;
12636 spec->int_mic.pin = 0x12;
12637 spec->int_mic.mux_idx = 6;
12638 spec->auto_mic = 1;
12641 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12643 alc268_aspire_one_speaker_automute(codec);
12644 alc_mic_automute(codec);
12647 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12648 /* output mixer control */
12649 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12650 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12651 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12653 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12654 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12658 static struct hda_verb alc268_dell_verbs[] = {
12659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12661 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12662 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12666 /* mute/unmute internal speaker according to the hp jack and mute state */
12667 static void alc268_dell_setup(struct hda_codec *codec)
12669 struct alc_spec *spec = codec->spec;
12671 spec->autocfg.hp_pins[0] = 0x15;
12672 spec->autocfg.speaker_pins[0] = 0x14;
12673 spec->ext_mic.pin = 0x18;
12674 spec->ext_mic.mux_idx = 0;
12675 spec->int_mic.pin = 0x19;
12676 spec->int_mic.mux_idx = 1;
12677 spec->auto_mic = 1;
12680 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12681 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12682 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12683 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12684 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12685 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12686 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12687 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12688 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12692 static struct hda_verb alc267_quanta_il1_verbs[] = {
12693 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12694 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12698 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12700 struct alc_spec *spec = codec->spec;
12701 spec->autocfg.hp_pins[0] = 0x15;
12702 spec->autocfg.speaker_pins[0] = 0x14;
12703 spec->ext_mic.pin = 0x18;
12704 spec->ext_mic.mux_idx = 0;
12705 spec->int_mic.pin = 0x19;
12706 spec->int_mic.mux_idx = 1;
12707 spec->auto_mic = 1;
12711 * generic initialization of ADC, input mixers and output mixers
12713 static struct hda_verb alc268_base_init_verbs[] = {
12714 /* Unmute DAC0-1 and set vol = 0 */
12715 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12716 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12719 * Set up output mixers (0x0c - 0x0e)
12721 /* set vol=0 to output mixers */
12722 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12723 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12725 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12726 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12730 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12731 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12732 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12733 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12734 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12735 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12737 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12739 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12741 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12743 /* set PCBEEP vol = 0, mute connections */
12744 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12745 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12746 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12748 /* Unmute Selector 23h,24h and set the default input to mic-in */
12750 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12751 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12752 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12753 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12759 * generic initialization of ADC, input mixers and output mixers
12761 static struct hda_verb alc268_volume_init_verbs[] = {
12762 /* set output DAC */
12763 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12764 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12766 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12767 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12768 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12769 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12770 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12772 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12773 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12774 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12776 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12779 /* set PCBEEP vol = 0, mute connections */
12780 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12782 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12787 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12788 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12789 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12793 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12794 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12795 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12800 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12801 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12802 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12803 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12804 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12809 static struct hda_input_mux alc268_capture_source = {
12813 { "Front Mic", 0x1 },
12819 static struct hda_input_mux alc268_acer_capture_source = {
12823 { "Internal Mic", 0x1 },
12828 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12832 { "Internal Mic", 0x6 },
12837 #ifdef CONFIG_SND_DEBUG
12838 static struct snd_kcontrol_new alc268_test_mixer[] = {
12839 /* Volume widgets */
12840 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12841 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12842 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12843 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12844 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12845 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12846 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12847 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12848 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12849 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12850 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12851 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12852 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12853 /* The below appears problematic on some hardwares */
12854 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12855 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12856 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12857 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12858 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12860 /* Modes for retasking pin widgets */
12861 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12862 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12863 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12864 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12866 /* Controls for GPIO pins, assuming they are configured as outputs */
12867 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12868 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12869 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12870 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12872 /* Switches to allow the digital SPDIF output pin to be enabled.
12873 * The ALC268 does not have an SPDIF input.
12875 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12877 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12878 * this output to turn on an external amplifier.
12880 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12881 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12887 /* create input playback/capture controls for the given pin */
12888 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12889 const char *ctlname, int idx)
12905 if (spec->multiout.dac_nids[0] != dac &&
12906 spec->multiout.dac_nids[1] != dac) {
12907 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12908 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12912 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12916 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12917 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12919 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12920 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12926 /* add playback controls from the parsed DAC table */
12927 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12928 const struct auto_pin_cfg *cfg)
12933 spec->multiout.dac_nids = spec->private_dac_nids;
12935 nid = cfg->line_out_pins[0];
12938 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12942 err = alc268_new_analog_output(spec, nid, name, 0);
12947 nid = cfg->speaker_pins[0];
12949 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12950 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12954 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12958 nid = cfg->hp_pins[0];
12960 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12965 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12967 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12968 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12975 /* create playback/capture controls for input pins */
12976 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12977 const struct auto_pin_cfg *cfg)
12979 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12982 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12983 hda_nid_t nid, int pin_type)
12987 alc_set_pin_output(codec, nid, pin_type);
12988 if (nid == 0x14 || nid == 0x16)
12992 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12995 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12997 struct alc_spec *spec = codec->spec;
12998 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13000 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13001 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13005 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13007 struct alc_spec *spec = codec->spec;
13010 pin = spec->autocfg.hp_pins[0];
13012 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13013 pin = spec->autocfg.speaker_pins[0];
13015 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13018 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13020 struct alc_spec *spec = codec->spec;
13021 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13022 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13023 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13024 unsigned int dac_vol1, dac_vol2;
13026 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13027 snd_hda_codec_write(codec, speaker_nid, 0,
13028 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13029 /* mute mixer inputs from 0x1d */
13030 snd_hda_codec_write(codec, 0x0f, 0,
13031 AC_VERB_SET_AMP_GAIN_MUTE,
13033 snd_hda_codec_write(codec, 0x10, 0,
13034 AC_VERB_SET_AMP_GAIN_MUTE,
13037 /* unmute mixer inputs from 0x1d */
13038 snd_hda_codec_write(codec, 0x0f, 0,
13039 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13040 snd_hda_codec_write(codec, 0x10, 0,
13041 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13044 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13045 if (line_nid == 0x14)
13046 dac_vol2 = AMP_OUT_ZERO;
13047 else if (line_nid == 0x15)
13048 dac_vol1 = AMP_OUT_ZERO;
13049 if (hp_nid == 0x14)
13050 dac_vol2 = AMP_OUT_ZERO;
13051 else if (hp_nid == 0x15)
13052 dac_vol1 = AMP_OUT_ZERO;
13053 if (line_nid != 0x16 || hp_nid != 0x16 ||
13054 spec->autocfg.line_out_pins[1] != 0x16 ||
13055 spec->autocfg.line_out_pins[2] != 0x16)
13056 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13058 snd_hda_codec_write(codec, 0x02, 0,
13059 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13060 snd_hda_codec_write(codec, 0x03, 0,
13061 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13064 /* pcm configuration: identical with ALC880 */
13065 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13066 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13067 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13068 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13071 * BIOS auto configuration
13073 static int alc268_parse_auto_config(struct hda_codec *codec)
13075 struct alc_spec *spec = codec->spec;
13077 static hda_nid_t alc268_ignore[] = { 0 };
13079 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13083 if (!spec->autocfg.line_outs) {
13084 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13085 spec->multiout.max_channels = 2;
13086 spec->no_analog = 1;
13089 return 0; /* can't find valid BIOS pin config */
13091 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13094 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13098 spec->multiout.max_channels = 2;
13101 /* digital only support output */
13102 if (spec->autocfg.dig_outs) {
13103 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13104 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13106 if (spec->kctls.list)
13107 add_mixer(spec, spec->kctls.list);
13109 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13110 add_mixer(spec, alc268_beep_mixer);
13112 add_verb(spec, alc268_volume_init_verbs);
13113 spec->num_mux_defs = 2;
13114 spec->input_mux = &spec->private_imux[0];
13116 err = alc_auto_add_mic_boost(codec);
13120 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13125 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13127 /* init callback for auto-configuration model -- overriding the default init */
13128 static void alc268_auto_init(struct hda_codec *codec)
13130 struct alc_spec *spec = codec->spec;
13131 alc268_auto_init_multi_out(codec);
13132 alc268_auto_init_hp_out(codec);
13133 alc268_auto_init_mono_speaker_out(codec);
13134 alc268_auto_init_analog_input(codec);
13135 if (spec->unsol_event)
13136 alc_inithook(codec);
13140 * configuration and preset
13142 static const char *alc268_models[ALC268_MODEL_LAST] = {
13143 [ALC267_QUANTA_IL1] = "quanta-il1",
13144 [ALC268_3ST] = "3stack",
13145 [ALC268_TOSHIBA] = "toshiba",
13146 [ALC268_ACER] = "acer",
13147 [ALC268_ACER_DMIC] = "acer-dmic",
13148 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13149 [ALC268_DELL] = "dell",
13150 [ALC268_ZEPTO] = "zepto",
13151 #ifdef CONFIG_SND_DEBUG
13152 [ALC268_TEST] = "test",
13154 [ALC268_AUTO] = "auto",
13157 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13158 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13159 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13160 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13161 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13162 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13163 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13164 ALC268_ACER_ASPIRE_ONE),
13165 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13166 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13167 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13168 /* almost compatible with toshiba but with optional digital outs;
13169 * auto-probing seems working fine
13171 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13173 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13174 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13175 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13176 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13177 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13178 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13182 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13183 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13184 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13185 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13186 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13191 static struct alc_config_preset alc268_presets[] = {
13192 [ALC267_QUANTA_IL1] = {
13193 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13194 alc268_capture_nosrc_mixer },
13195 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13196 alc267_quanta_il1_verbs },
13197 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13198 .dac_nids = alc268_dac_nids,
13199 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13200 .adc_nids = alc268_adc_nids_alt,
13202 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13203 .channel_mode = alc268_modes,
13204 .unsol_event = alc_sku_unsol_event,
13205 .setup = alc267_quanta_il1_setup,
13206 .init_hook = alc_inithook,
13209 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13210 alc268_beep_mixer },
13211 .init_verbs = { alc268_base_init_verbs },
13212 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13213 .dac_nids = alc268_dac_nids,
13214 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13215 .adc_nids = alc268_adc_nids_alt,
13216 .capsrc_nids = alc268_capsrc_nids,
13218 .dig_out_nid = ALC268_DIGOUT_NID,
13219 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13220 .channel_mode = alc268_modes,
13221 .input_mux = &alc268_capture_source,
13223 [ALC268_TOSHIBA] = {
13224 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13225 alc268_beep_mixer },
13226 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13227 alc268_toshiba_verbs },
13228 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13229 .dac_nids = alc268_dac_nids,
13230 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13231 .adc_nids = alc268_adc_nids_alt,
13232 .capsrc_nids = alc268_capsrc_nids,
13234 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13235 .channel_mode = alc268_modes,
13236 .input_mux = &alc268_capture_source,
13237 .unsol_event = alc268_toshiba_unsol_event,
13238 .setup = alc268_toshiba_setup,
13239 .init_hook = alc268_toshiba_automute,
13242 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13243 alc268_beep_mixer },
13244 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13245 alc268_acer_verbs },
13246 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13247 .dac_nids = alc268_dac_nids,
13248 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13249 .adc_nids = alc268_adc_nids_alt,
13250 .capsrc_nids = alc268_capsrc_nids,
13252 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13253 .channel_mode = alc268_modes,
13254 .input_mux = &alc268_acer_capture_source,
13255 .unsol_event = alc268_acer_unsol_event,
13256 .init_hook = alc268_acer_init_hook,
13258 [ALC268_ACER_DMIC] = {
13259 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13260 alc268_beep_mixer },
13261 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13262 alc268_acer_verbs },
13263 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13264 .dac_nids = alc268_dac_nids,
13265 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13266 .adc_nids = alc268_adc_nids_alt,
13267 .capsrc_nids = alc268_capsrc_nids,
13269 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13270 .channel_mode = alc268_modes,
13271 .input_mux = &alc268_acer_dmic_capture_source,
13272 .unsol_event = alc268_acer_unsol_event,
13273 .init_hook = alc268_acer_init_hook,
13275 [ALC268_ACER_ASPIRE_ONE] = {
13276 .mixers = { alc268_acer_aspire_one_mixer,
13278 alc268_capture_nosrc_mixer },
13279 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13280 alc268_acer_aspire_one_verbs },
13281 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13282 .dac_nids = alc268_dac_nids,
13283 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13284 .adc_nids = alc268_adc_nids_alt,
13285 .capsrc_nids = alc268_capsrc_nids,
13287 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13288 .channel_mode = alc268_modes,
13289 .unsol_event = alc268_acer_lc_unsol_event,
13290 .setup = alc268_acer_lc_setup,
13291 .init_hook = alc268_acer_lc_init_hook,
13294 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13295 alc268_capture_nosrc_mixer },
13296 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13297 alc268_dell_verbs },
13298 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13299 .dac_nids = alc268_dac_nids,
13300 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13301 .adc_nids = alc268_adc_nids_alt,
13302 .capsrc_nids = alc268_capsrc_nids,
13304 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13305 .channel_mode = alc268_modes,
13306 .unsol_event = alc_sku_unsol_event,
13307 .setup = alc268_dell_setup,
13308 .init_hook = alc_inithook,
13311 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13312 alc268_beep_mixer },
13313 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13314 alc268_toshiba_verbs },
13315 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13316 .dac_nids = alc268_dac_nids,
13317 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13318 .adc_nids = alc268_adc_nids_alt,
13319 .capsrc_nids = alc268_capsrc_nids,
13321 .dig_out_nid = ALC268_DIGOUT_NID,
13322 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13323 .channel_mode = alc268_modes,
13324 .input_mux = &alc268_capture_source,
13325 .setup = alc268_toshiba_setup,
13326 .init_hook = alc268_toshiba_automute,
13328 #ifdef CONFIG_SND_DEBUG
13330 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13331 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13332 alc268_volume_init_verbs },
13333 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13334 .dac_nids = alc268_dac_nids,
13335 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13336 .adc_nids = alc268_adc_nids_alt,
13337 .capsrc_nids = alc268_capsrc_nids,
13339 .dig_out_nid = ALC268_DIGOUT_NID,
13340 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13341 .channel_mode = alc268_modes,
13342 .input_mux = &alc268_capture_source,
13347 static int patch_alc268(struct hda_codec *codec)
13349 struct alc_spec *spec;
13351 int i, has_beep, err;
13353 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13357 codec->spec = spec;
13359 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13363 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13364 board_config = snd_hda_check_board_codec_sid_config(codec,
13365 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13367 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13368 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13370 board_config = ALC268_AUTO;
13373 if (board_config == ALC268_AUTO) {
13374 /* automatic parse from the BIOS config */
13375 err = alc268_parse_auto_config(codec);
13381 "hda_codec: Cannot set up configuration "
13382 "from BIOS. Using base mode...\n");
13383 board_config = ALC268_3ST;
13387 if (board_config != ALC268_AUTO)
13388 setup_preset(codec, &alc268_presets[board_config]);
13390 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13391 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13392 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13394 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13397 for (i = 0; i < spec->num_mixers; i++) {
13398 if (spec->mixers[i] == alc268_beep_mixer) {
13405 err = snd_hda_attach_beep_device(codec, 0x1);
13410 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13411 /* override the amp caps for beep generator */
13412 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13413 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13414 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13415 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13416 (0 << AC_AMPCAP_MUTE_SHIFT));
13419 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13420 /* check whether NID 0x07 is valid */
13421 unsigned int wcap = get_wcaps(codec, 0x07);
13424 spec->capsrc_nids = alc268_capsrc_nids;
13426 wcap = get_wcaps_type(wcap);
13427 if (spec->auto_mic ||
13428 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13429 spec->adc_nids = alc268_adc_nids_alt;
13430 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13431 if (spec->auto_mic)
13432 fixup_automic_adc(codec);
13433 if (spec->auto_mic || spec->input_mux->num_items == 1)
13434 add_mixer(spec, alc268_capture_nosrc_mixer);
13436 add_mixer(spec, alc268_capture_alt_mixer);
13438 spec->adc_nids = alc268_adc_nids;
13439 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13440 add_mixer(spec, alc268_capture_mixer);
13442 /* set default input source */
13443 for (i = 0; i < spec->num_adc_nids; i++)
13444 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13445 0, AC_VERB_SET_CONNECT_SEL,
13446 i < spec->num_mux_defs ?
13447 spec->input_mux[i].items[0].index :
13448 spec->input_mux->items[0].index);
13451 spec->vmaster_nid = 0x02;
13453 codec->patch_ops = alc_patch_ops;
13454 if (board_config == ALC268_AUTO)
13455 spec->init_hook = alc268_auto_init;
13461 * ALC269 channel source setting (2 channel)
13463 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13465 #define alc269_dac_nids alc260_dac_nids
13467 static hda_nid_t alc269_adc_nids[1] = {
13472 static hda_nid_t alc269_capsrc_nids[1] = {
13476 static hda_nid_t alc269vb_adc_nids[1] = {
13481 static hda_nid_t alc269vb_capsrc_nids[1] = {
13485 static hda_nid_t alc269_adc_candidates[] = {
13489 #define alc269_modes alc260_modes
13490 #define alc269_capture_source alc880_lg_lw_capture_source
13492 static struct snd_kcontrol_new alc269_base_mixer[] = {
13493 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13494 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13495 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13496 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13499 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13500 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13501 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13502 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13503 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13504 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13508 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13509 /* output mixer control */
13510 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13512 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13513 .name = "Master Playback Switch",
13514 .subdevice = HDA_SUBDEV_AMP_FLAG,
13515 .info = snd_hda_mixer_amp_switch_info,
13516 .get = snd_hda_mixer_amp_switch_get,
13517 .put = alc268_acer_master_sw_put,
13518 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13521 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13522 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13523 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13524 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13525 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13529 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13530 /* output mixer control */
13531 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13533 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13534 .name = "Master Playback Switch",
13535 .subdevice = HDA_SUBDEV_AMP_FLAG,
13536 .info = snd_hda_mixer_amp_switch_info,
13537 .get = snd_hda_mixer_amp_switch_get,
13538 .put = alc268_acer_master_sw_put,
13539 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13542 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13543 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13544 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13545 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13546 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13547 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13548 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13549 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13553 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13554 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13555 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13556 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13557 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13561 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13562 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13563 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13564 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13565 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13569 /* capture mixer elements */
13570 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13571 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13572 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13573 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13574 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13578 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13579 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13580 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13581 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13585 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13586 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13587 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13588 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13589 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13593 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13594 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13595 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13596 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13601 #define alc269_fujitsu_mixer alc269_laptop_mixer
13603 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13604 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13605 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13606 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13607 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13608 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13609 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13613 static struct hda_verb alc269_lifebook_verbs[] = {
13614 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13615 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13616 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13617 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13618 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13619 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13620 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13621 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13622 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13623 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13627 /* toggle speaker-output according to the hp-jack state */
13628 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13630 unsigned int present;
13631 unsigned char bits;
13633 present = snd_hda_jack_detect(codec, 0x15);
13634 bits = present ? HDA_AMP_MUTE : 0;
13635 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13636 HDA_AMP_MUTE, bits);
13637 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13638 HDA_AMP_MUTE, bits);
13640 snd_hda_codec_write(codec, 0x20, 0,
13641 AC_VERB_SET_COEF_INDEX, 0x0c);
13642 snd_hda_codec_write(codec, 0x20, 0,
13643 AC_VERB_SET_PROC_COEF, 0x680);
13645 snd_hda_codec_write(codec, 0x20, 0,
13646 AC_VERB_SET_COEF_INDEX, 0x0c);
13647 snd_hda_codec_write(codec, 0x20, 0,
13648 AC_VERB_SET_PROC_COEF, 0x480);
13651 /* toggle speaker-output according to the hp-jacks state */
13652 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13654 unsigned int present;
13655 unsigned char bits;
13657 /* Check laptop headphone socket */
13658 present = snd_hda_jack_detect(codec, 0x15);
13660 /* Check port replicator headphone socket */
13661 present |= snd_hda_jack_detect(codec, 0x1a);
13663 bits = present ? HDA_AMP_MUTE : 0;
13664 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13665 HDA_AMP_MUTE, bits);
13666 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13667 HDA_AMP_MUTE, bits);
13669 snd_hda_codec_write(codec, 0x20, 0,
13670 AC_VERB_SET_COEF_INDEX, 0x0c);
13671 snd_hda_codec_write(codec, 0x20, 0,
13672 AC_VERB_SET_PROC_COEF, 0x680);
13674 snd_hda_codec_write(codec, 0x20, 0,
13675 AC_VERB_SET_COEF_INDEX, 0x0c);
13676 snd_hda_codec_write(codec, 0x20, 0,
13677 AC_VERB_SET_PROC_COEF, 0x480);
13680 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13682 unsigned int present_laptop;
13683 unsigned int present_dock;
13685 present_laptop = snd_hda_jack_detect(codec, 0x18);
13686 present_dock = snd_hda_jack_detect(codec, 0x1b);
13688 /* Laptop mic port overrides dock mic port, design decision */
13690 snd_hda_codec_write(codec, 0x23, 0,
13691 AC_VERB_SET_CONNECT_SEL, 0x3);
13692 if (present_laptop)
13693 snd_hda_codec_write(codec, 0x23, 0,
13694 AC_VERB_SET_CONNECT_SEL, 0x0);
13695 if (!present_dock && !present_laptop)
13696 snd_hda_codec_write(codec, 0x23, 0,
13697 AC_VERB_SET_CONNECT_SEL, 0x1);
13700 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13703 switch (res >> 26) {
13704 case ALC880_HP_EVENT:
13705 alc269_quanta_fl1_speaker_automute(codec);
13707 case ALC880_MIC_EVENT:
13708 alc_mic_automute(codec);
13713 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13716 if ((res >> 26) == ALC880_HP_EVENT)
13717 alc269_lifebook_speaker_automute(codec);
13718 if ((res >> 26) == ALC880_MIC_EVENT)
13719 alc269_lifebook_mic_autoswitch(codec);
13722 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13724 struct alc_spec *spec = codec->spec;
13725 spec->autocfg.hp_pins[0] = 0x15;
13726 spec->autocfg.speaker_pins[0] = 0x14;
13727 spec->ext_mic.pin = 0x18;
13728 spec->ext_mic.mux_idx = 0;
13729 spec->int_mic.pin = 0x19;
13730 spec->int_mic.mux_idx = 1;
13731 spec->auto_mic = 1;
13734 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13736 alc269_quanta_fl1_speaker_automute(codec);
13737 alc_mic_automute(codec);
13740 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13742 alc269_lifebook_speaker_automute(codec);
13743 alc269_lifebook_mic_autoswitch(codec);
13746 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13747 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13748 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13749 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13750 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13751 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13752 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13753 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13757 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13758 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13759 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13760 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13761 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13762 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13763 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13767 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13768 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13769 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13770 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13771 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13772 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13773 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13774 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13778 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13779 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13780 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13781 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13782 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13783 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13784 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13785 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13789 /* toggle speaker-output according to the hp-jack state */
13790 static void alc269_speaker_automute(struct hda_codec *codec)
13792 struct alc_spec *spec = codec->spec;
13793 unsigned int nid = spec->autocfg.hp_pins[0];
13794 unsigned int present;
13795 unsigned char bits;
13797 present = snd_hda_jack_detect(codec, nid);
13798 bits = present ? HDA_AMP_MUTE : 0;
13799 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13800 HDA_AMP_MUTE, bits);
13801 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13802 HDA_AMP_MUTE, bits);
13805 /* unsolicited event for HP jack sensing */
13806 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13809 switch (res >> 26) {
13810 case ALC880_HP_EVENT:
13811 alc269_speaker_automute(codec);
13813 case ALC880_MIC_EVENT:
13814 alc_mic_automute(codec);
13819 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13821 struct alc_spec *spec = codec->spec;
13822 spec->autocfg.hp_pins[0] = 0x15;
13823 spec->autocfg.speaker_pins[0] = 0x14;
13824 spec->ext_mic.pin = 0x18;
13825 spec->ext_mic.mux_idx = 0;
13826 spec->int_mic.pin = 0x12;
13827 spec->int_mic.mux_idx = 5;
13828 spec->auto_mic = 1;
13831 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13833 struct alc_spec *spec = codec->spec;
13834 spec->autocfg.hp_pins[0] = 0x15;
13835 spec->autocfg.speaker_pins[0] = 0x14;
13836 spec->ext_mic.pin = 0x18;
13837 spec->ext_mic.mux_idx = 0;
13838 spec->int_mic.pin = 0x12;
13839 spec->int_mic.mux_idx = 6;
13840 spec->auto_mic = 1;
13843 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13845 struct alc_spec *spec = codec->spec;
13846 spec->autocfg.hp_pins[0] = 0x15;
13847 spec->autocfg.speaker_pins[0] = 0x14;
13848 spec->ext_mic.pin = 0x18;
13849 spec->ext_mic.mux_idx = 0;
13850 spec->int_mic.pin = 0x19;
13851 spec->int_mic.mux_idx = 1;
13852 spec->auto_mic = 1;
13855 static void alc269_laptop_inithook(struct hda_codec *codec)
13857 alc269_speaker_automute(codec);
13858 alc_mic_automute(codec);
13862 * generic initialization of ADC, input mixers and output mixers
13864 static struct hda_verb alc269_init_verbs[] = {
13866 * Unmute ADC0 and set the default input to mic-in
13868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13871 * Set up output mixers (0x02 - 0x03)
13873 /* set vol=0 to output mixers */
13874 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13875 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13877 /* set up input amps for analog loopback */
13878 /* Amp Indices: DAC = 0, mixer = 1 */
13879 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13881 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13882 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13883 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13884 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13886 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13887 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13888 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13889 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13890 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13891 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13892 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13894 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13895 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13897 /* FIXME: use Mux-type input source selection */
13898 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13899 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13900 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13903 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13907 static struct hda_verb alc269vb_init_verbs[] = {
13909 * Unmute ADC0 and set the default input to mic-in
13911 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13914 * Set up output mixers (0x02 - 0x03)
13916 /* set vol=0 to output mixers */
13917 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13918 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13920 /* set up input amps for analog loopback */
13921 /* Amp Indices: DAC = 0, mixer = 1 */
13922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13923 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13924 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13925 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13926 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13927 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13929 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13930 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13931 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13932 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13933 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13934 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13935 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13937 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13938 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13940 /* FIXME: use Mux-type input source selection */
13941 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13942 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13943 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13946 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13950 #define alc269_auto_create_multi_out_ctls \
13951 alc268_auto_create_multi_out_ctls
13952 #define alc269_auto_create_input_ctls \
13953 alc268_auto_create_input_ctls
13955 #ifdef CONFIG_SND_HDA_POWER_SAVE
13956 #define alc269_loopbacks alc880_loopbacks
13959 /* pcm configuration: identical with ALC880 */
13960 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13961 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13962 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13963 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13965 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13969 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13970 /* NID is set in alc_build_pcms */
13972 .open = alc880_playback_pcm_open,
13973 .prepare = alc880_playback_pcm_prepare,
13974 .cleanup = alc880_playback_pcm_cleanup
13978 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13982 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13983 /* NID is set in alc_build_pcms */
13987 * BIOS auto configuration
13989 static int alc269_parse_auto_config(struct hda_codec *codec)
13991 struct alc_spec *spec = codec->spec;
13993 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13995 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14000 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14003 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14007 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14009 if (spec->autocfg.dig_outs)
14010 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
14012 if (spec->kctls.list)
14013 add_mixer(spec, spec->kctls.list);
14015 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14016 add_verb(spec, alc269vb_init_verbs);
14017 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14019 add_verb(spec, alc269_init_verbs);
14020 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14023 spec->num_mux_defs = 1;
14024 spec->input_mux = &spec->private_imux[0];
14025 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14026 sizeof(alc269_adc_candidates));
14028 /* set default input source */
14029 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14030 0, AC_VERB_SET_CONNECT_SEL,
14031 spec->input_mux->items[0].index);
14033 err = alc_auto_add_mic_boost(codec);
14037 if (!spec->cap_mixer && !spec->no_analog)
14038 set_capture_mixer(codec);
14043 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14044 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14045 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14048 /* init callback for auto-configuration model -- overriding the default init */
14049 static void alc269_auto_init(struct hda_codec *codec)
14051 struct alc_spec *spec = codec->spec;
14052 alc269_auto_init_multi_out(codec);
14053 alc269_auto_init_hp_out(codec);
14054 alc269_auto_init_analog_input(codec);
14055 if (spec->unsol_event)
14056 alc_inithook(codec);
14060 * configuration and preset
14062 static const char *alc269_models[ALC269_MODEL_LAST] = {
14063 [ALC269_BASIC] = "basic",
14064 [ALC269_QUANTA_FL1] = "quanta",
14065 [ALC269_AMIC] = "laptop-amic",
14066 [ALC269_DMIC] = "laptop-dmic",
14067 [ALC269_FUJITSU] = "fujitsu",
14068 [ALC269_LIFEBOOK] = "lifebook",
14069 [ALC269_AUTO] = "auto",
14072 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14073 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14074 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14076 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14077 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14078 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14079 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14080 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14081 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14082 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14083 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14084 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14085 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14086 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14087 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14088 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14089 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14090 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14091 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14092 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14093 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14094 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14095 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14096 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14097 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14098 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14099 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14100 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14101 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14102 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14103 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14104 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14105 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14106 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14107 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14108 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14109 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14110 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14111 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14112 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14114 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14116 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14117 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14118 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
14119 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14120 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14121 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14122 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14123 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14124 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14125 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14129 static struct alc_config_preset alc269_presets[] = {
14131 .mixers = { alc269_base_mixer },
14132 .init_verbs = { alc269_init_verbs },
14133 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14134 .dac_nids = alc269_dac_nids,
14136 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14137 .channel_mode = alc269_modes,
14138 .input_mux = &alc269_capture_source,
14140 [ALC269_QUANTA_FL1] = {
14141 .mixers = { alc269_quanta_fl1_mixer },
14142 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14143 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14144 .dac_nids = alc269_dac_nids,
14146 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14147 .channel_mode = alc269_modes,
14148 .input_mux = &alc269_capture_source,
14149 .unsol_event = alc269_quanta_fl1_unsol_event,
14150 .setup = alc269_quanta_fl1_setup,
14151 .init_hook = alc269_quanta_fl1_init_hook,
14154 .mixers = { alc269_laptop_mixer },
14155 .cap_mixer = alc269_laptop_analog_capture_mixer,
14156 .init_verbs = { alc269_init_verbs,
14157 alc269_laptop_amic_init_verbs },
14158 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14159 .dac_nids = alc269_dac_nids,
14161 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14162 .channel_mode = alc269_modes,
14163 .unsol_event = alc269_laptop_unsol_event,
14164 .setup = alc269_laptop_amic_setup,
14165 .init_hook = alc269_laptop_inithook,
14168 .mixers = { alc269_laptop_mixer },
14169 .cap_mixer = alc269_laptop_digital_capture_mixer,
14170 .init_verbs = { alc269_init_verbs,
14171 alc269_laptop_dmic_init_verbs },
14172 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14173 .dac_nids = alc269_dac_nids,
14175 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14176 .channel_mode = alc269_modes,
14177 .unsol_event = alc269_laptop_unsol_event,
14178 .setup = alc269_laptop_dmic_setup,
14179 .init_hook = alc269_laptop_inithook,
14181 [ALC269VB_AMIC] = {
14182 .mixers = { alc269vb_laptop_mixer },
14183 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14184 .init_verbs = { alc269vb_init_verbs,
14185 alc269vb_laptop_amic_init_verbs },
14186 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14187 .dac_nids = alc269_dac_nids,
14189 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14190 .channel_mode = alc269_modes,
14191 .unsol_event = alc269_laptop_unsol_event,
14192 .setup = alc269_laptop_amic_setup,
14193 .init_hook = alc269_laptop_inithook,
14195 [ALC269VB_DMIC] = {
14196 .mixers = { alc269vb_laptop_mixer },
14197 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14198 .init_verbs = { alc269vb_init_verbs,
14199 alc269vb_laptop_dmic_init_verbs },
14200 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14201 .dac_nids = alc269_dac_nids,
14203 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14204 .channel_mode = alc269_modes,
14205 .unsol_event = alc269_laptop_unsol_event,
14206 .setup = alc269vb_laptop_dmic_setup,
14207 .init_hook = alc269_laptop_inithook,
14209 [ALC269_FUJITSU] = {
14210 .mixers = { alc269_fujitsu_mixer },
14211 .cap_mixer = alc269_laptop_digital_capture_mixer,
14212 .init_verbs = { alc269_init_verbs,
14213 alc269_laptop_dmic_init_verbs },
14214 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14215 .dac_nids = alc269_dac_nids,
14217 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14218 .channel_mode = alc269_modes,
14219 .unsol_event = alc269_laptop_unsol_event,
14220 .setup = alc269_laptop_dmic_setup,
14221 .init_hook = alc269_laptop_inithook,
14223 [ALC269_LIFEBOOK] = {
14224 .mixers = { alc269_lifebook_mixer },
14225 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14226 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14227 .dac_nids = alc269_dac_nids,
14229 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14230 .channel_mode = alc269_modes,
14231 .input_mux = &alc269_capture_source,
14232 .unsol_event = alc269_lifebook_unsol_event,
14233 .init_hook = alc269_lifebook_init_hook,
14237 static int patch_alc269(struct hda_codec *codec)
14239 struct alc_spec *spec;
14242 int is_alc269vb = 0;
14244 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14248 codec->spec = spec;
14250 alc_auto_parse_customize_define(codec);
14252 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14253 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14254 spec->cdefine.platform_type == 1)
14255 alc_codec_rename(codec, "ALC271X");
14257 alc_codec_rename(codec, "ALC259");
14260 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14262 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14266 if (board_config < 0) {
14267 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14269 board_config = ALC269_AUTO;
14272 if (board_config == ALC269_AUTO) {
14273 /* automatic parse from the BIOS config */
14274 err = alc269_parse_auto_config(codec);
14280 "hda_codec: Cannot set up configuration "
14281 "from BIOS. Using base mode...\n");
14282 board_config = ALC269_BASIC;
14286 err = snd_hda_attach_beep_device(codec, 0x1);
14292 if (board_config != ALC269_AUTO)
14293 setup_preset(codec, &alc269_presets[board_config]);
14295 if (board_config == ALC269_QUANTA_FL1) {
14296 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14297 * fix the sample rate of analog I/O to 44.1kHz
14299 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14300 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14302 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14303 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14305 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14306 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14308 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14309 if (!is_alc269vb) {
14310 spec->adc_nids = alc269_adc_nids;
14311 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14312 spec->capsrc_nids = alc269_capsrc_nids;
14314 spec->adc_nids = alc269vb_adc_nids;
14315 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14316 spec->capsrc_nids = alc269vb_capsrc_nids;
14320 if (!spec->cap_mixer)
14321 set_capture_mixer(codec);
14322 if (spec->cdefine.enable_pcbeep)
14323 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14325 spec->vmaster_nid = 0x02;
14327 codec->patch_ops = alc_patch_ops;
14328 if (board_config == ALC269_AUTO)
14329 spec->init_hook = alc269_auto_init;
14330 #ifdef CONFIG_SND_HDA_POWER_SAVE
14331 if (!spec->loopback.amplist)
14332 spec->loopback.amplist = alc269_loopbacks;
14339 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14343 * set the path ways for 2 channel output
14344 * need to set the codec line out and mic 1 pin widgets to inputs
14346 static struct hda_verb alc861_threestack_ch2_init[] = {
14347 /* set pin widget 1Ah (line in) for input */
14348 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14349 /* set pin widget 18h (mic1/2) for input, for mic also enable
14352 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14354 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14356 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14357 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14363 * need to set the codec line out and mic 1 pin widgets to outputs
14365 static struct hda_verb alc861_threestack_ch6_init[] = {
14366 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14367 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14368 /* set pin widget 18h (mic1) for output (CLFE)*/
14369 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14371 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14372 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14374 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14376 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14377 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14382 static struct hda_channel_mode alc861_threestack_modes[2] = {
14383 { 2, alc861_threestack_ch2_init },
14384 { 6, alc861_threestack_ch6_init },
14386 /* Set mic1 as input and unmute the mixer */
14387 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14388 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14389 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14392 /* Set mic1 as output and mute mixer */
14393 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14394 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14395 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14399 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14400 { 2, alc861_uniwill_m31_ch2_init },
14401 { 4, alc861_uniwill_m31_ch4_init },
14404 /* Set mic1 and line-in as input and unmute the mixer */
14405 static struct hda_verb alc861_asus_ch2_init[] = {
14406 /* set pin widget 1Ah (line in) for input */
14407 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14408 /* set pin widget 18h (mic1/2) for input, for mic also enable
14411 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14413 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14415 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14416 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14420 /* Set mic1 nad line-in as output and mute mixer */
14421 static struct hda_verb alc861_asus_ch6_init[] = {
14422 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14423 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14424 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14425 /* set pin widget 18h (mic1) for output (CLFE)*/
14426 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14427 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14428 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14429 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14431 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14433 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14434 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14439 static struct hda_channel_mode alc861_asus_modes[2] = {
14440 { 2, alc861_asus_ch2_init },
14441 { 6, alc861_asus_ch6_init },
14446 static struct snd_kcontrol_new alc861_base_mixer[] = {
14447 /* output mixer control */
14448 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14449 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14450 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14451 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14452 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14454 /*Input mixer control */
14455 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14456 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14457 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14458 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14459 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14460 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14462 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14463 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14464 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14469 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14470 /* output mixer control */
14471 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14472 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14473 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14474 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14475 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14477 /* Input mixer control */
14478 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14479 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14480 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14481 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14482 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14483 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14485 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14486 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14487 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14490 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14491 .name = "Channel Mode",
14492 .info = alc_ch_mode_info,
14493 .get = alc_ch_mode_get,
14494 .put = alc_ch_mode_put,
14495 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14500 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14501 /* output mixer control */
14502 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14503 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14504 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14509 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14510 /* output mixer control */
14511 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14512 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14513 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14514 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14515 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14517 /* Input mixer control */
14518 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14519 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14520 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14521 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14522 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14523 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14525 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14526 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14527 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14530 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14531 .name = "Channel Mode",
14532 .info = alc_ch_mode_info,
14533 .get = alc_ch_mode_get,
14534 .put = alc_ch_mode_put,
14535 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14540 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14541 /* output mixer control */
14542 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14543 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14544 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14545 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14546 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14548 /* Input mixer control */
14549 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14550 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14551 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14552 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14553 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14554 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14555 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14556 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14557 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14562 .name = "Channel Mode",
14563 .info = alc_ch_mode_info,
14564 .get = alc_ch_mode_get,
14565 .put = alc_ch_mode_put,
14566 .private_value = ARRAY_SIZE(alc861_asus_modes),
14571 /* additional mixer */
14572 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14573 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14574 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14579 * generic initialization of ADC, input mixers and output mixers
14581 static struct hda_verb alc861_base_init_verbs[] = {
14583 * Unmute ADC0 and set the default input to mic-in
14585 /* port-A for surround (rear panel) */
14586 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14587 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14588 /* port-B for mic-in (rear panel) with vref */
14589 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14590 /* port-C for line-in (rear panel) */
14591 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14592 /* port-D for Front */
14593 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14594 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14595 /* port-E for HP out (front panel) */
14596 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14597 /* route front PCM to HP */
14598 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14599 /* port-F for mic-in (front panel) with vref */
14600 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14601 /* port-G for CLFE (rear panel) */
14602 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14603 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14604 /* port-H for side (rear panel) */
14605 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14606 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14608 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14609 /* route front mic to ADC1*/
14610 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14613 /* Unmute DAC0~3 & spdif out*/
14614 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14615 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14616 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14617 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14620 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14621 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14622 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14623 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14624 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14626 /* Unmute Stereo Mixer 15 */
14627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14632 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14633 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14634 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14635 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14636 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14637 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14639 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14640 /* hp used DAC 3 (Front) */
14641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14642 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14647 static struct hda_verb alc861_threestack_init_verbs[] = {
14649 * Unmute ADC0 and set the default input to mic-in
14651 /* port-A for surround (rear panel) */
14652 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14653 /* port-B for mic-in (rear panel) with vref */
14654 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14655 /* port-C for line-in (rear panel) */
14656 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14657 /* port-D for Front */
14658 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14659 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14660 /* port-E for HP out (front panel) */
14661 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14662 /* route front PCM to HP */
14663 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14664 /* port-F for mic-in (front panel) with vref */
14665 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14666 /* port-G for CLFE (rear panel) */
14667 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14668 /* port-H for side (rear panel) */
14669 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14671 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14672 /* route front mic to ADC1*/
14673 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14674 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14675 /* Unmute DAC0~3 & spdif out*/
14676 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14677 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14678 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14679 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14680 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14682 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14683 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14684 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14685 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14686 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14688 /* Unmute Stereo Mixer 15 */
14689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14694 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14695 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14696 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14697 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14698 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14699 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14700 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14701 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14702 /* hp used DAC 3 (Front) */
14703 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14704 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14708 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14710 * Unmute ADC0 and set the default input to mic-in
14712 /* port-A for surround (rear panel) */
14713 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14714 /* port-B for mic-in (rear panel) with vref */
14715 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14716 /* port-C for line-in (rear panel) */
14717 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14718 /* port-D for Front */
14719 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14720 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14721 /* port-E for HP out (front panel) */
14722 /* this has to be set to VREF80 */
14723 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14724 /* route front PCM to HP */
14725 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14726 /* port-F for mic-in (front panel) with vref */
14727 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14728 /* port-G for CLFE (rear panel) */
14729 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14730 /* port-H for side (rear panel) */
14731 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14733 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14734 /* route front mic to ADC1*/
14735 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14736 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14737 /* Unmute DAC0~3 & spdif out*/
14738 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14739 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14740 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14741 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14744 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14745 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14746 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14747 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14748 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14750 /* Unmute Stereo Mixer 15 */
14751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14754 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14756 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14757 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14758 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14759 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14761 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14762 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14763 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14764 /* hp used DAC 3 (Front) */
14765 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14770 static struct hda_verb alc861_asus_init_verbs[] = {
14772 * Unmute ADC0 and set the default input to mic-in
14774 /* port-A for surround (rear panel)
14775 * according to codec#0 this is the HP jack
14777 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14778 /* route front PCM to HP */
14779 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14780 /* port-B for mic-in (rear panel) with vref */
14781 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14782 /* port-C for line-in (rear panel) */
14783 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14784 /* port-D for Front */
14785 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14786 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14787 /* port-E for HP out (front panel) */
14788 /* this has to be set to VREF80 */
14789 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14790 /* route front PCM to HP */
14791 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14792 /* port-F for mic-in (front panel) with vref */
14793 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14794 /* port-G for CLFE (rear panel) */
14795 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14796 /* port-H for side (rear panel) */
14797 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14799 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14800 /* route front mic to ADC1*/
14801 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14803 /* Unmute DAC0~3 & spdif out*/
14804 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14805 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14806 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14807 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14808 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14809 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14810 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14811 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14812 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14813 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14815 /* Unmute Stereo Mixer 15 */
14816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14818 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14821 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14822 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14823 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14824 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14826 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14827 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14828 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14829 /* hp used DAC 3 (Front) */
14830 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14835 /* additional init verbs for ASUS laptops */
14836 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14837 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14838 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14843 * generic initialization of ADC, input mixers and output mixers
14845 static struct hda_verb alc861_auto_init_verbs[] = {
14847 * Unmute ADC0 and set the default input to mic-in
14849 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14850 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14852 /* Unmute DAC0~3 & spdif out*/
14853 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14854 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14855 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14856 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14859 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14860 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14861 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14862 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14863 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14865 /* Unmute Stereo Mixer 15 */
14866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14867 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14868 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14872 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14873 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14874 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14877 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14878 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14881 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14882 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14884 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14885 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14886 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14887 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14889 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14894 static struct hda_verb alc861_toshiba_init_verbs[] = {
14895 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14900 /* toggle speaker-output according to the hp-jack state */
14901 static void alc861_toshiba_automute(struct hda_codec *codec)
14903 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14905 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14906 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14907 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14908 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14911 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14914 if ((res >> 26) == ALC880_HP_EVENT)
14915 alc861_toshiba_automute(codec);
14918 /* pcm configuration: identical with ALC880 */
14919 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14920 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14921 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14922 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14925 #define ALC861_DIGOUT_NID 0x07
14927 static struct hda_channel_mode alc861_8ch_modes[1] = {
14931 static hda_nid_t alc861_dac_nids[4] = {
14932 /* front, surround, clfe, side */
14933 0x03, 0x06, 0x05, 0x04
14936 static hda_nid_t alc660_dac_nids[3] = {
14937 /* front, clfe, surround */
14941 static hda_nid_t alc861_adc_nids[1] = {
14946 static struct hda_input_mux alc861_capture_source = {
14950 { "Front Mic", 0x3 },
14957 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14959 struct alc_spec *spec = codec->spec;
14960 hda_nid_t mix, srcs[5];
14963 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14965 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14968 for (i = 0; i < num; i++) {
14970 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14971 if (type != AC_WID_AUD_OUT)
14973 for (j = 0; j < spec->multiout.num_dacs; j++)
14974 if (spec->multiout.dac_nids[j] == srcs[i])
14976 if (j >= spec->multiout.num_dacs)
14982 /* fill in the dac_nids table from the parsed pin configuration */
14983 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14984 const struct auto_pin_cfg *cfg)
14986 struct alc_spec *spec = codec->spec;
14988 hda_nid_t nid, dac;
14990 spec->multiout.dac_nids = spec->private_dac_nids;
14991 for (i = 0; i < cfg->line_outs; i++) {
14992 nid = cfg->line_out_pins[i];
14993 dac = alc861_look_for_dac(codec, nid);
14996 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15001 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15002 hda_nid_t nid, unsigned int chs)
15004 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15005 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15008 /* add playback controls from the parsed DAC table */
15009 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15010 const struct auto_pin_cfg *cfg)
15012 struct alc_spec *spec = codec->spec;
15013 static const char *chname[4] = {
15014 "Front", "Surround", NULL /*CLFE*/, "Side"
15019 if (cfg->line_outs == 1) {
15020 const char *pfx = NULL;
15023 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15026 nid = spec->multiout.dac_nids[0];
15027 return alc861_create_out_sw(codec, pfx, nid, 3);
15031 for (i = 0; i < cfg->line_outs; i++) {
15032 nid = spec->multiout.dac_nids[i];
15037 err = alc861_create_out_sw(codec, "Center", nid, 1);
15040 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15044 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15052 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15054 struct alc_spec *spec = codec->spec;
15061 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15062 nid = alc861_look_for_dac(codec, pin);
15064 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15067 spec->multiout.hp_nid = nid;
15073 /* create playback/capture controls for input pins */
15074 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15075 const struct auto_pin_cfg *cfg)
15077 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15080 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15082 int pin_type, hda_nid_t dac)
15084 hda_nid_t mix, srcs[5];
15087 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15089 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15091 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15093 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15096 for (i = 0; i < num; i++) {
15098 if (srcs[i] == dac || srcs[i] == 0x15)
15099 mute = AMP_IN_UNMUTE(i);
15101 mute = AMP_IN_MUTE(i);
15102 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15107 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15109 struct alc_spec *spec = codec->spec;
15112 for (i = 0; i < spec->autocfg.line_outs; i++) {
15113 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15114 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15116 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15117 spec->multiout.dac_nids[i]);
15121 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15123 struct alc_spec *spec = codec->spec;
15125 if (spec->autocfg.hp_outs)
15126 alc861_auto_set_output_and_unmute(codec,
15127 spec->autocfg.hp_pins[0],
15129 spec->multiout.hp_nid);
15130 if (spec->autocfg.speaker_outs)
15131 alc861_auto_set_output_and_unmute(codec,
15132 spec->autocfg.speaker_pins[0],
15134 spec->multiout.dac_nids[0]);
15137 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15139 struct alc_spec *spec = codec->spec;
15142 for (i = 0; i < AUTO_PIN_LAST; i++) {
15143 hda_nid_t nid = spec->autocfg.input_pins[i];
15144 if (nid >= 0x0c && nid <= 0x11)
15145 alc_set_input_pin(codec, nid, i);
15149 /* parse the BIOS configuration and set up the alc_spec */
15150 /* return 1 if successful, 0 if the proper config is not found,
15151 * or a negative error code
15153 static int alc861_parse_auto_config(struct hda_codec *codec)
15155 struct alc_spec *spec = codec->spec;
15157 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15159 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15163 if (!spec->autocfg.line_outs)
15164 return 0; /* can't find valid BIOS pin config */
15166 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15169 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15172 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15175 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15179 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15181 if (spec->autocfg.dig_outs)
15182 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15184 if (spec->kctls.list)
15185 add_mixer(spec, spec->kctls.list);
15187 add_verb(spec, alc861_auto_init_verbs);
15189 spec->num_mux_defs = 1;
15190 spec->input_mux = &spec->private_imux[0];
15192 spec->adc_nids = alc861_adc_nids;
15193 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15194 set_capture_mixer(codec);
15196 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15201 /* additional initialization for auto-configuration model */
15202 static void alc861_auto_init(struct hda_codec *codec)
15204 struct alc_spec *spec = codec->spec;
15205 alc861_auto_init_multi_out(codec);
15206 alc861_auto_init_hp_out(codec);
15207 alc861_auto_init_analog_input(codec);
15208 if (spec->unsol_event)
15209 alc_inithook(codec);
15212 #ifdef CONFIG_SND_HDA_POWER_SAVE
15213 static struct hda_amp_list alc861_loopbacks[] = {
15214 { 0x15, HDA_INPUT, 0 },
15215 { 0x15, HDA_INPUT, 1 },
15216 { 0x15, HDA_INPUT, 2 },
15217 { 0x15, HDA_INPUT, 3 },
15224 * configuration and preset
15226 static const char *alc861_models[ALC861_MODEL_LAST] = {
15227 [ALC861_3ST] = "3stack",
15228 [ALC660_3ST] = "3stack-660",
15229 [ALC861_3ST_DIG] = "3stack-dig",
15230 [ALC861_6ST_DIG] = "6stack-dig",
15231 [ALC861_UNIWILL_M31] = "uniwill-m31",
15232 [ALC861_TOSHIBA] = "toshiba",
15233 [ALC861_ASUS] = "asus",
15234 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15235 [ALC861_AUTO] = "auto",
15238 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15239 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15240 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15241 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15242 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15243 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15244 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15245 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15246 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15247 * Any other models that need this preset?
15249 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15250 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15251 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15252 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15253 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15254 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15255 /* FIXME: the below seems conflict */
15256 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15257 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15258 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15262 static struct alc_config_preset alc861_presets[] = {
15264 .mixers = { alc861_3ST_mixer },
15265 .init_verbs = { alc861_threestack_init_verbs },
15266 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15267 .dac_nids = alc861_dac_nids,
15268 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15269 .channel_mode = alc861_threestack_modes,
15271 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15272 .adc_nids = alc861_adc_nids,
15273 .input_mux = &alc861_capture_source,
15275 [ALC861_3ST_DIG] = {
15276 .mixers = { alc861_base_mixer },
15277 .init_verbs = { alc861_threestack_init_verbs },
15278 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15279 .dac_nids = alc861_dac_nids,
15280 .dig_out_nid = ALC861_DIGOUT_NID,
15281 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15282 .channel_mode = alc861_threestack_modes,
15284 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15285 .adc_nids = alc861_adc_nids,
15286 .input_mux = &alc861_capture_source,
15288 [ALC861_6ST_DIG] = {
15289 .mixers = { alc861_base_mixer },
15290 .init_verbs = { alc861_base_init_verbs },
15291 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15292 .dac_nids = alc861_dac_nids,
15293 .dig_out_nid = ALC861_DIGOUT_NID,
15294 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15295 .channel_mode = alc861_8ch_modes,
15296 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15297 .adc_nids = alc861_adc_nids,
15298 .input_mux = &alc861_capture_source,
15301 .mixers = { alc861_3ST_mixer },
15302 .init_verbs = { alc861_threestack_init_verbs },
15303 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15304 .dac_nids = alc660_dac_nids,
15305 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15306 .channel_mode = alc861_threestack_modes,
15308 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15309 .adc_nids = alc861_adc_nids,
15310 .input_mux = &alc861_capture_source,
15312 [ALC861_UNIWILL_M31] = {
15313 .mixers = { alc861_uniwill_m31_mixer },
15314 .init_verbs = { alc861_uniwill_m31_init_verbs },
15315 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15316 .dac_nids = alc861_dac_nids,
15317 .dig_out_nid = ALC861_DIGOUT_NID,
15318 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15319 .channel_mode = alc861_uniwill_m31_modes,
15321 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15322 .adc_nids = alc861_adc_nids,
15323 .input_mux = &alc861_capture_source,
15325 [ALC861_TOSHIBA] = {
15326 .mixers = { alc861_toshiba_mixer },
15327 .init_verbs = { alc861_base_init_verbs,
15328 alc861_toshiba_init_verbs },
15329 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15330 .dac_nids = alc861_dac_nids,
15331 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15332 .channel_mode = alc883_3ST_2ch_modes,
15333 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15334 .adc_nids = alc861_adc_nids,
15335 .input_mux = &alc861_capture_source,
15336 .unsol_event = alc861_toshiba_unsol_event,
15337 .init_hook = alc861_toshiba_automute,
15340 .mixers = { alc861_asus_mixer },
15341 .init_verbs = { alc861_asus_init_verbs },
15342 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15343 .dac_nids = alc861_dac_nids,
15344 .dig_out_nid = ALC861_DIGOUT_NID,
15345 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15346 .channel_mode = alc861_asus_modes,
15349 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15350 .adc_nids = alc861_adc_nids,
15351 .input_mux = &alc861_capture_source,
15353 [ALC861_ASUS_LAPTOP] = {
15354 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15355 .init_verbs = { alc861_asus_init_verbs,
15356 alc861_asus_laptop_init_verbs },
15357 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15358 .dac_nids = alc861_dac_nids,
15359 .dig_out_nid = ALC861_DIGOUT_NID,
15360 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15361 .channel_mode = alc883_3ST_2ch_modes,
15363 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15364 .adc_nids = alc861_adc_nids,
15365 .input_mux = &alc861_capture_source,
15369 /* Pin config fixes */
15371 PINFIX_FSC_AMILO_PI1505,
15374 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15375 { 0x0b, 0x0221101f }, /* HP */
15376 { 0x0f, 0x90170310 }, /* speaker */
15380 static const struct alc_fixup alc861_fixups[] = {
15381 [PINFIX_FSC_AMILO_PI1505] = {
15382 .pins = alc861_fsc_amilo_pi1505_pinfix
15386 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15387 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15391 static int patch_alc861(struct hda_codec *codec)
15393 struct alc_spec *spec;
15397 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15401 codec->spec = spec;
15403 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15407 if (board_config < 0) {
15408 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15410 board_config = ALC861_AUTO;
15413 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15415 if (board_config == ALC861_AUTO) {
15416 /* automatic parse from the BIOS config */
15417 err = alc861_parse_auto_config(codec);
15423 "hda_codec: Cannot set up configuration "
15424 "from BIOS. Using base mode...\n");
15425 board_config = ALC861_3ST_DIG;
15429 err = snd_hda_attach_beep_device(codec, 0x23);
15435 if (board_config != ALC861_AUTO)
15436 setup_preset(codec, &alc861_presets[board_config]);
15438 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15439 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15441 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15442 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15444 if (!spec->cap_mixer)
15445 set_capture_mixer(codec);
15446 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15448 spec->vmaster_nid = 0x03;
15450 codec->patch_ops = alc_patch_ops;
15451 if (board_config == ALC861_AUTO) {
15452 spec->init_hook = alc861_auto_init;
15453 #ifdef CONFIG_SND_HDA_POWER_SAVE
15454 spec->power_hook = alc_power_eapd;
15457 #ifdef CONFIG_SND_HDA_POWER_SAVE
15458 if (!spec->loopback.amplist)
15459 spec->loopback.amplist = alc861_loopbacks;
15466 * ALC861-VD support
15470 * In addition, an independent DAC
15472 #define ALC861VD_DIGOUT_NID 0x06
15474 static hda_nid_t alc861vd_dac_nids[4] = {
15475 /* front, surr, clfe, side surr */
15476 0x02, 0x03, 0x04, 0x05
15479 /* dac_nids for ALC660vd are in a different order - according to
15480 * Realtek's driver.
15481 * This should probably result in a different mixer for 6stack models
15482 * of ALC660vd codecs, but for now there is only 3stack mixer
15483 * - and it is the same as in 861vd.
15484 * adc_nids in ALC660vd are (is) the same as in 861vd
15486 static hda_nid_t alc660vd_dac_nids[3] = {
15487 /* front, rear, clfe, rear_surr */
15491 static hda_nid_t alc861vd_adc_nids[1] = {
15496 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15499 /* FIXME: should be a matrix-type input source selection */
15500 static struct hda_input_mux alc861vd_capture_source = {
15504 { "Front Mic", 0x1 },
15510 static struct hda_input_mux alc861vd_dallas_capture_source = {
15513 { "Ext Mic", 0x0 },
15514 { "Int Mic", 0x1 },
15518 static struct hda_input_mux alc861vd_hp_capture_source = {
15521 { "Front Mic", 0x0 },
15522 { "ATAPI Mic", 0x1 },
15529 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15536 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15537 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15538 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15539 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15540 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15547 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15548 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15549 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15550 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15551 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15555 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15556 { 6, alc861vd_6stack_ch6_init },
15557 { 8, alc861vd_6stack_ch8_init },
15560 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15562 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15563 .name = "Channel Mode",
15564 .info = alc_ch_mode_info,
15565 .get = alc_ch_mode_get,
15566 .put = alc_ch_mode_put,
15571 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15572 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15574 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15575 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15576 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15578 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15579 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15581 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15583 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15585 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15586 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15588 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15589 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15591 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15593 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15595 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15597 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15598 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15599 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15604 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15605 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15610 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15611 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15612 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15614 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15616 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15620 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15621 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15622 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15624 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15625 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15627 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15628 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15633 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15634 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15635 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15636 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15640 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15644 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15645 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15646 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15648 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15649 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15654 /* Pin assignment: Speaker=0x14, HP = 0x15,
15655 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15657 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15658 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15659 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15660 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15661 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15662 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15663 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15664 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15665 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15666 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15667 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15671 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15672 * Front Mic=0x18, ATAPI Mic = 0x19,
15674 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15675 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15676 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15677 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15678 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15679 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15680 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15681 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15682 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15688 * generic initialization of ADC, input mixers and output mixers
15690 static struct hda_verb alc861vd_volume_init_verbs[] = {
15692 * Unmute ADC0 and set the default input to mic-in
15694 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15695 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15697 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15698 * the analog-loopback mixer widget
15700 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15701 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15705 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15707 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15714 * Set up output mixers (0x02 - 0x05)
15716 /* set vol=0 to output mixers */
15717 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15718 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15719 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15720 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15722 /* set up input amps for analog loopback */
15723 /* Amp Indices: DAC = 0, mixer = 1 */
15724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15726 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15727 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15728 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15729 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15731 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15737 * 3-stack pin configuration:
15738 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15740 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15742 * Set pin mode and muting
15744 /* set front pin widgets 0x14 for output */
15745 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15746 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15747 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15749 /* Mic (rear) pin: input vref at 80% */
15750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15752 /* Front Mic pin: input vref at 80% */
15753 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15754 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15755 /* Line In pin: input */
15756 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15757 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15758 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15759 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15760 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15761 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15762 /* CD pin widget for input */
15763 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15769 * 6-stack pin configuration:
15771 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15773 * Set pin mode and muting
15775 /* set front pin widgets 0x14 for output */
15776 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15777 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15778 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15780 /* Rear Pin: output 1 (0x0d) */
15781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15782 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15783 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15784 /* CLFE Pin: output 2 (0x0e) */
15785 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15786 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15787 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15788 /* Side Pin: output 3 (0x0f) */
15789 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15790 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15791 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15793 /* Mic (rear) pin: input vref at 80% */
15794 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15796 /* Front Mic pin: input vref at 80% */
15797 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15798 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15799 /* Line In pin: input */
15800 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15801 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15802 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15803 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15804 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15805 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15806 /* CD pin widget for input */
15807 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15812 static struct hda_verb alc861vd_eapd_verbs[] = {
15813 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15817 static struct hda_verb alc660vd_eapd_verbs[] = {
15818 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15819 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15823 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15824 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15825 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15826 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15827 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15828 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15832 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15834 unsigned int present;
15835 unsigned char bits;
15837 present = snd_hda_jack_detect(codec, 0x18);
15838 bits = present ? HDA_AMP_MUTE : 0;
15840 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15841 HDA_AMP_MUTE, bits);
15844 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15846 struct alc_spec *spec = codec->spec;
15847 spec->autocfg.hp_pins[0] = 0x1b;
15848 spec->autocfg.speaker_pins[0] = 0x14;
15851 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15853 alc_automute_amp(codec);
15854 alc861vd_lenovo_mic_automute(codec);
15857 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15860 switch (res >> 26) {
15861 case ALC880_MIC_EVENT:
15862 alc861vd_lenovo_mic_automute(codec);
15865 alc_automute_amp_unsol_event(codec, res);
15870 static struct hda_verb alc861vd_dallas_verbs[] = {
15871 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15872 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15873 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15874 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15877 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15879 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15881 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15882 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15883 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15886 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15887 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15889 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15890 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15891 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15892 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15894 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15895 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15896 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15897 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15898 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15899 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15900 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15901 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15904 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15905 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15908 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15909 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15910 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15915 /* toggle speaker-output according to the hp-jack state */
15916 static void alc861vd_dallas_setup(struct hda_codec *codec)
15918 struct alc_spec *spec = codec->spec;
15920 spec->autocfg.hp_pins[0] = 0x15;
15921 spec->autocfg.speaker_pins[0] = 0x14;
15924 #ifdef CONFIG_SND_HDA_POWER_SAVE
15925 #define alc861vd_loopbacks alc880_loopbacks
15928 /* pcm configuration: identical with ALC880 */
15929 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15930 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15931 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15932 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15935 * configuration and preset
15937 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15938 [ALC660VD_3ST] = "3stack-660",
15939 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15940 [ALC660VD_ASUS_V1S] = "asus-v1s",
15941 [ALC861VD_3ST] = "3stack",
15942 [ALC861VD_3ST_DIG] = "3stack-digout",
15943 [ALC861VD_6ST_DIG] = "6stack-digout",
15944 [ALC861VD_LENOVO] = "lenovo",
15945 [ALC861VD_DALLAS] = "dallas",
15946 [ALC861VD_HP] = "hp",
15947 [ALC861VD_AUTO] = "auto",
15950 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15951 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15952 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15953 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15954 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15955 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15956 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15957 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15958 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15959 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15960 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15961 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15962 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15963 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15964 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15965 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15969 static struct alc_config_preset alc861vd_presets[] = {
15971 .mixers = { alc861vd_3st_mixer },
15972 .init_verbs = { alc861vd_volume_init_verbs,
15973 alc861vd_3stack_init_verbs },
15974 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15975 .dac_nids = alc660vd_dac_nids,
15976 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15977 .channel_mode = alc861vd_3stack_2ch_modes,
15978 .input_mux = &alc861vd_capture_source,
15980 [ALC660VD_3ST_DIG] = {
15981 .mixers = { alc861vd_3st_mixer },
15982 .init_verbs = { alc861vd_volume_init_verbs,
15983 alc861vd_3stack_init_verbs },
15984 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15985 .dac_nids = alc660vd_dac_nids,
15986 .dig_out_nid = ALC861VD_DIGOUT_NID,
15987 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15988 .channel_mode = alc861vd_3stack_2ch_modes,
15989 .input_mux = &alc861vd_capture_source,
15992 .mixers = { alc861vd_3st_mixer },
15993 .init_verbs = { alc861vd_volume_init_verbs,
15994 alc861vd_3stack_init_verbs },
15995 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15996 .dac_nids = alc861vd_dac_nids,
15997 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15998 .channel_mode = alc861vd_3stack_2ch_modes,
15999 .input_mux = &alc861vd_capture_source,
16001 [ALC861VD_3ST_DIG] = {
16002 .mixers = { alc861vd_3st_mixer },
16003 .init_verbs = { alc861vd_volume_init_verbs,
16004 alc861vd_3stack_init_verbs },
16005 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16006 .dac_nids = alc861vd_dac_nids,
16007 .dig_out_nid = ALC861VD_DIGOUT_NID,
16008 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16009 .channel_mode = alc861vd_3stack_2ch_modes,
16010 .input_mux = &alc861vd_capture_source,
16012 [ALC861VD_6ST_DIG] = {
16013 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16014 .init_verbs = { alc861vd_volume_init_verbs,
16015 alc861vd_6stack_init_verbs },
16016 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16017 .dac_nids = alc861vd_dac_nids,
16018 .dig_out_nid = ALC861VD_DIGOUT_NID,
16019 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16020 .channel_mode = alc861vd_6stack_modes,
16021 .input_mux = &alc861vd_capture_source,
16023 [ALC861VD_LENOVO] = {
16024 .mixers = { alc861vd_lenovo_mixer },
16025 .init_verbs = { alc861vd_volume_init_verbs,
16026 alc861vd_3stack_init_verbs,
16027 alc861vd_eapd_verbs,
16028 alc861vd_lenovo_unsol_verbs },
16029 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16030 .dac_nids = alc660vd_dac_nids,
16031 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16032 .channel_mode = alc861vd_3stack_2ch_modes,
16033 .input_mux = &alc861vd_capture_source,
16034 .unsol_event = alc861vd_lenovo_unsol_event,
16035 .setup = alc861vd_lenovo_setup,
16036 .init_hook = alc861vd_lenovo_init_hook,
16038 [ALC861VD_DALLAS] = {
16039 .mixers = { alc861vd_dallas_mixer },
16040 .init_verbs = { alc861vd_dallas_verbs },
16041 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16042 .dac_nids = alc861vd_dac_nids,
16043 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16044 .channel_mode = alc861vd_3stack_2ch_modes,
16045 .input_mux = &alc861vd_dallas_capture_source,
16046 .unsol_event = alc_automute_amp_unsol_event,
16047 .setup = alc861vd_dallas_setup,
16048 .init_hook = alc_automute_amp,
16051 .mixers = { alc861vd_hp_mixer },
16052 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16053 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16054 .dac_nids = alc861vd_dac_nids,
16055 .dig_out_nid = ALC861VD_DIGOUT_NID,
16056 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16057 .channel_mode = alc861vd_3stack_2ch_modes,
16058 .input_mux = &alc861vd_hp_capture_source,
16059 .unsol_event = alc_automute_amp_unsol_event,
16060 .setup = alc861vd_dallas_setup,
16061 .init_hook = alc_automute_amp,
16063 [ALC660VD_ASUS_V1S] = {
16064 .mixers = { alc861vd_lenovo_mixer },
16065 .init_verbs = { alc861vd_volume_init_verbs,
16066 alc861vd_3stack_init_verbs,
16067 alc861vd_eapd_verbs,
16068 alc861vd_lenovo_unsol_verbs },
16069 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16070 .dac_nids = alc660vd_dac_nids,
16071 .dig_out_nid = ALC861VD_DIGOUT_NID,
16072 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16073 .channel_mode = alc861vd_3stack_2ch_modes,
16074 .input_mux = &alc861vd_capture_source,
16075 .unsol_event = alc861vd_lenovo_unsol_event,
16076 .setup = alc861vd_lenovo_setup,
16077 .init_hook = alc861vd_lenovo_init_hook,
16082 * BIOS auto configuration
16084 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16085 const struct auto_pin_cfg *cfg)
16087 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16091 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16092 hda_nid_t nid, int pin_type, int dac_idx)
16094 alc_set_pin_output(codec, nid, pin_type);
16097 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16099 struct alc_spec *spec = codec->spec;
16102 for (i = 0; i <= HDA_SIDE; i++) {
16103 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16104 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16106 alc861vd_auto_set_output_and_unmute(codec, nid,
16112 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16114 struct alc_spec *spec = codec->spec;
16117 pin = spec->autocfg.hp_pins[0];
16118 if (pin) /* connect to front and use dac 0 */
16119 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16120 pin = spec->autocfg.speaker_pins[0];
16122 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16125 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16127 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16129 struct alc_spec *spec = codec->spec;
16132 for (i = 0; i < AUTO_PIN_LAST; i++) {
16133 hda_nid_t nid = spec->autocfg.input_pins[i];
16134 if (alc_is_input_pin(codec, nid)) {
16135 alc_set_input_pin(codec, nid, i);
16136 if (nid != ALC861VD_PIN_CD_NID &&
16137 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16138 snd_hda_codec_write(codec, nid, 0,
16139 AC_VERB_SET_AMP_GAIN_MUTE,
16145 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16147 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16148 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16150 /* add playback controls from the parsed DAC table */
16151 /* Based on ALC880 version. But ALC861VD has separate,
16152 * different NIDs for mute/unmute switch and volume control */
16153 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16154 const struct auto_pin_cfg *cfg)
16156 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16157 hda_nid_t nid_v, nid_s;
16160 for (i = 0; i < cfg->line_outs; i++) {
16161 if (!spec->multiout.dac_nids[i])
16163 nid_v = alc861vd_idx_to_mixer_vol(
16165 spec->multiout.dac_nids[i]));
16166 nid_s = alc861vd_idx_to_mixer_switch(
16168 spec->multiout.dac_nids[i]));
16172 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16174 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16178 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16180 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16184 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16186 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16190 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16192 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16198 if (cfg->line_outs == 1 &&
16199 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16206 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16207 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16211 if (cfg->line_outs == 1 &&
16212 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16214 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16215 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16224 /* add playback controls for speaker and HP outputs */
16225 /* Based on ALC880 version. But ALC861VD has separate,
16226 * different NIDs for mute/unmute switch and volume control */
16227 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16228 hda_nid_t pin, const char *pfx)
16230 hda_nid_t nid_v, nid_s;
16236 if (alc880_is_fixed_pin(pin)) {
16237 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16238 /* specify the DAC as the extra output */
16239 if (!spec->multiout.hp_nid)
16240 spec->multiout.hp_nid = nid_v;
16242 spec->multiout.extra_out_nid[0] = nid_v;
16243 /* control HP volume/switch on the output mixer amp */
16244 nid_v = alc861vd_idx_to_mixer_vol(
16245 alc880_fixed_pin_idx(pin));
16246 nid_s = alc861vd_idx_to_mixer_switch(
16247 alc880_fixed_pin_idx(pin));
16249 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16250 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16253 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16254 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16257 } else if (alc880_is_multi_pin(pin)) {
16258 /* set manual connection */
16259 /* we have only a switch on HP-out PIN */
16260 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16261 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16268 /* parse the BIOS configuration and set up the alc_spec
16269 * return 1 if successful, 0 if the proper config is not found,
16270 * or a negative error code
16271 * Based on ALC880 version - had to change it to override
16272 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16273 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16275 struct alc_spec *spec = codec->spec;
16277 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16279 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16283 if (!spec->autocfg.line_outs)
16284 return 0; /* can't find valid BIOS pin config */
16286 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16289 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16292 err = alc861vd_auto_create_extra_out(spec,
16293 spec->autocfg.speaker_pins[0],
16297 err = alc861vd_auto_create_extra_out(spec,
16298 spec->autocfg.hp_pins[0],
16302 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16306 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16308 if (spec->autocfg.dig_outs)
16309 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16311 if (spec->kctls.list)
16312 add_mixer(spec, spec->kctls.list);
16314 add_verb(spec, alc861vd_volume_init_verbs);
16316 spec->num_mux_defs = 1;
16317 spec->input_mux = &spec->private_imux[0];
16319 err = alc_auto_add_mic_boost(codec);
16323 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16328 /* additional initialization for auto-configuration model */
16329 static void alc861vd_auto_init(struct hda_codec *codec)
16331 struct alc_spec *spec = codec->spec;
16332 alc861vd_auto_init_multi_out(codec);
16333 alc861vd_auto_init_hp_out(codec);
16334 alc861vd_auto_init_analog_input(codec);
16335 alc861vd_auto_init_input_src(codec);
16336 if (spec->unsol_event)
16337 alc_inithook(codec);
16341 ALC660VD_FIX_ASUS_GPIO1
16345 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16346 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16347 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16348 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16352 static const struct alc_fixup alc861vd_fixups[] = {
16353 [ALC660VD_FIX_ASUS_GPIO1] = {
16354 .verbs = alc660vd_fix_asus_gpio1_verbs,
16358 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16359 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16363 static int patch_alc861vd(struct hda_codec *codec)
16365 struct alc_spec *spec;
16366 int err, board_config;
16368 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16372 codec->spec = spec;
16374 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16378 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16379 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16381 board_config = ALC861VD_AUTO;
16384 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16386 if (board_config == ALC861VD_AUTO) {
16387 /* automatic parse from the BIOS config */
16388 err = alc861vd_parse_auto_config(codec);
16394 "hda_codec: Cannot set up configuration "
16395 "from BIOS. Using base mode...\n");
16396 board_config = ALC861VD_3ST;
16400 err = snd_hda_attach_beep_device(codec, 0x23);
16406 if (board_config != ALC861VD_AUTO)
16407 setup_preset(codec, &alc861vd_presets[board_config]);
16409 if (codec->vendor_id == 0x10ec0660) {
16410 /* always turn on EAPD */
16411 add_verb(spec, alc660vd_eapd_verbs);
16414 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16415 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16417 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16418 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16420 if (!spec->adc_nids) {
16421 spec->adc_nids = alc861vd_adc_nids;
16422 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16424 if (!spec->capsrc_nids)
16425 spec->capsrc_nids = alc861vd_capsrc_nids;
16427 set_capture_mixer(codec);
16428 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16430 spec->vmaster_nid = 0x02;
16432 codec->patch_ops = alc_patch_ops;
16434 if (board_config == ALC861VD_AUTO)
16435 spec->init_hook = alc861vd_auto_init;
16436 #ifdef CONFIG_SND_HDA_POWER_SAVE
16437 if (!spec->loopback.amplist)
16438 spec->loopback.amplist = alc861vd_loopbacks;
16447 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16448 * configuration. Each pin widget can choose any input DACs and a mixer.
16449 * Each ADC is connected from a mixer of all inputs. This makes possible
16450 * 6-channel independent captures.
16452 * In addition, an independent DAC for the multi-playback (not used in this
16455 #define ALC662_DIGOUT_NID 0x06
16456 #define ALC662_DIGIN_NID 0x0a
16458 static hda_nid_t alc662_dac_nids[4] = {
16459 /* front, rear, clfe, rear_surr */
16463 static hda_nid_t alc272_dac_nids[2] = {
16467 static hda_nid_t alc662_adc_nids[2] = {
16472 static hda_nid_t alc272_adc_nids[1] = {
16477 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16478 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16482 /* FIXME: should be a matrix-type input source selection */
16483 static struct hda_input_mux alc662_capture_source = {
16487 { "Front Mic", 0x1 },
16493 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16501 static struct hda_input_mux alc663_capture_source = {
16505 { "Front Mic", 0x1 },
16510 #if 0 /* set to 1 for testing other input sources below */
16511 static struct hda_input_mux alc272_nc10_capture_source = {
16514 { "Autoselect Mic", 0x0 },
16515 { "Internal Mic", 0x1 },
16516 { "In-0x02", 0x2 },
16517 { "In-0x03", 0x3 },
16518 { "In-0x04", 0x4 },
16519 { "In-0x05", 0x5 },
16520 { "In-0x06", 0x6 },
16521 { "In-0x07", 0x7 },
16522 { "In-0x08", 0x8 },
16523 { "In-0x09", 0x9 },
16524 { "In-0x0a", 0x0a },
16525 { "In-0x0b", 0x0b },
16526 { "In-0x0c", 0x0c },
16527 { "In-0x0d", 0x0d },
16528 { "In-0x0e", 0x0e },
16529 { "In-0x0f", 0x0f },
16537 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16544 static struct hda_verb alc662_3ST_ch2_init[] = {
16545 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16546 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16547 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16548 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16555 static struct hda_verb alc662_3ST_ch6_init[] = {
16556 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16557 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16558 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16559 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16560 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16561 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16565 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16566 { 2, alc662_3ST_ch2_init },
16567 { 6, alc662_3ST_ch6_init },
16573 static struct hda_verb alc662_sixstack_ch6_init[] = {
16574 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16575 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16576 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16583 static struct hda_verb alc662_sixstack_ch8_init[] = {
16584 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16585 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16586 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16590 static struct hda_channel_mode alc662_5stack_modes[2] = {
16591 { 2, alc662_sixstack_ch6_init },
16592 { 6, alc662_sixstack_ch8_init },
16595 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16596 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16599 static struct snd_kcontrol_new alc662_base_mixer[] = {
16600 /* output mixer control */
16601 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16602 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16603 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16604 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16605 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16606 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16607 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16608 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16609 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16611 /*Input mixer control */
16612 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16613 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16614 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16615 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16616 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16617 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16618 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16619 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16623 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16624 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16625 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16627 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16628 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16629 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16630 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16633 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16634 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16638 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16639 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16640 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16641 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16642 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16643 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16644 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16645 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16646 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16647 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16648 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16649 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16650 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16651 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16652 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16653 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16654 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16655 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16659 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16660 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16661 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16662 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16663 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16665 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16666 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16672 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16673 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16674 ALC262_HIPPO_MASTER_SWITCH,
16676 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16677 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16678 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16680 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16681 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16682 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16686 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16687 ALC262_HIPPO_MASTER_SWITCH,
16688 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16689 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16690 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16691 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16692 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16693 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16694 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16700 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16701 .ops = &snd_hda_bind_vol,
16703 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16704 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16709 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16710 .ops = &snd_hda_bind_sw,
16712 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16713 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16718 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16719 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16720 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16726 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16727 .ops = &snd_hda_bind_sw,
16729 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16730 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16731 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16736 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16737 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16738 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16740 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16741 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16742 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16747 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16748 .ops = &snd_hda_bind_sw,
16750 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16751 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16752 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16757 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16758 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16759 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16762 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16763 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16767 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16768 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16769 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16770 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16772 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16773 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16774 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16778 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16779 .ops = &snd_hda_bind_vol,
16781 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16782 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16787 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16788 .ops = &snd_hda_bind_sw,
16790 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16791 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16796 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16797 HDA_BIND_VOL("Master Playback Volume",
16798 &alc663_asus_two_bind_master_vol),
16799 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16800 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16801 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16807 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16808 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16809 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16810 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16811 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16817 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16818 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16819 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16820 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16821 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16822 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16826 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16827 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16831 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16832 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16833 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16834 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16836 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16837 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16838 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16839 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16840 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16841 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16845 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16846 .ops = &snd_hda_bind_sw,
16848 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16849 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16850 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16851 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16852 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16857 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16858 .ops = &snd_hda_bind_sw,
16860 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16861 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16866 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16867 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16868 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16869 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16870 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16871 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16872 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16873 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16879 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16880 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16881 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16882 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16883 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16884 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16891 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16893 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16894 .name = "Channel Mode",
16895 .info = alc_ch_mode_info,
16896 .get = alc_ch_mode_get,
16897 .put = alc_ch_mode_put,
16902 static struct hda_verb alc662_init_verbs[] = {
16903 /* ADC: mute amp left and right */
16904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16905 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16914 /* Front Pin: output 0 (0x0c) */
16915 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16916 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16918 /* Rear Pin: output 1 (0x0d) */
16919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16920 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16922 /* CLFE Pin: output 2 (0x0e) */
16923 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16924 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16926 /* Mic (rear) pin: input vref at 80% */
16927 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16928 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16929 /* Front Mic pin: input vref at 80% */
16930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16931 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16932 /* Line In pin: input */
16933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16935 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16938 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16939 /* CD pin widget for input */
16940 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16942 /* FIXME: use matrix-type input source selection */
16943 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16946 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16948 /* always trun on EAPD */
16949 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16950 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16955 static struct hda_verb alc663_init_verbs[] = {
16956 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16957 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16958 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16959 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16960 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16961 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16965 static struct hda_verb alc272_init_verbs[] = {
16966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16967 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16968 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16969 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16970 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16971 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16972 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16973 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16977 static struct hda_verb alc662_sue_init_verbs[] = {
16978 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16979 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16983 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16984 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16985 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16989 /* Set Unsolicited Event*/
16990 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16991 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16992 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16996 static struct hda_verb alc663_m51va_init_verbs[] = {
16997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16999 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17000 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17001 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17004 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17005 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17009 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17010 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17011 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17012 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17015 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17016 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17020 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17021 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17022 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17023 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17024 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17025 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17026 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17027 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17028 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17032 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17033 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17034 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17035 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17038 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17039 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17043 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17044 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17045 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17046 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17047 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17048 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17049 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17050 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17053 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17054 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17055 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17059 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17060 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17063 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17066 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17069 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17070 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17075 static struct hda_verb alc663_g71v_init_verbs[] = {
17076 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17077 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17078 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17080 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17081 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17082 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17084 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17085 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17086 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17090 static struct hda_verb alc663_g50v_init_verbs[] = {
17091 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17092 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17093 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17095 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17096 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17100 static struct hda_verb alc662_ecs_init_verbs[] = {
17101 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17103 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17104 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17108 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17109 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17110 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17111 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17112 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17113 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17114 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17115 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17118 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17119 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17123 static struct hda_verb alc272_dell_init_verbs[] = {
17124 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17125 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17126 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17127 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17128 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17129 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17130 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17131 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17132 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17133 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17134 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17138 static struct hda_verb alc663_mode7_init_verbs[] = {
17139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17140 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17141 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17142 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17143 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17144 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17145 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17146 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17147 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17148 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17149 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17151 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17152 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17153 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17157 static struct hda_verb alc663_mode8_init_verbs[] = {
17158 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17159 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17160 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17162 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17163 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17164 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17165 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17166 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17167 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17168 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17169 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17171 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17172 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17173 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17177 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17178 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17179 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17183 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17184 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17185 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17189 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17191 unsigned int present;
17192 unsigned char bits;
17194 present = snd_hda_jack_detect(codec, 0x14);
17195 bits = present ? HDA_AMP_MUTE : 0;
17197 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17198 HDA_AMP_MUTE, bits);
17201 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17203 unsigned int present;
17204 unsigned char bits;
17206 present = snd_hda_jack_detect(codec, 0x1b);
17207 bits = present ? HDA_AMP_MUTE : 0;
17209 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17210 HDA_AMP_MUTE, bits);
17211 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17212 HDA_AMP_MUTE, bits);
17215 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17218 if ((res >> 26) == ALC880_HP_EVENT)
17219 alc662_lenovo_101e_all_automute(codec);
17220 if ((res >> 26) == ALC880_FRONT_EVENT)
17221 alc662_lenovo_101e_ispeaker_automute(codec);
17224 /* unsolicited event for HP jack sensing */
17225 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17228 if ((res >> 26) == ALC880_MIC_EVENT)
17229 alc_mic_automute(codec);
17231 alc262_hippo_unsol_event(codec, res);
17234 static void alc662_eeepc_setup(struct hda_codec *codec)
17236 struct alc_spec *spec = codec->spec;
17238 alc262_hippo1_setup(codec);
17239 spec->ext_mic.pin = 0x18;
17240 spec->ext_mic.mux_idx = 0;
17241 spec->int_mic.pin = 0x19;
17242 spec->int_mic.mux_idx = 1;
17243 spec->auto_mic = 1;
17246 static void alc662_eeepc_inithook(struct hda_codec *codec)
17248 alc262_hippo_automute(codec);
17249 alc_mic_automute(codec);
17252 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17254 struct alc_spec *spec = codec->spec;
17256 spec->autocfg.hp_pins[0] = 0x14;
17257 spec->autocfg.speaker_pins[0] = 0x1b;
17260 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17262 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17264 unsigned int present;
17265 unsigned char bits;
17267 present = snd_hda_jack_detect(codec, 0x21);
17268 bits = present ? HDA_AMP_MUTE : 0;
17269 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17270 HDA_AMP_MUTE, bits);
17271 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17272 HDA_AMP_MUTE, bits);
17275 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17277 unsigned int present;
17278 unsigned char bits;
17280 present = snd_hda_jack_detect(codec, 0x21);
17281 bits = present ? HDA_AMP_MUTE : 0;
17282 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17283 HDA_AMP_MUTE, bits);
17284 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17285 HDA_AMP_MUTE, bits);
17286 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17287 HDA_AMP_MUTE, bits);
17288 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17289 HDA_AMP_MUTE, bits);
17292 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17294 unsigned int present;
17295 unsigned char bits;
17297 present = snd_hda_jack_detect(codec, 0x15);
17298 bits = present ? HDA_AMP_MUTE : 0;
17299 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17300 HDA_AMP_MUTE, bits);
17301 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17302 HDA_AMP_MUTE, bits);
17303 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17304 HDA_AMP_MUTE, bits);
17305 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17306 HDA_AMP_MUTE, bits);
17309 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17311 unsigned int present;
17312 unsigned char bits;
17314 present = snd_hda_jack_detect(codec, 0x1b);
17315 bits = present ? 0 : PIN_OUT;
17316 snd_hda_codec_write(codec, 0x14, 0,
17317 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17320 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17322 unsigned int present1, present2;
17324 present1 = snd_hda_jack_detect(codec, 0x21);
17325 present2 = snd_hda_jack_detect(codec, 0x15);
17327 if (present1 || present2) {
17328 snd_hda_codec_write_cache(codec, 0x14, 0,
17329 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17331 snd_hda_codec_write_cache(codec, 0x14, 0,
17332 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17336 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17338 unsigned int present1, present2;
17340 present1 = snd_hda_jack_detect(codec, 0x1b);
17341 present2 = snd_hda_jack_detect(codec, 0x15);
17343 if (present1 || present2) {
17344 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17345 HDA_AMP_MUTE, HDA_AMP_MUTE);
17346 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17347 HDA_AMP_MUTE, HDA_AMP_MUTE);
17349 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17351 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17356 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17358 unsigned int present1, present2;
17360 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17361 AC_VERB_GET_PIN_SENSE, 0)
17362 & AC_PINSENSE_PRESENCE;
17363 present2 = snd_hda_codec_read(codec, 0x21, 0,
17364 AC_VERB_GET_PIN_SENSE, 0)
17365 & AC_PINSENSE_PRESENCE;
17367 if (present1 || present2) {
17368 snd_hda_codec_write_cache(codec, 0x14, 0,
17369 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17370 snd_hda_codec_write_cache(codec, 0x17, 0,
17371 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17373 snd_hda_codec_write_cache(codec, 0x14, 0,
17374 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17375 snd_hda_codec_write_cache(codec, 0x17, 0,
17376 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17380 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17382 unsigned int present1, present2;
17384 present1 = snd_hda_codec_read(codec, 0x21, 0,
17385 AC_VERB_GET_PIN_SENSE, 0)
17386 & AC_PINSENSE_PRESENCE;
17387 present2 = snd_hda_codec_read(codec, 0x15, 0,
17388 AC_VERB_GET_PIN_SENSE, 0)
17389 & AC_PINSENSE_PRESENCE;
17391 if (present1 || present2) {
17392 snd_hda_codec_write_cache(codec, 0x14, 0,
17393 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17394 snd_hda_codec_write_cache(codec, 0x17, 0,
17395 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17397 snd_hda_codec_write_cache(codec, 0x14, 0,
17398 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17399 snd_hda_codec_write_cache(codec, 0x17, 0,
17400 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17404 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17407 switch (res >> 26) {
17408 case ALC880_HP_EVENT:
17409 alc663_m51va_speaker_automute(codec);
17411 case ALC880_MIC_EVENT:
17412 alc_mic_automute(codec);
17417 static void alc663_m51va_setup(struct hda_codec *codec)
17419 struct alc_spec *spec = codec->spec;
17420 spec->ext_mic.pin = 0x18;
17421 spec->ext_mic.mux_idx = 0;
17422 spec->int_mic.pin = 0x12;
17423 spec->int_mic.mux_idx = 9;
17424 spec->auto_mic = 1;
17427 static void alc663_m51va_inithook(struct hda_codec *codec)
17429 alc663_m51va_speaker_automute(codec);
17430 alc_mic_automute(codec);
17433 /* ***************** Mode1 ******************************/
17434 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17436 static void alc663_mode1_setup(struct hda_codec *codec)
17438 struct alc_spec *spec = codec->spec;
17439 spec->ext_mic.pin = 0x18;
17440 spec->ext_mic.mux_idx = 0;
17441 spec->int_mic.pin = 0x19;
17442 spec->int_mic.mux_idx = 1;
17443 spec->auto_mic = 1;
17446 #define alc663_mode1_inithook alc663_m51va_inithook
17448 /* ***************** Mode2 ******************************/
17449 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17452 switch (res >> 26) {
17453 case ALC880_HP_EVENT:
17454 alc662_f5z_speaker_automute(codec);
17456 case ALC880_MIC_EVENT:
17457 alc_mic_automute(codec);
17462 #define alc662_mode2_setup alc663_mode1_setup
17464 static void alc662_mode2_inithook(struct hda_codec *codec)
17466 alc662_f5z_speaker_automute(codec);
17467 alc_mic_automute(codec);
17469 /* ***************** Mode3 ******************************/
17470 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17473 switch (res >> 26) {
17474 case ALC880_HP_EVENT:
17475 alc663_two_hp_m1_speaker_automute(codec);
17477 case ALC880_MIC_EVENT:
17478 alc_mic_automute(codec);
17483 #define alc663_mode3_setup alc663_mode1_setup
17485 static void alc663_mode3_inithook(struct hda_codec *codec)
17487 alc663_two_hp_m1_speaker_automute(codec);
17488 alc_mic_automute(codec);
17490 /* ***************** Mode4 ******************************/
17491 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17494 switch (res >> 26) {
17495 case ALC880_HP_EVENT:
17496 alc663_21jd_two_speaker_automute(codec);
17498 case ALC880_MIC_EVENT:
17499 alc_mic_automute(codec);
17504 #define alc663_mode4_setup alc663_mode1_setup
17506 static void alc663_mode4_inithook(struct hda_codec *codec)
17508 alc663_21jd_two_speaker_automute(codec);
17509 alc_mic_automute(codec);
17511 /* ***************** Mode5 ******************************/
17512 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17515 switch (res >> 26) {
17516 case ALC880_HP_EVENT:
17517 alc663_15jd_two_speaker_automute(codec);
17519 case ALC880_MIC_EVENT:
17520 alc_mic_automute(codec);
17525 #define alc663_mode5_setup alc663_mode1_setup
17527 static void alc663_mode5_inithook(struct hda_codec *codec)
17529 alc663_15jd_two_speaker_automute(codec);
17530 alc_mic_automute(codec);
17532 /* ***************** Mode6 ******************************/
17533 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17536 switch (res >> 26) {
17537 case ALC880_HP_EVENT:
17538 alc663_two_hp_m2_speaker_automute(codec);
17540 case ALC880_MIC_EVENT:
17541 alc_mic_automute(codec);
17546 #define alc663_mode6_setup alc663_mode1_setup
17548 static void alc663_mode6_inithook(struct hda_codec *codec)
17550 alc663_two_hp_m2_speaker_automute(codec);
17551 alc_mic_automute(codec);
17554 /* ***************** Mode7 ******************************/
17555 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17558 switch (res >> 26) {
17559 case ALC880_HP_EVENT:
17560 alc663_two_hp_m7_speaker_automute(codec);
17562 case ALC880_MIC_EVENT:
17563 alc_mic_automute(codec);
17568 #define alc663_mode7_setup alc663_mode1_setup
17570 static void alc663_mode7_inithook(struct hda_codec *codec)
17572 alc663_two_hp_m7_speaker_automute(codec);
17573 alc_mic_automute(codec);
17576 /* ***************** Mode8 ******************************/
17577 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17580 switch (res >> 26) {
17581 case ALC880_HP_EVENT:
17582 alc663_two_hp_m8_speaker_automute(codec);
17584 case ALC880_MIC_EVENT:
17585 alc_mic_automute(codec);
17590 #define alc663_mode8_setup alc663_m51va_setup
17592 static void alc663_mode8_inithook(struct hda_codec *codec)
17594 alc663_two_hp_m8_speaker_automute(codec);
17595 alc_mic_automute(codec);
17598 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17600 unsigned int present;
17601 unsigned char bits;
17603 present = snd_hda_jack_detect(codec, 0x21);
17604 bits = present ? HDA_AMP_MUTE : 0;
17605 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17606 HDA_AMP_MUTE, bits);
17607 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17608 HDA_AMP_MUTE, bits);
17611 static void alc663_g71v_front_automute(struct hda_codec *codec)
17613 unsigned int present;
17614 unsigned char bits;
17616 present = snd_hda_jack_detect(codec, 0x15);
17617 bits = present ? HDA_AMP_MUTE : 0;
17618 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17619 HDA_AMP_MUTE, bits);
17622 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17625 switch (res >> 26) {
17626 case ALC880_HP_EVENT:
17627 alc663_g71v_hp_automute(codec);
17629 case ALC880_FRONT_EVENT:
17630 alc663_g71v_front_automute(codec);
17632 case ALC880_MIC_EVENT:
17633 alc_mic_automute(codec);
17638 #define alc663_g71v_setup alc663_m51va_setup
17640 static void alc663_g71v_inithook(struct hda_codec *codec)
17642 alc663_g71v_front_automute(codec);
17643 alc663_g71v_hp_automute(codec);
17644 alc_mic_automute(codec);
17647 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17650 switch (res >> 26) {
17651 case ALC880_HP_EVENT:
17652 alc663_m51va_speaker_automute(codec);
17654 case ALC880_MIC_EVENT:
17655 alc_mic_automute(codec);
17660 #define alc663_g50v_setup alc663_m51va_setup
17662 static void alc663_g50v_inithook(struct hda_codec *codec)
17664 alc663_m51va_speaker_automute(codec);
17665 alc_mic_automute(codec);
17668 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17669 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17670 ALC262_HIPPO_MASTER_SWITCH,
17672 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17673 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17674 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17676 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17677 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17678 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17682 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17683 /* Master Playback automatically created from Speaker and Headphone */
17684 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17685 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17686 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17687 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17689 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17690 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17691 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17693 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17694 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17695 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17699 #ifdef CONFIG_SND_HDA_POWER_SAVE
17700 #define alc662_loopbacks alc880_loopbacks
17704 /* pcm configuration: identical with ALC880 */
17705 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17706 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17707 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17708 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17711 * configuration and preset
17713 static const char *alc662_models[ALC662_MODEL_LAST] = {
17714 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17715 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17716 [ALC662_3ST_6ch] = "3stack-6ch",
17717 [ALC662_5ST_DIG] = "6stack-dig",
17718 [ALC662_LENOVO_101E] = "lenovo-101e",
17719 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17720 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17721 [ALC662_ECS] = "ecs",
17722 [ALC663_ASUS_M51VA] = "m51va",
17723 [ALC663_ASUS_G71V] = "g71v",
17724 [ALC663_ASUS_H13] = "h13",
17725 [ALC663_ASUS_G50V] = "g50v",
17726 [ALC663_ASUS_MODE1] = "asus-mode1",
17727 [ALC662_ASUS_MODE2] = "asus-mode2",
17728 [ALC663_ASUS_MODE3] = "asus-mode3",
17729 [ALC663_ASUS_MODE4] = "asus-mode4",
17730 [ALC663_ASUS_MODE5] = "asus-mode5",
17731 [ALC663_ASUS_MODE6] = "asus-mode6",
17732 [ALC663_ASUS_MODE7] = "asus-mode7",
17733 [ALC663_ASUS_MODE8] = "asus-mode8",
17734 [ALC272_DELL] = "dell",
17735 [ALC272_DELL_ZM1] = "dell-zm1",
17736 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17737 [ALC662_AUTO] = "auto",
17740 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17741 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17742 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17743 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17744 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17745 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17746 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17747 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17748 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17749 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17750 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17751 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17752 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17753 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17754 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17755 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17756 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17757 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17758 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17759 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17760 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17761 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17762 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17763 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17764 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17765 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17766 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17767 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17768 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17769 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17770 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17771 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17772 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17773 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17774 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17775 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17776 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17777 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17778 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17779 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17780 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17781 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17782 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17783 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17784 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17785 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17786 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17787 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17788 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17789 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17790 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17791 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17792 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17793 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17794 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17795 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17796 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17797 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17798 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17799 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17800 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17801 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17802 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17803 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17804 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17805 ALC662_3ST_6ch_DIG),
17806 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17807 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17808 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17809 ALC662_3ST_6ch_DIG),
17810 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17811 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17812 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17813 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17814 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17815 ALC662_3ST_6ch_DIG),
17816 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17818 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17822 static struct alc_config_preset alc662_presets[] = {
17823 [ALC662_3ST_2ch_DIG] = {
17824 .mixers = { alc662_3ST_2ch_mixer },
17825 .init_verbs = { alc662_init_verbs },
17826 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17827 .dac_nids = alc662_dac_nids,
17828 .dig_out_nid = ALC662_DIGOUT_NID,
17829 .dig_in_nid = ALC662_DIGIN_NID,
17830 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17831 .channel_mode = alc662_3ST_2ch_modes,
17832 .input_mux = &alc662_capture_source,
17834 [ALC662_3ST_6ch_DIG] = {
17835 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17836 .init_verbs = { alc662_init_verbs },
17837 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17838 .dac_nids = alc662_dac_nids,
17839 .dig_out_nid = ALC662_DIGOUT_NID,
17840 .dig_in_nid = ALC662_DIGIN_NID,
17841 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17842 .channel_mode = alc662_3ST_6ch_modes,
17844 .input_mux = &alc662_capture_source,
17846 [ALC662_3ST_6ch] = {
17847 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17848 .init_verbs = { alc662_init_verbs },
17849 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17850 .dac_nids = alc662_dac_nids,
17851 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17852 .channel_mode = alc662_3ST_6ch_modes,
17854 .input_mux = &alc662_capture_source,
17856 [ALC662_5ST_DIG] = {
17857 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17858 .init_verbs = { alc662_init_verbs },
17859 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17860 .dac_nids = alc662_dac_nids,
17861 .dig_out_nid = ALC662_DIGOUT_NID,
17862 .dig_in_nid = ALC662_DIGIN_NID,
17863 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17864 .channel_mode = alc662_5stack_modes,
17865 .input_mux = &alc662_capture_source,
17867 [ALC662_LENOVO_101E] = {
17868 .mixers = { alc662_lenovo_101e_mixer },
17869 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17870 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17871 .dac_nids = alc662_dac_nids,
17872 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17873 .channel_mode = alc662_3ST_2ch_modes,
17874 .input_mux = &alc662_lenovo_101e_capture_source,
17875 .unsol_event = alc662_lenovo_101e_unsol_event,
17876 .init_hook = alc662_lenovo_101e_all_automute,
17878 [ALC662_ASUS_EEEPC_P701] = {
17879 .mixers = { alc662_eeepc_p701_mixer },
17880 .init_verbs = { alc662_init_verbs,
17881 alc662_eeepc_sue_init_verbs },
17882 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17883 .dac_nids = alc662_dac_nids,
17884 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17885 .channel_mode = alc662_3ST_2ch_modes,
17886 .unsol_event = alc662_eeepc_unsol_event,
17887 .setup = alc662_eeepc_setup,
17888 .init_hook = alc662_eeepc_inithook,
17890 [ALC662_ASUS_EEEPC_EP20] = {
17891 .mixers = { alc662_eeepc_ep20_mixer,
17892 alc662_chmode_mixer },
17893 .init_verbs = { alc662_init_verbs,
17894 alc662_eeepc_ep20_sue_init_verbs },
17895 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17896 .dac_nids = alc662_dac_nids,
17897 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17898 .channel_mode = alc662_3ST_6ch_modes,
17899 .input_mux = &alc662_lenovo_101e_capture_source,
17900 .unsol_event = alc662_eeepc_unsol_event,
17901 .setup = alc662_eeepc_ep20_setup,
17902 .init_hook = alc662_eeepc_ep20_inithook,
17905 .mixers = { alc662_ecs_mixer },
17906 .init_verbs = { alc662_init_verbs,
17907 alc662_ecs_init_verbs },
17908 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17909 .dac_nids = alc662_dac_nids,
17910 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17911 .channel_mode = alc662_3ST_2ch_modes,
17912 .unsol_event = alc662_eeepc_unsol_event,
17913 .setup = alc662_eeepc_setup,
17914 .init_hook = alc662_eeepc_inithook,
17916 [ALC663_ASUS_M51VA] = {
17917 .mixers = { alc663_m51va_mixer },
17918 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17919 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17920 .dac_nids = alc662_dac_nids,
17921 .dig_out_nid = ALC662_DIGOUT_NID,
17922 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17923 .channel_mode = alc662_3ST_2ch_modes,
17924 .unsol_event = alc663_m51va_unsol_event,
17925 .setup = alc663_m51va_setup,
17926 .init_hook = alc663_m51va_inithook,
17928 [ALC663_ASUS_G71V] = {
17929 .mixers = { alc663_g71v_mixer },
17930 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17931 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17932 .dac_nids = alc662_dac_nids,
17933 .dig_out_nid = ALC662_DIGOUT_NID,
17934 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17935 .channel_mode = alc662_3ST_2ch_modes,
17936 .unsol_event = alc663_g71v_unsol_event,
17937 .setup = alc663_g71v_setup,
17938 .init_hook = alc663_g71v_inithook,
17940 [ALC663_ASUS_H13] = {
17941 .mixers = { alc663_m51va_mixer },
17942 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17943 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17944 .dac_nids = alc662_dac_nids,
17945 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17946 .channel_mode = alc662_3ST_2ch_modes,
17947 .unsol_event = alc663_m51va_unsol_event,
17948 .init_hook = alc663_m51va_inithook,
17950 [ALC663_ASUS_G50V] = {
17951 .mixers = { alc663_g50v_mixer },
17952 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17953 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17954 .dac_nids = alc662_dac_nids,
17955 .dig_out_nid = ALC662_DIGOUT_NID,
17956 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17957 .channel_mode = alc662_3ST_6ch_modes,
17958 .input_mux = &alc663_capture_source,
17959 .unsol_event = alc663_g50v_unsol_event,
17960 .setup = alc663_g50v_setup,
17961 .init_hook = alc663_g50v_inithook,
17963 [ALC663_ASUS_MODE1] = {
17964 .mixers = { alc663_m51va_mixer },
17965 .cap_mixer = alc662_auto_capture_mixer,
17966 .init_verbs = { alc662_init_verbs,
17967 alc663_21jd_amic_init_verbs },
17968 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17970 .dac_nids = alc662_dac_nids,
17971 .dig_out_nid = ALC662_DIGOUT_NID,
17972 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17973 .channel_mode = alc662_3ST_2ch_modes,
17974 .unsol_event = alc663_mode1_unsol_event,
17975 .setup = alc663_mode1_setup,
17976 .init_hook = alc663_mode1_inithook,
17978 [ALC662_ASUS_MODE2] = {
17979 .mixers = { alc662_1bjd_mixer },
17980 .cap_mixer = alc662_auto_capture_mixer,
17981 .init_verbs = { alc662_init_verbs,
17982 alc662_1bjd_amic_init_verbs },
17983 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17984 .dac_nids = alc662_dac_nids,
17985 .dig_out_nid = ALC662_DIGOUT_NID,
17986 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17987 .channel_mode = alc662_3ST_2ch_modes,
17988 .unsol_event = alc662_mode2_unsol_event,
17989 .setup = alc662_mode2_setup,
17990 .init_hook = alc662_mode2_inithook,
17992 [ALC663_ASUS_MODE3] = {
17993 .mixers = { alc663_two_hp_m1_mixer },
17994 .cap_mixer = alc662_auto_capture_mixer,
17995 .init_verbs = { alc662_init_verbs,
17996 alc663_two_hp_amic_m1_init_verbs },
17997 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17999 .dac_nids = alc662_dac_nids,
18000 .dig_out_nid = ALC662_DIGOUT_NID,
18001 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18002 .channel_mode = alc662_3ST_2ch_modes,
18003 .unsol_event = alc663_mode3_unsol_event,
18004 .setup = alc663_mode3_setup,
18005 .init_hook = alc663_mode3_inithook,
18007 [ALC663_ASUS_MODE4] = {
18008 .mixers = { alc663_asus_21jd_clfe_mixer },
18009 .cap_mixer = alc662_auto_capture_mixer,
18010 .init_verbs = { alc662_init_verbs,
18011 alc663_21jd_amic_init_verbs},
18012 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18014 .dac_nids = alc662_dac_nids,
18015 .dig_out_nid = ALC662_DIGOUT_NID,
18016 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18017 .channel_mode = alc662_3ST_2ch_modes,
18018 .unsol_event = alc663_mode4_unsol_event,
18019 .setup = alc663_mode4_setup,
18020 .init_hook = alc663_mode4_inithook,
18022 [ALC663_ASUS_MODE5] = {
18023 .mixers = { alc663_asus_15jd_clfe_mixer },
18024 .cap_mixer = alc662_auto_capture_mixer,
18025 .init_verbs = { alc662_init_verbs,
18026 alc663_15jd_amic_init_verbs },
18027 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18029 .dac_nids = alc662_dac_nids,
18030 .dig_out_nid = ALC662_DIGOUT_NID,
18031 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18032 .channel_mode = alc662_3ST_2ch_modes,
18033 .unsol_event = alc663_mode5_unsol_event,
18034 .setup = alc663_mode5_setup,
18035 .init_hook = alc663_mode5_inithook,
18037 [ALC663_ASUS_MODE6] = {
18038 .mixers = { alc663_two_hp_m2_mixer },
18039 .cap_mixer = alc662_auto_capture_mixer,
18040 .init_verbs = { alc662_init_verbs,
18041 alc663_two_hp_amic_m2_init_verbs },
18042 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18044 .dac_nids = alc662_dac_nids,
18045 .dig_out_nid = ALC662_DIGOUT_NID,
18046 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18047 .channel_mode = alc662_3ST_2ch_modes,
18048 .unsol_event = alc663_mode6_unsol_event,
18049 .setup = alc663_mode6_setup,
18050 .init_hook = alc663_mode6_inithook,
18052 [ALC663_ASUS_MODE7] = {
18053 .mixers = { alc663_mode7_mixer },
18054 .cap_mixer = alc662_auto_capture_mixer,
18055 .init_verbs = { alc662_init_verbs,
18056 alc663_mode7_init_verbs },
18057 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18059 .dac_nids = alc662_dac_nids,
18060 .dig_out_nid = ALC662_DIGOUT_NID,
18061 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18062 .channel_mode = alc662_3ST_2ch_modes,
18063 .unsol_event = alc663_mode7_unsol_event,
18064 .setup = alc663_mode7_setup,
18065 .init_hook = alc663_mode7_inithook,
18067 [ALC663_ASUS_MODE8] = {
18068 .mixers = { alc663_mode8_mixer },
18069 .cap_mixer = alc662_auto_capture_mixer,
18070 .init_verbs = { alc662_init_verbs,
18071 alc663_mode8_init_verbs },
18072 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18074 .dac_nids = alc662_dac_nids,
18075 .dig_out_nid = ALC662_DIGOUT_NID,
18076 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18077 .channel_mode = alc662_3ST_2ch_modes,
18078 .unsol_event = alc663_mode8_unsol_event,
18079 .setup = alc663_mode8_setup,
18080 .init_hook = alc663_mode8_inithook,
18083 .mixers = { alc663_m51va_mixer },
18084 .cap_mixer = alc272_auto_capture_mixer,
18085 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18086 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18087 .dac_nids = alc662_dac_nids,
18088 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18089 .adc_nids = alc272_adc_nids,
18090 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18091 .capsrc_nids = alc272_capsrc_nids,
18092 .channel_mode = alc662_3ST_2ch_modes,
18093 .unsol_event = alc663_m51va_unsol_event,
18094 .setup = alc663_m51va_setup,
18095 .init_hook = alc663_m51va_inithook,
18097 [ALC272_DELL_ZM1] = {
18098 .mixers = { alc663_m51va_mixer },
18099 .cap_mixer = alc662_auto_capture_mixer,
18100 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18101 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18102 .dac_nids = alc662_dac_nids,
18103 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18104 .adc_nids = alc662_adc_nids,
18106 .capsrc_nids = alc662_capsrc_nids,
18107 .channel_mode = alc662_3ST_2ch_modes,
18108 .unsol_event = alc663_m51va_unsol_event,
18109 .setup = alc663_m51va_setup,
18110 .init_hook = alc663_m51va_inithook,
18112 [ALC272_SAMSUNG_NC10] = {
18113 .mixers = { alc272_nc10_mixer },
18114 .init_verbs = { alc662_init_verbs,
18115 alc663_21jd_amic_init_verbs },
18116 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18117 .dac_nids = alc272_dac_nids,
18118 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18119 .channel_mode = alc662_3ST_2ch_modes,
18120 /*.input_mux = &alc272_nc10_capture_source,*/
18121 .unsol_event = alc663_mode4_unsol_event,
18122 .setup = alc663_mode4_setup,
18123 .init_hook = alc663_mode4_inithook,
18129 * BIOS auto configuration
18132 /* convert from MIX nid to DAC */
18133 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18137 else if (nid >= 0x0c && nid <= 0x0e)
18138 return nid - 0x0c + 0x02;
18143 /* get MIX nid connected to the given pin targeted to DAC */
18144 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18150 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18151 for (i = 0; i < num; i++) {
18152 if (alc662_mix_to_dac(mix[i]) == dac)
18158 /* look for an empty DAC slot */
18159 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18161 struct alc_spec *spec = codec->spec;
18165 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18168 for (i = 0; i < num; i++) {
18169 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18172 for (j = 0; j < spec->multiout.num_dacs; j++)
18173 if (spec->multiout.dac_nids[j] == nid)
18175 if (j >= spec->multiout.num_dacs)
18181 /* fill in the dac_nids table from the parsed pin configuration */
18182 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18183 const struct auto_pin_cfg *cfg)
18185 struct alc_spec *spec = codec->spec;
18189 spec->multiout.dac_nids = spec->private_dac_nids;
18190 for (i = 0; i < cfg->line_outs; i++) {
18191 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18194 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18199 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18200 hda_nid_t nid, unsigned int chs)
18202 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18203 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18206 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18207 hda_nid_t nid, unsigned int chs)
18209 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18210 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18213 #define alc662_add_stereo_vol(spec, pfx, nid) \
18214 alc662_add_vol_ctl(spec, pfx, nid, 3)
18215 #define alc662_add_stereo_sw(spec, pfx, nid) \
18216 alc662_add_sw_ctl(spec, pfx, nid, 3)
18218 /* add playback controls from the parsed DAC table */
18219 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18220 const struct auto_pin_cfg *cfg)
18222 struct alc_spec *spec = codec->spec;
18223 static const char *chname[4] = {
18224 "Front", "Surround", NULL /*CLFE*/, "Side"
18226 hda_nid_t nid, mix;
18229 for (i = 0; i < cfg->line_outs; i++) {
18230 nid = spec->multiout.dac_nids[i];
18233 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18238 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18241 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18244 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18247 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18252 if (cfg->line_outs == 1 &&
18253 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18260 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18263 if (cfg->line_outs == 1 &&
18264 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18266 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18274 /* add playback controls for speaker and HP outputs */
18275 /* return DAC nid if any new DAC is assigned */
18276 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18279 struct alc_spec *spec = codec->spec;
18280 hda_nid_t nid, mix;
18285 nid = alc662_look_for_dac(codec, pin);
18287 /* the corresponding DAC is already occupied */
18288 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18289 return 0; /* no way */
18290 /* create a switch only */
18291 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18292 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18295 mix = alc662_dac_to_mix(codec, pin, nid);
18298 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18301 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18307 /* create playback/capture controls for input pins */
18308 #define alc662_auto_create_input_ctls \
18309 alc882_auto_create_input_ctls
18311 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18312 hda_nid_t nid, int pin_type,
18318 alc_set_pin_output(codec, nid, pin_type);
18319 /* need the manual connection? */
18320 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18323 for (i = 0; i < num; i++) {
18324 if (alc662_mix_to_dac(srcs[i]) != dac)
18326 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18331 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18333 struct alc_spec *spec = codec->spec;
18334 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18337 for (i = 0; i <= HDA_SIDE; i++) {
18338 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18340 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18341 spec->multiout.dac_nids[i]);
18345 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18347 struct alc_spec *spec = codec->spec;
18350 pin = spec->autocfg.hp_pins[0];
18352 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18353 spec->multiout.hp_nid);
18354 pin = spec->autocfg.speaker_pins[0];
18356 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18357 spec->multiout.extra_out_nid[0]);
18360 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18362 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18364 struct alc_spec *spec = codec->spec;
18367 for (i = 0; i < AUTO_PIN_LAST; i++) {
18368 hda_nid_t nid = spec->autocfg.input_pins[i];
18369 if (alc_is_input_pin(codec, nid)) {
18370 alc_set_input_pin(codec, nid, i);
18371 if (nid != ALC662_PIN_CD_NID &&
18372 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18373 snd_hda_codec_write(codec, nid, 0,
18374 AC_VERB_SET_AMP_GAIN_MUTE,
18380 #define alc662_auto_init_input_src alc882_auto_init_input_src
18382 static int alc662_parse_auto_config(struct hda_codec *codec)
18384 struct alc_spec *spec = codec->spec;
18386 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18388 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18392 if (!spec->autocfg.line_outs)
18393 return 0; /* can't find valid BIOS pin config */
18395 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18398 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18401 err = alc662_auto_create_extra_out(codec,
18402 spec->autocfg.speaker_pins[0],
18407 spec->multiout.extra_out_nid[0] = err;
18408 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18413 spec->multiout.hp_nid = err;
18414 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18418 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18420 if (spec->autocfg.dig_outs)
18421 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18423 if (spec->kctls.list)
18424 add_mixer(spec, spec->kctls.list);
18426 spec->num_mux_defs = 1;
18427 spec->input_mux = &spec->private_imux[0];
18429 add_verb(spec, alc662_init_verbs);
18430 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18431 codec->vendor_id == 0x10ec0665)
18432 add_verb(spec, alc663_init_verbs);
18434 if (codec->vendor_id == 0x10ec0272)
18435 add_verb(spec, alc272_init_verbs);
18437 err = alc_auto_add_mic_boost(codec);
18441 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18442 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18443 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18445 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18450 /* additional initialization for auto-configuration model */
18451 static void alc662_auto_init(struct hda_codec *codec)
18453 struct alc_spec *spec = codec->spec;
18454 alc662_auto_init_multi_out(codec);
18455 alc662_auto_init_hp_out(codec);
18456 alc662_auto_init_analog_input(codec);
18457 alc662_auto_init_input_src(codec);
18458 if (spec->unsol_event)
18459 alc_inithook(codec);
18462 static int patch_alc662(struct hda_codec *codec)
18464 struct alc_spec *spec;
18465 int err, board_config;
18467 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18471 codec->spec = spec;
18473 alc_auto_parse_customize_define(codec);
18475 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18477 if (alc_read_coef_idx(codec, 0) == 0x8020)
18478 alc_codec_rename(codec, "ALC661");
18479 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18480 codec->bus->pci->subsystem_vendor == 0x1025 &&
18481 spec->cdefine.platform_type == 1)
18482 alc_codec_rename(codec, "ALC272X");
18484 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18487 if (board_config < 0) {
18488 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18490 board_config = ALC662_AUTO;
18493 if (board_config == ALC662_AUTO) {
18494 /* automatic parse from the BIOS config */
18495 err = alc662_parse_auto_config(codec);
18501 "hda_codec: Cannot set up configuration "
18502 "from BIOS. Using base mode...\n");
18503 board_config = ALC662_3ST_2ch_DIG;
18507 err = snd_hda_attach_beep_device(codec, 0x1);
18513 if (board_config != ALC662_AUTO)
18514 setup_preset(codec, &alc662_presets[board_config]);
18516 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18517 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18519 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18520 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18522 if (!spec->adc_nids) {
18523 spec->adc_nids = alc662_adc_nids;
18524 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18526 if (!spec->capsrc_nids)
18527 spec->capsrc_nids = alc662_capsrc_nids;
18529 if (!spec->cap_mixer)
18530 set_capture_mixer(codec);
18532 if (spec->cdefine.enable_pcbeep) {
18533 switch (codec->vendor_id) {
18535 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18540 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18543 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18547 spec->vmaster_nid = 0x02;
18549 codec->patch_ops = alc_patch_ops;
18550 if (board_config == ALC662_AUTO)
18551 spec->init_hook = alc662_auto_init;
18552 #ifdef CONFIG_SND_HDA_POWER_SAVE
18553 if (!spec->loopback.amplist)
18554 spec->loopback.amplist = alc662_loopbacks;
18560 static int patch_alc888(struct hda_codec *codec)
18562 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18563 kfree(codec->chip_name);
18564 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18565 if (!codec->chip_name) {
18569 return patch_alc662(codec);
18571 return patch_alc882(codec);
18577 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18578 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18579 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18580 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18581 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18582 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18583 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18584 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18585 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18586 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18587 .patch = patch_alc861 },
18588 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18589 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18590 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18591 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18592 .patch = patch_alc882 },
18593 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18594 .patch = patch_alc662 },
18595 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18596 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18597 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18598 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18599 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18600 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18601 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18602 .patch = patch_alc882 },
18603 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18604 .patch = patch_alc882 },
18605 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18606 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18607 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18608 .patch = patch_alc882 },
18609 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18610 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18611 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18612 {} /* terminator */
18615 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18617 MODULE_LICENSE("GPL");
18618 MODULE_DESCRIPTION("Realtek HD-audio codec");
18620 static struct hda_codec_preset_list realtek_list = {
18621 .preset = snd_hda_preset_realtek,
18622 .owner = THIS_MODULE,
18625 static int __init patch_realtek_init(void)
18627 return snd_hda_add_codec_preset(&realtek_list);
18630 static void __exit patch_realtek_exit(void)
18632 snd_hda_delete_codec_preset(&realtek_list);
18635 module_init(patch_realtek_init)
18636 module_exit(patch_realtek_exit)