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 alc_free_kctls(codec); /* no longer needed */
2606 /* assign Capture Source enums to NID */
2607 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2609 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2610 for (i = 0; kctl && i < kctl->count; i++) {
2611 hda_nid_t *nids = spec->capsrc_nids;
2613 nids = spec->adc_nids;
2614 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2618 if (spec->cap_mixer) {
2619 const char *kname = kctl ? kctl->id.name : NULL;
2620 for (knew = spec->cap_mixer; knew->name; knew++) {
2621 if (kname && strcmp(knew->name, kname) == 0)
2623 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2624 for (i = 0; kctl && i < kctl->count; i++) {
2625 err = snd_hda_add_nid(codec, kctl, i,
2633 /* other nid->control mapping */
2634 for (i = 0; i < spec->num_mixers; i++) {
2635 for (knew = spec->mixers[i]; knew->name; knew++) {
2636 if (knew->iface != NID_MAPPING)
2638 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2641 u = knew->subdevice;
2642 for (j = 0; j < 4; j++, u >>= 8) {
2647 case SUBDEV_SPEAKER_:
2648 nid = spec->autocfg.speaker_pins[nid];
2651 nid = spec->autocfg.line_out_pins[nid];
2654 nid = spec->autocfg.hp_pins[nid];
2659 err = snd_hda_add_nid(codec, kctl, 0, nid);
2663 u = knew->private_value;
2664 for (j = 0; j < 4; j++, u >>= 8) {
2668 err = snd_hda_add_nid(codec, kctl, 0, nid);
2679 * initialize the codec volumes, etc
2683 * generic initialization of ADC, input mixers and output mixers
2685 static struct hda_verb alc880_volume_init_verbs[] = {
2687 * Unmute ADC0-2 and set the default input to mic-in
2689 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2691 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2692 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2693 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2694 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2696 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2698 * Note: PASD motherboards uses the Line In 2 as the input for front
2701 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2705 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2706 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2707 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2711 * Set up output mixers (0x0c - 0x0f)
2713 /* set vol=0 to output mixers */
2714 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2715 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2717 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2718 /* set up input amps for analog loopback */
2719 /* Amp Indices: DAC = 0, mixer = 1 */
2720 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2722 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2724 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2726 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2733 * 3-stack pin configuration:
2734 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2736 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2738 * preset connection lists of input pins
2739 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2741 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2742 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2743 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2746 * Set pin mode and muting
2748 /* set front pin widgets 0x14 for output */
2749 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2750 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2751 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2753 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2754 /* Mic2 (as headphone out) for HP output */
2755 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2756 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2757 /* Line In pin widget for input */
2758 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2759 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2760 /* Line2 (as front mic) pin widget for input and vref at 80% */
2761 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2762 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2763 /* CD pin widget for input */
2764 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2770 * 5-stack pin configuration:
2771 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2772 * line-in/side = 0x1a, f-mic = 0x1b
2774 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2776 * preset connection lists of input pins
2777 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2779 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2780 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2783 * Set pin mode and muting
2785 /* set pin widgets 0x14-0x17 for output */
2786 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2788 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2789 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2790 /* unmute pins for output (no gain on this amp) */
2791 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2793 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2794 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2796 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2797 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2798 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2799 /* Mic2 (as headphone out) for HP output */
2800 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2802 /* Line In pin widget for input */
2803 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2804 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2805 /* Line2 (as front mic) pin widget for input and vref at 80% */
2806 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2807 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2808 /* CD pin widget for input */
2809 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2815 * W810 pin configuration:
2816 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2818 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2819 /* hphone/speaker input selector: front DAC */
2820 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2823 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2824 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2825 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2826 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2827 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2830 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2836 * Z71V pin configuration:
2837 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2839 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2845 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2846 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2847 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2848 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2854 * 6-stack pin configuration:
2855 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2856 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2858 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2859 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2861 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2862 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2865 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2866 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2867 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2868 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2870 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2871 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2872 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2873 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2874 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2875 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2876 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2877 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2878 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2884 * Uniwill pin configuration:
2885 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2888 static struct hda_verb alc880_uniwill_init_verbs[] = {
2889 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2892 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2893 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2894 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2895 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2896 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2897 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2898 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2899 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2901 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2903 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2906 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2907 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2908 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2909 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2910 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2911 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2912 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2913 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2914 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2916 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2917 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2924 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2926 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2927 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2929 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2930 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2931 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2933 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2934 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2937 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2938 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2939 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2940 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2942 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2943 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2945 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2947 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2949 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2950 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2955 static struct hda_verb alc880_beep_init_verbs[] = {
2956 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2960 /* auto-toggle front mic */
2961 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2963 unsigned int present;
2966 present = snd_hda_jack_detect(codec, 0x18);
2967 bits = present ? HDA_AMP_MUTE : 0;
2968 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2971 static void alc880_uniwill_setup(struct hda_codec *codec)
2973 struct alc_spec *spec = codec->spec;
2975 spec->autocfg.hp_pins[0] = 0x14;
2976 spec->autocfg.speaker_pins[0] = 0x15;
2977 spec->autocfg.speaker_pins[0] = 0x16;
2980 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2982 alc_automute_amp(codec);
2983 alc880_uniwill_mic_automute(codec);
2986 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2989 /* Looks like the unsol event is incompatible with the standard
2990 * definition. 4bit tag is placed at 28 bit!
2992 switch (res >> 28) {
2993 case ALC880_MIC_EVENT:
2994 alc880_uniwill_mic_automute(codec);
2997 alc_automute_amp_unsol_event(codec, res);
3002 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3004 struct alc_spec *spec = codec->spec;
3006 spec->autocfg.hp_pins[0] = 0x14;
3007 spec->autocfg.speaker_pins[0] = 0x15;
3010 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3012 unsigned int present;
3014 present = snd_hda_codec_read(codec, 0x21, 0,
3015 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3016 present &= HDA_AMP_VOLMASK;
3017 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3018 HDA_AMP_VOLMASK, present);
3019 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3020 HDA_AMP_VOLMASK, present);
3023 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3026 /* Looks like the unsol event is incompatible with the standard
3027 * definition. 4bit tag is placed at 28 bit!
3029 if ((res >> 28) == ALC880_DCVOL_EVENT)
3030 alc880_uniwill_p53_dcvol_automute(codec);
3032 alc_automute_amp_unsol_event(codec, res);
3036 * F1734 pin configuration:
3037 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3039 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3040 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3041 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3042 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3043 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3044 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3048 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3049 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3051 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3052 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3053 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3054 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3055 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3056 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3057 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3058 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3059 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3061 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3062 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3068 * ASUS pin configuration:
3069 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3071 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3072 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3073 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3074 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3075 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3078 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3079 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3080 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3081 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3082 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3083 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3086 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3087 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3088 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3089 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3090 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3091 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3092 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3093 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3094 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3099 /* Enable GPIO mask and set output */
3100 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3101 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3102 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3104 /* Clevo m520g init */
3105 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3106 /* headphone output */
3107 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3109 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3110 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3112 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3113 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3115 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3116 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3117 /* Mic1 (rear panel) */
3118 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3119 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3120 /* Mic2 (front panel) */
3121 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3122 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3124 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3125 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3126 /* change to EAPD mode */
3127 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3128 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3133 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3134 /* change to EAPD mode */
3135 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3136 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3138 /* Headphone output */
3139 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3141 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3142 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3144 /* Line In pin widget for input */
3145 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3146 /* CD pin widget for input */
3147 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3148 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3149 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3151 /* change to EAPD mode */
3152 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3153 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3159 * LG m1 express dual
3162 * Rear Line-In/Out (blue): 0x14
3163 * Build-in Mic-In: 0x15
3165 * HP-Out (green): 0x1b
3166 * Mic-In/Out (red): 0x19
3170 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3171 static hda_nid_t alc880_lg_dac_nids[3] = {
3175 /* seems analog CD is not working */
3176 static struct hda_input_mux alc880_lg_capture_source = {
3181 { "Internal Mic", 0x6 },
3185 /* 2,4,6 channel modes */
3186 static struct hda_verb alc880_lg_ch2_init[] = {
3187 /* set line-in and mic-in to input */
3188 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3189 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3193 static struct hda_verb alc880_lg_ch4_init[] = {
3194 /* set line-in to out and mic-in to input */
3195 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3196 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3200 static struct hda_verb alc880_lg_ch6_init[] = {
3201 /* set line-in and mic-in to output */
3202 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3203 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3207 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3208 { 2, alc880_lg_ch2_init },
3209 { 4, alc880_lg_ch4_init },
3210 { 6, alc880_lg_ch6_init },
3213 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3214 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3215 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3216 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3217 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3218 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3219 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3220 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3221 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3223 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3224 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3225 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3226 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3227 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3229 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3230 .name = "Channel Mode",
3231 .info = alc_ch_mode_info,
3232 .get = alc_ch_mode_get,
3233 .put = alc_ch_mode_put,
3238 static struct hda_verb alc880_lg_init_verbs[] = {
3239 /* set capture source to mic-in */
3240 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3241 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3242 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3243 /* mute all amp mixer inputs */
3244 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3247 /* line-in to input */
3248 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3249 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3254 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3255 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3256 /* mic-in to input */
3257 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3258 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3259 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3261 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3262 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3263 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3265 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3269 /* toggle speaker-output according to the hp-jack state */
3270 static void alc880_lg_setup(struct hda_codec *codec)
3272 struct alc_spec *spec = codec->spec;
3274 spec->autocfg.hp_pins[0] = 0x1b;
3275 spec->autocfg.speaker_pins[0] = 0x17;
3284 * Built-in Mic-In: 0x19
3290 static struct hda_input_mux alc880_lg_lw_capture_source = {
3294 { "Internal Mic", 0x1 },
3299 #define alc880_lg_lw_modes alc880_threestack_modes
3301 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3302 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3303 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3304 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3305 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3306 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3307 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3308 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3309 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3310 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3311 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3312 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3313 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3314 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3315 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3317 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3318 .name = "Channel Mode",
3319 .info = alc_ch_mode_info,
3320 .get = alc_ch_mode_get,
3321 .put = alc_ch_mode_put,
3326 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3327 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3328 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3329 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3331 /* set capture source to mic-in */
3332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3333 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3334 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3337 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3338 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3340 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3341 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3342 /* mic-in to input */
3343 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3344 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3346 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3347 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3349 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3353 /* toggle speaker-output according to the hp-jack state */
3354 static void alc880_lg_lw_setup(struct hda_codec *codec)
3356 struct alc_spec *spec = codec->spec;
3358 spec->autocfg.hp_pins[0] = 0x1b;
3359 spec->autocfg.speaker_pins[0] = 0x14;
3362 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3363 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3364 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3367 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3368 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3372 static struct hda_input_mux alc880_medion_rim_capture_source = {
3376 { "Internal Mic", 0x1 },
3380 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3381 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3383 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3384 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3386 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3387 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3388 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3389 /* Mic2 (as headphone out) for HP output */
3390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3391 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3392 /* Internal Speaker */
3393 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3394 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3396 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3397 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3399 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3403 /* toggle speaker-output according to the hp-jack state */
3404 static void alc880_medion_rim_automute(struct hda_codec *codec)
3406 struct alc_spec *spec = codec->spec;
3407 alc_automute_amp(codec);
3409 if (spec->jack_present)
3410 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3412 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3415 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3418 /* Looks like the unsol event is incompatible with the standard
3419 * definition. 4bit tag is placed at 28 bit!
3421 if ((res >> 28) == ALC880_HP_EVENT)
3422 alc880_medion_rim_automute(codec);
3425 static void alc880_medion_rim_setup(struct hda_codec *codec)
3427 struct alc_spec *spec = codec->spec;
3429 spec->autocfg.hp_pins[0] = 0x14;
3430 spec->autocfg.speaker_pins[0] = 0x1b;
3433 #ifdef CONFIG_SND_HDA_POWER_SAVE
3434 static struct hda_amp_list alc880_loopbacks[] = {
3435 { 0x0b, HDA_INPUT, 0 },
3436 { 0x0b, HDA_INPUT, 1 },
3437 { 0x0b, HDA_INPUT, 2 },
3438 { 0x0b, HDA_INPUT, 3 },
3439 { 0x0b, HDA_INPUT, 4 },
3443 static struct hda_amp_list alc880_lg_loopbacks[] = {
3444 { 0x0b, HDA_INPUT, 1 },
3445 { 0x0b, HDA_INPUT, 6 },
3446 { 0x0b, HDA_INPUT, 7 },
3455 static int alc_init(struct hda_codec *codec)
3457 struct alc_spec *spec = codec->spec;
3461 alc_auto_init_amp(codec, spec->init_amp);
3463 for (i = 0; i < spec->num_init_verbs; i++)
3464 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3466 if (spec->init_hook)
3467 spec->init_hook(codec);
3472 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3474 struct alc_spec *spec = codec->spec;
3476 if (spec->unsol_event)
3477 spec->unsol_event(codec, res);
3480 #ifdef CONFIG_SND_HDA_POWER_SAVE
3481 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3483 struct alc_spec *spec = codec->spec;
3484 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3489 * Analog playback callbacks
3491 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3492 struct hda_codec *codec,
3493 struct snd_pcm_substream *substream)
3495 struct alc_spec *spec = codec->spec;
3496 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3500 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3501 struct hda_codec *codec,
3502 unsigned int stream_tag,
3503 unsigned int format,
3504 struct snd_pcm_substream *substream)
3506 struct alc_spec *spec = codec->spec;
3507 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3508 stream_tag, format, substream);
3511 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3512 struct hda_codec *codec,
3513 struct snd_pcm_substream *substream)
3515 struct alc_spec *spec = codec->spec;
3516 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3522 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3523 struct hda_codec *codec,
3524 struct snd_pcm_substream *substream)
3526 struct alc_spec *spec = codec->spec;
3527 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3530 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3531 struct hda_codec *codec,
3532 unsigned int stream_tag,
3533 unsigned int format,
3534 struct snd_pcm_substream *substream)
3536 struct alc_spec *spec = codec->spec;
3537 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3538 stream_tag, format, substream);
3541 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3542 struct hda_codec *codec,
3543 struct snd_pcm_substream *substream)
3545 struct alc_spec *spec = codec->spec;
3546 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3549 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3550 struct hda_codec *codec,
3551 struct snd_pcm_substream *substream)
3553 struct alc_spec *spec = codec->spec;
3554 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3560 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3561 struct hda_codec *codec,
3562 unsigned int stream_tag,
3563 unsigned int format,
3564 struct snd_pcm_substream *substream)
3566 struct alc_spec *spec = codec->spec;
3568 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3569 stream_tag, 0, format);
3573 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3574 struct hda_codec *codec,
3575 struct snd_pcm_substream *substream)
3577 struct alc_spec *spec = codec->spec;
3579 snd_hda_codec_cleanup_stream(codec,
3580 spec->adc_nids[substream->number + 1]);
3587 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3591 /* NID is set in alc_build_pcms */
3593 .open = alc880_playback_pcm_open,
3594 .prepare = alc880_playback_pcm_prepare,
3595 .cleanup = alc880_playback_pcm_cleanup
3599 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3603 /* NID is set in alc_build_pcms */
3606 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3610 /* NID is set in alc_build_pcms */
3613 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3614 .substreams = 2, /* can be overridden */
3617 /* NID is set in alc_build_pcms */
3619 .prepare = alc880_alt_capture_pcm_prepare,
3620 .cleanup = alc880_alt_capture_pcm_cleanup
3624 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3628 /* NID is set in alc_build_pcms */
3630 .open = alc880_dig_playback_pcm_open,
3631 .close = alc880_dig_playback_pcm_close,
3632 .prepare = alc880_dig_playback_pcm_prepare,
3633 .cleanup = alc880_dig_playback_pcm_cleanup
3637 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3641 /* NID is set in alc_build_pcms */
3644 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3645 static struct hda_pcm_stream alc_pcm_null_stream = {
3651 static int alc_build_pcms(struct hda_codec *codec)
3653 struct alc_spec *spec = codec->spec;
3654 struct hda_pcm *info = spec->pcm_rec;
3657 codec->num_pcms = 1;
3658 codec->pcm_info = info;
3660 if (spec->no_analog)
3663 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3664 "%s Analog", codec->chip_name);
3665 info->name = spec->stream_name_analog;
3667 if (spec->stream_analog_playback) {
3668 if (snd_BUG_ON(!spec->multiout.dac_nids))
3670 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3671 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3673 if (spec->stream_analog_capture) {
3674 if (snd_BUG_ON(!spec->adc_nids))
3676 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3677 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3680 if (spec->channel_mode) {
3681 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3682 for (i = 0; i < spec->num_channel_mode; i++) {
3683 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3684 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3690 /* SPDIF for stream index #1 */
3691 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3692 snprintf(spec->stream_name_digital,
3693 sizeof(spec->stream_name_digital),
3694 "%s Digital", codec->chip_name);
3695 codec->num_pcms = 2;
3696 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3697 info = spec->pcm_rec + 1;
3698 info->name = spec->stream_name_digital;
3699 if (spec->dig_out_type)
3700 info->pcm_type = spec->dig_out_type;
3702 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3703 if (spec->multiout.dig_out_nid &&
3704 spec->stream_digital_playback) {
3705 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3706 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3708 if (spec->dig_in_nid &&
3709 spec->stream_digital_capture) {
3710 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3711 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3713 /* FIXME: do we need this for all Realtek codec models? */
3714 codec->spdif_status_reset = 1;
3717 if (spec->no_analog)
3720 /* If the use of more than one ADC is requested for the current
3721 * model, configure a second analog capture-only PCM.
3723 /* Additional Analaog capture for index #2 */
3724 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3725 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3726 codec->num_pcms = 3;
3727 info = spec->pcm_rec + 2;
3728 info->name = spec->stream_name_analog;
3729 if (spec->alt_dac_nid) {
3730 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3731 *spec->stream_analog_alt_playback;
3732 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3735 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3736 alc_pcm_null_stream;
3737 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3739 if (spec->num_adc_nids > 1) {
3740 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3741 *spec->stream_analog_alt_capture;
3742 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3744 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3745 spec->num_adc_nids - 1;
3747 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3748 alc_pcm_null_stream;
3749 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3756 static inline void alc_shutup(struct hda_codec *codec)
3758 snd_hda_shutup_pins(codec);
3761 static void alc_free_kctls(struct hda_codec *codec)
3763 struct alc_spec *spec = codec->spec;
3765 if (spec->kctls.list) {
3766 struct snd_kcontrol_new *kctl = spec->kctls.list;
3768 for (i = 0; i < spec->kctls.used; i++)
3769 kfree(kctl[i].name);
3771 snd_array_free(&spec->kctls);
3774 static void alc_free(struct hda_codec *codec)
3776 struct alc_spec *spec = codec->spec;
3782 alc_free_kctls(codec);
3784 snd_hda_detach_beep_device(codec);
3787 #ifdef CONFIG_SND_HDA_POWER_SAVE
3788 static void alc_power_eapd(struct hda_codec *codec)
3790 /* We currently only handle front, HP */
3791 switch (codec->vendor_id) {
3793 set_eapd(codec, 0x0f, 0);
3794 set_eapd(codec, 0x10, 0);
3807 set_eapd(codec, 0x14, 0);
3808 set_eapd(codec, 0x15, 0);
3813 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3815 struct alc_spec *spec = codec->spec;
3817 if (spec && spec->power_hook)
3818 spec->power_hook(codec);
3823 #ifdef SND_HDA_NEEDS_RESUME
3824 static int alc_resume(struct hda_codec *codec)
3826 codec->patch_ops.init(codec);
3827 snd_hda_codec_resume_amp(codec);
3828 snd_hda_codec_resume_cache(codec);
3835 static struct hda_codec_ops alc_patch_ops = {
3836 .build_controls = alc_build_controls,
3837 .build_pcms = alc_build_pcms,
3840 .unsol_event = alc_unsol_event,
3841 #ifdef SND_HDA_NEEDS_RESUME
3842 .resume = alc_resume,
3844 #ifdef CONFIG_SND_HDA_POWER_SAVE
3845 .suspend = alc_suspend,
3846 .check_power_status = alc_check_power_status,
3848 .reboot_notify = alc_shutup,
3851 /* replace the codec chip_name with the given string */
3852 static int alc_codec_rename(struct hda_codec *codec, const char *name)
3854 kfree(codec->chip_name);
3855 codec->chip_name = kstrdup(name, GFP_KERNEL);
3856 if (!codec->chip_name) {
3864 * Test configuration for debugging
3866 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3869 #ifdef CONFIG_SND_DEBUG
3870 static hda_nid_t alc880_test_dac_nids[4] = {
3871 0x02, 0x03, 0x04, 0x05
3874 static struct hda_input_mux alc880_test_capture_source = {
3883 { "Surround", 0x6 },
3887 static struct hda_channel_mode alc880_test_modes[4] = {
3894 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3895 struct snd_ctl_elem_info *uinfo)
3897 static char *texts[] = {
3898 "N/A", "Line Out", "HP Out",
3899 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3901 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3903 uinfo->value.enumerated.items = 8;
3904 if (uinfo->value.enumerated.item >= 8)
3905 uinfo->value.enumerated.item = 7;
3906 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3910 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3911 struct snd_ctl_elem_value *ucontrol)
3913 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3914 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3915 unsigned int pin_ctl, item = 0;
3917 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3918 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3919 if (pin_ctl & AC_PINCTL_OUT_EN) {
3920 if (pin_ctl & AC_PINCTL_HP_EN)
3924 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3925 switch (pin_ctl & AC_PINCTL_VREFEN) {
3926 case AC_PINCTL_VREF_HIZ: item = 3; break;
3927 case AC_PINCTL_VREF_50: item = 4; break;
3928 case AC_PINCTL_VREF_GRD: item = 5; break;
3929 case AC_PINCTL_VREF_80: item = 6; break;
3930 case AC_PINCTL_VREF_100: item = 7; break;
3933 ucontrol->value.enumerated.item[0] = item;
3937 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3938 struct snd_ctl_elem_value *ucontrol)
3940 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3941 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3942 static unsigned int ctls[] = {
3943 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3944 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3945 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3946 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3947 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3948 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3950 unsigned int old_ctl, new_ctl;
3952 old_ctl = snd_hda_codec_read(codec, nid, 0,
3953 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3954 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3955 if (old_ctl != new_ctl) {
3957 snd_hda_codec_write_cache(codec, nid, 0,
3958 AC_VERB_SET_PIN_WIDGET_CONTROL,
3960 val = ucontrol->value.enumerated.item[0] >= 3 ?
3962 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3969 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3970 struct snd_ctl_elem_info *uinfo)
3972 static char *texts[] = {
3973 "Front", "Surround", "CLFE", "Side"
3975 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3977 uinfo->value.enumerated.items = 4;
3978 if (uinfo->value.enumerated.item >= 4)
3979 uinfo->value.enumerated.item = 3;
3980 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3984 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3985 struct snd_ctl_elem_value *ucontrol)
3987 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3988 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3991 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3992 ucontrol->value.enumerated.item[0] = sel & 3;
3996 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3997 struct snd_ctl_elem_value *ucontrol)
3999 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4000 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4003 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4004 if (ucontrol->value.enumerated.item[0] != sel) {
4005 sel = ucontrol->value.enumerated.item[0] & 3;
4006 snd_hda_codec_write_cache(codec, nid, 0,
4007 AC_VERB_SET_CONNECT_SEL, sel);
4013 #define PIN_CTL_TEST(xname,nid) { \
4014 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4016 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4017 .info = alc_test_pin_ctl_info, \
4018 .get = alc_test_pin_ctl_get, \
4019 .put = alc_test_pin_ctl_put, \
4020 .private_value = nid \
4023 #define PIN_SRC_TEST(xname,nid) { \
4024 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4026 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4027 .info = alc_test_pin_src_info, \
4028 .get = alc_test_pin_src_get, \
4029 .put = alc_test_pin_src_put, \
4030 .private_value = nid \
4033 static struct snd_kcontrol_new alc880_test_mixer[] = {
4034 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4035 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4036 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4037 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4038 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4039 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4040 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4041 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4042 PIN_CTL_TEST("Front Pin Mode", 0x14),
4043 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4044 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4045 PIN_CTL_TEST("Side Pin Mode", 0x17),
4046 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4047 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4048 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4049 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4050 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4051 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4052 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4053 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4054 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4055 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4056 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4057 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4058 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4059 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4060 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4061 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4062 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4063 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4065 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4066 .name = "Channel Mode",
4067 .info = alc_ch_mode_info,
4068 .get = alc_ch_mode_get,
4069 .put = alc_ch_mode_put,
4074 static struct hda_verb alc880_test_init_verbs[] = {
4075 /* Unmute inputs of 0x0c - 0x0f */
4076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4077 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4084 /* Vol output for 0x0c-0x0f */
4085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4086 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4087 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4088 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4089 /* Set output pins 0x14-0x17 */
4090 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4091 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4092 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4093 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4094 /* Unmute output pins 0x14-0x17 */
4095 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4096 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4097 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4098 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4099 /* Set input pins 0x18-0x1c */
4100 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4101 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4102 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4103 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4104 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4105 /* Mute input pins 0x18-0x1b */
4106 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4107 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4108 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4109 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4112 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4113 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4114 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4115 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4116 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4117 /* Analog input/passthru */
4118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4130 static const char *alc880_models[ALC880_MODEL_LAST] = {
4131 [ALC880_3ST] = "3stack",
4132 [ALC880_TCL_S700] = "tcl",
4133 [ALC880_3ST_DIG] = "3stack-digout",
4134 [ALC880_CLEVO] = "clevo",
4135 [ALC880_5ST] = "5stack",
4136 [ALC880_5ST_DIG] = "5stack-digout",
4137 [ALC880_W810] = "w810",
4138 [ALC880_Z71V] = "z71v",
4139 [ALC880_6ST] = "6stack",
4140 [ALC880_6ST_DIG] = "6stack-digout",
4141 [ALC880_ASUS] = "asus",
4142 [ALC880_ASUS_W1V] = "asus-w1v",
4143 [ALC880_ASUS_DIG] = "asus-dig",
4144 [ALC880_ASUS_DIG2] = "asus-dig2",
4145 [ALC880_UNIWILL_DIG] = "uniwill",
4146 [ALC880_UNIWILL_P53] = "uniwill-p53",
4147 [ALC880_FUJITSU] = "fujitsu",
4148 [ALC880_F1734] = "F1734",
4150 [ALC880_LG_LW] = "lg-lw",
4151 [ALC880_MEDION_RIM] = "medion",
4152 #ifdef CONFIG_SND_DEBUG
4153 [ALC880_TEST] = "test",
4155 [ALC880_AUTO] = "auto",
4158 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4159 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4160 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4161 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4162 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4163 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4164 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4165 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4166 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4167 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4168 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4169 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4170 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4171 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4172 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4173 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4174 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4175 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4176 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4177 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4178 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4179 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4180 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4181 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4182 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4183 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4184 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4185 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4186 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4187 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4188 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4189 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4190 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4191 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4192 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4193 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4194 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4195 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4196 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4197 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4198 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4199 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4200 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4201 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4202 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4203 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4204 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4205 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4206 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4207 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4208 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4209 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4210 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4211 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4212 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4213 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4214 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4215 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4216 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4217 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4218 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4219 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4220 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4221 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4222 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4223 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4224 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4225 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4226 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4228 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4229 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4230 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4235 * ALC880 codec presets
4237 static struct alc_config_preset alc880_presets[] = {
4239 .mixers = { alc880_three_stack_mixer },
4240 .init_verbs = { alc880_volume_init_verbs,
4241 alc880_pin_3stack_init_verbs },
4242 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4243 .dac_nids = alc880_dac_nids,
4244 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4245 .channel_mode = alc880_threestack_modes,
4247 .input_mux = &alc880_capture_source,
4249 [ALC880_3ST_DIG] = {
4250 .mixers = { alc880_three_stack_mixer },
4251 .init_verbs = { alc880_volume_init_verbs,
4252 alc880_pin_3stack_init_verbs },
4253 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4254 .dac_nids = alc880_dac_nids,
4255 .dig_out_nid = ALC880_DIGOUT_NID,
4256 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4257 .channel_mode = alc880_threestack_modes,
4259 .input_mux = &alc880_capture_source,
4261 [ALC880_TCL_S700] = {
4262 .mixers = { alc880_tcl_s700_mixer },
4263 .init_verbs = { alc880_volume_init_verbs,
4264 alc880_pin_tcl_S700_init_verbs,
4265 alc880_gpio2_init_verbs },
4266 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4267 .dac_nids = alc880_dac_nids,
4268 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4269 .num_adc_nids = 1, /* single ADC */
4271 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4272 .channel_mode = alc880_2_jack_modes,
4273 .input_mux = &alc880_capture_source,
4276 .mixers = { alc880_three_stack_mixer,
4277 alc880_five_stack_mixer},
4278 .init_verbs = { alc880_volume_init_verbs,
4279 alc880_pin_5stack_init_verbs },
4280 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4281 .dac_nids = alc880_dac_nids,
4282 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4283 .channel_mode = alc880_fivestack_modes,
4284 .input_mux = &alc880_capture_source,
4286 [ALC880_5ST_DIG] = {
4287 .mixers = { alc880_three_stack_mixer,
4288 alc880_five_stack_mixer },
4289 .init_verbs = { alc880_volume_init_verbs,
4290 alc880_pin_5stack_init_verbs },
4291 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4292 .dac_nids = alc880_dac_nids,
4293 .dig_out_nid = ALC880_DIGOUT_NID,
4294 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4295 .channel_mode = alc880_fivestack_modes,
4296 .input_mux = &alc880_capture_source,
4299 .mixers = { alc880_six_stack_mixer },
4300 .init_verbs = { alc880_volume_init_verbs,
4301 alc880_pin_6stack_init_verbs },
4302 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4303 .dac_nids = alc880_6st_dac_nids,
4304 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4305 .channel_mode = alc880_sixstack_modes,
4306 .input_mux = &alc880_6stack_capture_source,
4308 [ALC880_6ST_DIG] = {
4309 .mixers = { alc880_six_stack_mixer },
4310 .init_verbs = { alc880_volume_init_verbs,
4311 alc880_pin_6stack_init_verbs },
4312 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4313 .dac_nids = alc880_6st_dac_nids,
4314 .dig_out_nid = ALC880_DIGOUT_NID,
4315 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4316 .channel_mode = alc880_sixstack_modes,
4317 .input_mux = &alc880_6stack_capture_source,
4320 .mixers = { alc880_w810_base_mixer },
4321 .init_verbs = { alc880_volume_init_verbs,
4322 alc880_pin_w810_init_verbs,
4323 alc880_gpio2_init_verbs },
4324 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4325 .dac_nids = alc880_w810_dac_nids,
4326 .dig_out_nid = ALC880_DIGOUT_NID,
4327 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4328 .channel_mode = alc880_w810_modes,
4329 .input_mux = &alc880_capture_source,
4332 .mixers = { alc880_z71v_mixer },
4333 .init_verbs = { alc880_volume_init_verbs,
4334 alc880_pin_z71v_init_verbs },
4335 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4336 .dac_nids = alc880_z71v_dac_nids,
4337 .dig_out_nid = ALC880_DIGOUT_NID,
4339 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4340 .channel_mode = alc880_2_jack_modes,
4341 .input_mux = &alc880_capture_source,
4344 .mixers = { alc880_f1734_mixer },
4345 .init_verbs = { alc880_volume_init_verbs,
4346 alc880_pin_f1734_init_verbs },
4347 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4348 .dac_nids = alc880_f1734_dac_nids,
4350 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4351 .channel_mode = alc880_2_jack_modes,
4352 .input_mux = &alc880_f1734_capture_source,
4353 .unsol_event = alc880_uniwill_p53_unsol_event,
4354 .setup = alc880_uniwill_p53_setup,
4355 .init_hook = alc_automute_amp,
4358 .mixers = { alc880_asus_mixer },
4359 .init_verbs = { alc880_volume_init_verbs,
4360 alc880_pin_asus_init_verbs,
4361 alc880_gpio1_init_verbs },
4362 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4363 .dac_nids = alc880_asus_dac_nids,
4364 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4365 .channel_mode = alc880_asus_modes,
4367 .input_mux = &alc880_capture_source,
4369 [ALC880_ASUS_DIG] = {
4370 .mixers = { alc880_asus_mixer },
4371 .init_verbs = { alc880_volume_init_verbs,
4372 alc880_pin_asus_init_verbs,
4373 alc880_gpio1_init_verbs },
4374 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4375 .dac_nids = alc880_asus_dac_nids,
4376 .dig_out_nid = ALC880_DIGOUT_NID,
4377 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4378 .channel_mode = alc880_asus_modes,
4380 .input_mux = &alc880_capture_source,
4382 [ALC880_ASUS_DIG2] = {
4383 .mixers = { alc880_asus_mixer },
4384 .init_verbs = { alc880_volume_init_verbs,
4385 alc880_pin_asus_init_verbs,
4386 alc880_gpio2_init_verbs }, /* use GPIO2 */
4387 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4388 .dac_nids = alc880_asus_dac_nids,
4389 .dig_out_nid = ALC880_DIGOUT_NID,
4390 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4391 .channel_mode = alc880_asus_modes,
4393 .input_mux = &alc880_capture_source,
4395 [ALC880_ASUS_W1V] = {
4396 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4397 .init_verbs = { alc880_volume_init_verbs,
4398 alc880_pin_asus_init_verbs,
4399 alc880_gpio1_init_verbs },
4400 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4401 .dac_nids = alc880_asus_dac_nids,
4402 .dig_out_nid = ALC880_DIGOUT_NID,
4403 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4404 .channel_mode = alc880_asus_modes,
4406 .input_mux = &alc880_capture_source,
4408 [ALC880_UNIWILL_DIG] = {
4409 .mixers = { alc880_asus_mixer },
4410 .init_verbs = { alc880_volume_init_verbs,
4411 alc880_pin_asus_init_verbs },
4412 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4413 .dac_nids = alc880_asus_dac_nids,
4414 .dig_out_nid = ALC880_DIGOUT_NID,
4415 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4416 .channel_mode = alc880_asus_modes,
4418 .input_mux = &alc880_capture_source,
4420 [ALC880_UNIWILL] = {
4421 .mixers = { alc880_uniwill_mixer },
4422 .init_verbs = { alc880_volume_init_verbs,
4423 alc880_uniwill_init_verbs },
4424 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4425 .dac_nids = alc880_asus_dac_nids,
4426 .dig_out_nid = ALC880_DIGOUT_NID,
4427 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4428 .channel_mode = alc880_threestack_modes,
4430 .input_mux = &alc880_capture_source,
4431 .unsol_event = alc880_uniwill_unsol_event,
4432 .setup = alc880_uniwill_setup,
4433 .init_hook = alc880_uniwill_init_hook,
4435 [ALC880_UNIWILL_P53] = {
4436 .mixers = { alc880_uniwill_p53_mixer },
4437 .init_verbs = { alc880_volume_init_verbs,
4438 alc880_uniwill_p53_init_verbs },
4439 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4440 .dac_nids = alc880_asus_dac_nids,
4441 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4442 .channel_mode = alc880_threestack_modes,
4443 .input_mux = &alc880_capture_source,
4444 .unsol_event = alc880_uniwill_p53_unsol_event,
4445 .setup = alc880_uniwill_p53_setup,
4446 .init_hook = alc_automute_amp,
4448 [ALC880_FUJITSU] = {
4449 .mixers = { alc880_fujitsu_mixer },
4450 .init_verbs = { alc880_volume_init_verbs,
4451 alc880_uniwill_p53_init_verbs,
4452 alc880_beep_init_verbs },
4453 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4454 .dac_nids = alc880_dac_nids,
4455 .dig_out_nid = ALC880_DIGOUT_NID,
4456 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4457 .channel_mode = alc880_2_jack_modes,
4458 .input_mux = &alc880_capture_source,
4459 .unsol_event = alc880_uniwill_p53_unsol_event,
4460 .setup = alc880_uniwill_p53_setup,
4461 .init_hook = alc_automute_amp,
4464 .mixers = { alc880_three_stack_mixer },
4465 .init_verbs = { alc880_volume_init_verbs,
4466 alc880_pin_clevo_init_verbs },
4467 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4468 .dac_nids = alc880_dac_nids,
4470 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4471 .channel_mode = alc880_threestack_modes,
4473 .input_mux = &alc880_capture_source,
4476 .mixers = { alc880_lg_mixer },
4477 .init_verbs = { alc880_volume_init_verbs,
4478 alc880_lg_init_verbs },
4479 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4480 .dac_nids = alc880_lg_dac_nids,
4481 .dig_out_nid = ALC880_DIGOUT_NID,
4482 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4483 .channel_mode = alc880_lg_ch_modes,
4485 .input_mux = &alc880_lg_capture_source,
4486 .unsol_event = alc_automute_amp_unsol_event,
4487 .setup = alc880_lg_setup,
4488 .init_hook = alc_automute_amp,
4489 #ifdef CONFIG_SND_HDA_POWER_SAVE
4490 .loopbacks = alc880_lg_loopbacks,
4494 .mixers = { alc880_lg_lw_mixer },
4495 .init_verbs = { alc880_volume_init_verbs,
4496 alc880_lg_lw_init_verbs },
4497 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4498 .dac_nids = alc880_dac_nids,
4499 .dig_out_nid = ALC880_DIGOUT_NID,
4500 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4501 .channel_mode = alc880_lg_lw_modes,
4502 .input_mux = &alc880_lg_lw_capture_source,
4503 .unsol_event = alc_automute_amp_unsol_event,
4504 .setup = alc880_lg_lw_setup,
4505 .init_hook = alc_automute_amp,
4507 [ALC880_MEDION_RIM] = {
4508 .mixers = { alc880_medion_rim_mixer },
4509 .init_verbs = { alc880_volume_init_verbs,
4510 alc880_medion_rim_init_verbs,
4511 alc_gpio2_init_verbs },
4512 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4513 .dac_nids = alc880_dac_nids,
4514 .dig_out_nid = ALC880_DIGOUT_NID,
4515 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4516 .channel_mode = alc880_2_jack_modes,
4517 .input_mux = &alc880_medion_rim_capture_source,
4518 .unsol_event = alc880_medion_rim_unsol_event,
4519 .setup = alc880_medion_rim_setup,
4520 .init_hook = alc880_medion_rim_automute,
4522 #ifdef CONFIG_SND_DEBUG
4524 .mixers = { alc880_test_mixer },
4525 .init_verbs = { alc880_test_init_verbs },
4526 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4527 .dac_nids = alc880_test_dac_nids,
4528 .dig_out_nid = ALC880_DIGOUT_NID,
4529 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4530 .channel_mode = alc880_test_modes,
4531 .input_mux = &alc880_test_capture_source,
4537 * Automatic parse of I/O pins from the BIOS configuration
4542 ALC_CTL_WIDGET_MUTE,
4545 static struct snd_kcontrol_new alc880_control_templates[] = {
4546 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4547 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4548 HDA_BIND_MUTE(NULL, 0, 0, 0),
4551 /* add dynamic controls */
4552 static int add_control(struct alc_spec *spec, int type, const char *name,
4555 struct snd_kcontrol_new *knew;
4557 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4558 knew = snd_array_new(&spec->kctls);
4561 *knew = alc880_control_templates[type];
4562 knew->name = kstrdup(name, GFP_KERNEL);
4565 if (get_amp_nid_(val))
4566 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4567 knew->private_value = val;
4571 static int add_control_with_pfx(struct alc_spec *spec, int type,
4572 const char *pfx, const char *dir,
4573 const char *sfx, unsigned long val)
4576 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4577 return add_control(spec, type, name, val);
4580 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4581 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4582 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4583 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4585 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4586 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4587 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4588 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4589 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4590 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4591 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4592 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4593 #define ALC880_PIN_CD_NID 0x1c
4595 /* fill in the dac_nids table from the parsed pin configuration */
4596 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4597 const struct auto_pin_cfg *cfg)
4603 memset(assigned, 0, sizeof(assigned));
4604 spec->multiout.dac_nids = spec->private_dac_nids;
4606 /* check the pins hardwired to audio widget */
4607 for (i = 0; i < cfg->line_outs; i++) {
4608 nid = cfg->line_out_pins[i];
4609 if (alc880_is_fixed_pin(nid)) {
4610 int idx = alc880_fixed_pin_idx(nid);
4611 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4615 /* left pins can be connect to any audio widget */
4616 for (i = 0; i < cfg->line_outs; i++) {
4617 nid = cfg->line_out_pins[i];
4618 if (alc880_is_fixed_pin(nid))
4620 /* search for an empty channel */
4621 for (j = 0; j < cfg->line_outs; j++) {
4623 spec->multiout.dac_nids[i] =
4624 alc880_idx_to_dac(j);
4630 spec->multiout.num_dacs = cfg->line_outs;
4634 /* add playback controls from the parsed DAC table */
4635 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4636 const struct auto_pin_cfg *cfg)
4638 static const char *chname[4] = {
4639 "Front", "Surround", NULL /*CLFE*/, "Side"
4644 for (i = 0; i < cfg->line_outs; i++) {
4645 if (!spec->multiout.dac_nids[i])
4647 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4650 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4652 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4656 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4658 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4662 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4664 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4668 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4670 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4676 if (cfg->line_outs == 1 &&
4677 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4681 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4682 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4686 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4687 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4696 /* add playback controls for speaker and HP outputs */
4697 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4706 if (alc880_is_fixed_pin(pin)) {
4707 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4708 /* specify the DAC as the extra output */
4709 if (!spec->multiout.hp_nid)
4710 spec->multiout.hp_nid = nid;
4712 spec->multiout.extra_out_nid[0] = nid;
4713 /* control HP volume/switch on the output mixer amp */
4714 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4715 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4716 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4719 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4720 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4723 } else if (alc880_is_multi_pin(pin)) {
4724 /* set manual connection */
4725 /* we have only a switch on HP-out PIN */
4726 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4727 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4734 /* create input playback/capture controls for the given pin */
4735 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4736 const char *ctlname,
4737 int idx, hda_nid_t mix_nid)
4741 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4742 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4745 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4746 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4752 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4754 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4755 return (pincap & AC_PINCAP_IN) != 0;
4758 /* create playback/capture controls for input pins */
4759 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4760 const struct auto_pin_cfg *cfg,
4762 hda_nid_t cap1, hda_nid_t cap2)
4764 struct alc_spec *spec = codec->spec;
4765 struct hda_input_mux *imux = &spec->private_imux[0];
4768 for (i = 0; i < AUTO_PIN_LAST; i++) {
4771 pin = cfg->input_pins[i];
4772 if (!alc_is_input_pin(codec, pin))
4776 idx = get_connection_index(codec, mixer, pin);
4778 err = new_analog_input(spec, pin,
4779 auto_pin_cfg_labels[i],
4788 idx = get_connection_index(codec, cap1, pin);
4789 if (idx < 0 && cap2)
4790 idx = get_connection_index(codec, cap2, pin);
4792 imux->items[imux->num_items].label =
4793 auto_pin_cfg_labels[i];
4794 imux->items[imux->num_items].index = idx;
4801 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4802 const struct auto_pin_cfg *cfg)
4804 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4807 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4808 unsigned int pin_type)
4810 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4813 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4817 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4818 hda_nid_t nid, int pin_type,
4821 alc_set_pin_output(codec, nid, pin_type);
4822 /* need the manual connection? */
4823 if (alc880_is_multi_pin(nid)) {
4824 struct alc_spec *spec = codec->spec;
4825 int idx = alc880_multi_pin_idx(nid);
4826 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4827 AC_VERB_SET_CONNECT_SEL,
4828 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4832 static int get_pin_type(int line_out_type)
4834 if (line_out_type == AUTO_PIN_HP_OUT)
4840 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4842 struct alc_spec *spec = codec->spec;
4845 for (i = 0; i < spec->autocfg.line_outs; i++) {
4846 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4847 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4848 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4852 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4854 struct alc_spec *spec = codec->spec;
4857 pin = spec->autocfg.speaker_pins[0];
4858 if (pin) /* connect to front */
4859 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4860 pin = spec->autocfg.hp_pins[0];
4861 if (pin) /* connect to front */
4862 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4865 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4867 struct alc_spec *spec = codec->spec;
4870 for (i = 0; i < AUTO_PIN_LAST; i++) {
4871 hda_nid_t nid = spec->autocfg.input_pins[i];
4872 if (alc_is_input_pin(codec, nid)) {
4873 alc_set_input_pin(codec, nid, i);
4874 if (nid != ALC880_PIN_CD_NID &&
4875 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4876 snd_hda_codec_write(codec, nid, 0,
4877 AC_VERB_SET_AMP_GAIN_MUTE,
4883 /* parse the BIOS configuration and set up the alc_spec */
4884 /* return 1 if successful, 0 if the proper config is not found,
4885 * or a negative error code
4887 static int alc880_parse_auto_config(struct hda_codec *codec)
4889 struct alc_spec *spec = codec->spec;
4891 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4893 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4897 if (!spec->autocfg.line_outs)
4898 return 0; /* can't find valid BIOS pin config */
4900 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4903 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4906 err = alc880_auto_create_extra_out(spec,
4907 spec->autocfg.speaker_pins[0],
4911 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4915 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4919 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4921 /* check multiple SPDIF-out (for recent codecs) */
4922 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4924 err = snd_hda_get_connections(codec,
4925 spec->autocfg.dig_out_pins[i],
4930 spec->multiout.dig_out_nid = dig_nid;
4932 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4933 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4935 spec->slave_dig_outs[i - 1] = dig_nid;
4938 if (spec->autocfg.dig_in_pin)
4939 spec->dig_in_nid = ALC880_DIGIN_NID;
4941 if (spec->kctls.list)
4942 add_mixer(spec, spec->kctls.list);
4944 add_verb(spec, alc880_volume_init_verbs);
4946 spec->num_mux_defs = 1;
4947 spec->input_mux = &spec->private_imux[0];
4949 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4954 /* additional initialization for auto-configuration model */
4955 static void alc880_auto_init(struct hda_codec *codec)
4957 struct alc_spec *spec = codec->spec;
4958 alc880_auto_init_multi_out(codec);
4959 alc880_auto_init_extra_out(codec);
4960 alc880_auto_init_analog_input(codec);
4961 if (spec->unsol_event)
4962 alc_inithook(codec);
4965 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4966 * one of two digital mic pins, e.g. on ALC272
4968 static void fixup_automic_adc(struct hda_codec *codec)
4970 struct alc_spec *spec = codec->spec;
4973 for (i = 0; i < spec->num_adc_nids; i++) {
4974 hda_nid_t cap = spec->capsrc_nids ?
4975 spec->capsrc_nids[i] : spec->adc_nids[i];
4978 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4981 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4984 spec->int_mic.mux_idx = iidx;
4985 spec->ext_mic.mux_idx = eidx;
4986 if (spec->capsrc_nids)
4987 spec->capsrc_nids += i;
4988 spec->adc_nids += i;
4989 spec->num_adc_nids = 1;
4992 snd_printd(KERN_INFO "hda_codec: %s: "
4993 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4994 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4995 spec->auto_mic = 0; /* disable auto-mic to be sure */
4998 /* choose the ADC/MUX containing the input pin and initialize the setup */
4999 static void fixup_single_adc(struct hda_codec *codec)
5001 struct alc_spec *spec = codec->spec;
5005 /* search for the input pin; there must be only one */
5006 for (i = 0; i < AUTO_PIN_LAST; i++) {
5007 if (spec->autocfg.input_pins[i]) {
5008 pin = spec->autocfg.input_pins[i];
5015 /* set the default connection to that pin */
5016 for (i = 0; i < spec->num_adc_nids; i++) {
5017 hda_nid_t cap = spec->capsrc_nids ?
5018 spec->capsrc_nids[i] : spec->adc_nids[i];
5021 idx = get_connection_index(codec, cap, pin);
5024 /* use only this ADC */
5025 if (spec->capsrc_nids)
5026 spec->capsrc_nids += i;
5027 spec->adc_nids += i;
5028 spec->num_adc_nids = 1;
5029 /* select or unmute this route */
5030 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5031 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5034 snd_hda_codec_write_cache(codec, cap, 0,
5035 AC_VERB_SET_CONNECT_SEL, idx);
5041 static void set_capture_mixer(struct hda_codec *codec)
5043 struct alc_spec *spec = codec->spec;
5044 static struct snd_kcontrol_new *caps[2][3] = {
5045 { alc_capture_mixer_nosrc1,
5046 alc_capture_mixer_nosrc2,
5047 alc_capture_mixer_nosrc3 },
5048 { alc_capture_mixer1,
5050 alc_capture_mixer3 },
5052 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5055 fixup_automic_adc(codec);
5056 else if (spec->input_mux) {
5057 if (spec->input_mux->num_items > 1)
5059 else if (spec->input_mux->num_items == 1)
5060 fixup_single_adc(codec);
5062 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
5066 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5067 #define set_beep_amp(spec, nid, idx, dir) \
5068 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5070 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5074 * OK, here we have finally the patch for ALC880
5077 static int patch_alc880(struct hda_codec *codec)
5079 struct alc_spec *spec;
5083 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5089 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5092 if (board_config < 0) {
5093 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5095 board_config = ALC880_AUTO;
5098 if (board_config == ALC880_AUTO) {
5099 /* automatic parse from the BIOS config */
5100 err = alc880_parse_auto_config(codec);
5106 "hda_codec: Cannot set up configuration "
5107 "from BIOS. Using 3-stack mode...\n");
5108 board_config = ALC880_3ST;
5112 err = snd_hda_attach_beep_device(codec, 0x1);
5118 if (board_config != ALC880_AUTO)
5119 setup_preset(codec, &alc880_presets[board_config]);
5121 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5122 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5123 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5125 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5126 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5128 if (!spec->adc_nids && spec->input_mux) {
5129 /* check whether NID 0x07 is valid */
5130 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5132 wcap = get_wcaps_type(wcap);
5133 if (wcap != AC_WID_AUD_IN) {
5134 spec->adc_nids = alc880_adc_nids_alt;
5135 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5137 spec->adc_nids = alc880_adc_nids;
5138 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5141 set_capture_mixer(codec);
5142 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5144 spec->vmaster_nid = 0x0c;
5146 codec->patch_ops = alc_patch_ops;
5147 if (board_config == ALC880_AUTO)
5148 spec->init_hook = alc880_auto_init;
5149 #ifdef CONFIG_SND_HDA_POWER_SAVE
5150 if (!spec->loopback.amplist)
5151 spec->loopback.amplist = alc880_loopbacks;
5162 static hda_nid_t alc260_dac_nids[1] = {
5167 static hda_nid_t alc260_adc_nids[1] = {
5172 static hda_nid_t alc260_adc_nids_alt[1] = {
5177 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5178 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5180 static hda_nid_t alc260_dual_adc_nids[2] = {
5185 #define ALC260_DIGOUT_NID 0x03
5186 #define ALC260_DIGIN_NID 0x06
5188 static struct hda_input_mux alc260_capture_source = {
5192 { "Front Mic", 0x1 },
5198 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5199 * headphone jack and the internal CD lines since these are the only pins at
5200 * which audio can appear. For flexibility, also allow the option of
5201 * recording the mixer output on the second ADC (ADC0 doesn't have a
5202 * connection to the mixer output).
5204 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5208 { "Mic/Line", 0x0 },
5210 { "Headphone", 0x2 },
5216 { "Mic/Line", 0x0 },
5218 { "Headphone", 0x2 },
5225 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5226 * the Fujitsu S702x, but jacks are marked differently.
5228 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5235 { "Headphone", 0x5 },
5244 { "Headphone", 0x6 },
5250 /* Maxdata Favorit 100XS */
5251 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5255 { "Line/Mic", 0x0 },
5262 { "Line/Mic", 0x0 },
5270 * This is just place-holder, so there's something for alc_build_pcms to look
5271 * at when it calculates the maximum number of channels. ALC260 has no mixer
5272 * element which allows changing the channel mode, so the verb list is
5275 static struct hda_channel_mode alc260_modes[1] = {
5280 /* Mixer combinations
5282 * basic: base_output + input + pc_beep + capture
5283 * HP: base_output + input + capture_alt
5284 * HP_3013: hp_3013 + input + capture
5285 * fujitsu: fujitsu + capture
5286 * acer: acer + capture
5289 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5290 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5291 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5292 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5293 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5294 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5295 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5299 static struct snd_kcontrol_new alc260_input_mixer[] = {
5300 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5301 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5302 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5303 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5304 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5305 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5306 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5307 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5311 /* update HP, line and mono out pins according to the master switch */
5312 static void alc260_hp_master_update(struct hda_codec *codec,
5313 hda_nid_t hp, hda_nid_t line,
5316 struct alc_spec *spec = codec->spec;
5317 unsigned int val = spec->master_sw ? PIN_HP : 0;
5318 /* change HP and line-out pins */
5319 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5321 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5323 /* mono (speaker) depending on the HP jack sense */
5324 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5325 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5329 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5330 struct snd_ctl_elem_value *ucontrol)
5332 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5333 struct alc_spec *spec = codec->spec;
5334 *ucontrol->value.integer.value = spec->master_sw;
5338 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5339 struct snd_ctl_elem_value *ucontrol)
5341 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5342 struct alc_spec *spec = codec->spec;
5343 int val = !!*ucontrol->value.integer.value;
5344 hda_nid_t hp, line, mono;
5346 if (val == spec->master_sw)
5348 spec->master_sw = val;
5349 hp = (kcontrol->private_value >> 16) & 0xff;
5350 line = (kcontrol->private_value >> 8) & 0xff;
5351 mono = kcontrol->private_value & 0xff;
5352 alc260_hp_master_update(codec, hp, line, mono);
5356 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5358 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5359 .name = "Master Playback Switch",
5360 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5361 .info = snd_ctl_boolean_mono_info,
5362 .get = alc260_hp_master_sw_get,
5363 .put = alc260_hp_master_sw_put,
5364 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5366 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5367 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5368 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5369 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5370 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5372 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5376 static struct hda_verb alc260_hp_unsol_verbs[] = {
5377 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5381 static void alc260_hp_automute(struct hda_codec *codec)
5383 struct alc_spec *spec = codec->spec;
5385 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5386 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5389 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5391 if ((res >> 26) == ALC880_HP_EVENT)
5392 alc260_hp_automute(codec);
5395 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5397 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5398 .name = "Master Playback Switch",
5399 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5400 .info = snd_ctl_boolean_mono_info,
5401 .get = alc260_hp_master_sw_get,
5402 .put = alc260_hp_master_sw_put,
5403 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5405 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5406 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5407 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5408 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5409 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5410 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5411 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5412 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5416 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5417 .ops = &snd_hda_bind_vol,
5419 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5420 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5421 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5426 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5427 .ops = &snd_hda_bind_sw,
5429 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5430 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5435 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5436 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5437 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5438 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5439 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5443 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5444 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5448 static void alc260_hp_3013_automute(struct hda_codec *codec)
5450 struct alc_spec *spec = codec->spec;
5452 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5453 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5456 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5459 if ((res >> 26) == ALC880_HP_EVENT)
5460 alc260_hp_3013_automute(codec);
5463 static void alc260_hp_3012_automute(struct hda_codec *codec)
5465 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5467 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5469 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5471 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5475 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5478 if ((res >> 26) == ALC880_HP_EVENT)
5479 alc260_hp_3012_automute(codec);
5482 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5483 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5485 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5486 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5487 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5488 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5489 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5490 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5491 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5492 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5493 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5494 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5495 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5499 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5500 * versions of the ALC260 don't act on requests to enable mic bias from NID
5501 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5502 * datasheet doesn't mention this restriction. At this stage it's not clear
5503 * whether this behaviour is intentional or is a hardware bug in chip
5504 * revisions available in early 2006. Therefore for now allow the
5505 * "Headphone Jack Mode" control to span all choices, but if it turns out
5506 * that the lack of mic bias for this NID is intentional we could change the
5507 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5509 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5510 * don't appear to make the mic bias available from the "line" jack, even
5511 * though the NID used for this jack (0x14) can supply it. The theory is
5512 * that perhaps Acer have included blocking capacitors between the ALC260
5513 * and the output jack. If this turns out to be the case for all such
5514 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5515 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5517 * The C20x Tablet series have a mono internal speaker which is controlled
5518 * via the chip's Mono sum widget and pin complex, so include the necessary
5519 * controls for such models. On models without a "mono speaker" the control
5520 * won't do anything.
5522 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5523 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5524 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5525 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5526 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5528 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5530 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5531 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5533 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5534 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5535 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5536 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5537 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5541 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5543 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5544 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5545 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5546 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5547 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5548 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5549 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5553 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5554 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5556 static struct snd_kcontrol_new alc260_will_mixer[] = {
5557 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5558 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5560 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5561 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5562 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5563 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5564 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5565 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5566 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5570 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5571 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5573 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5574 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5575 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5576 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5577 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5578 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5579 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5580 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5581 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5582 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5583 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5588 * initialization verbs
5590 static struct hda_verb alc260_init_verbs[] = {
5591 /* Line In pin widget for input */
5592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5593 /* CD pin widget for input */
5594 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5595 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5596 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5597 /* Mic2 (front panel) pin widget for input and vref at 80% */
5598 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5599 /* LINE-2 is used for line-out in rear */
5600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5601 /* select line-out */
5602 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5604 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5606 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5608 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5609 /* mute capture amp left and right */
5610 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5611 /* set connection select to line in (default select for this ADC) */
5612 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5613 /* mute capture amp left and right */
5614 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5615 /* set connection select to line in (default select for this ADC) */
5616 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5617 /* set vol=0 Line-Out mixer amp left and right */
5618 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5619 /* unmute pin widget amp left and right (no gain on this amp) */
5620 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5621 /* set vol=0 HP mixer amp left and right */
5622 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5623 /* unmute pin widget amp left and right (no gain on this amp) */
5624 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5625 /* set vol=0 Mono mixer amp left and right */
5626 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5627 /* unmute pin widget amp left and right (no gain on this amp) */
5628 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5629 /* unmute LINE-2 out pin */
5630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5631 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5634 /* mute analog inputs */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5640 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5641 /* mute Front out path */
5642 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5643 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5644 /* mute Headphone out path */
5645 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5646 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5647 /* mute Mono out path */
5648 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5649 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5653 #if 0 /* should be identical with alc260_init_verbs? */
5654 static struct hda_verb alc260_hp_init_verbs[] = {
5655 /* Headphone and output */
5656 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5658 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5659 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5660 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5661 /* Mic2 (front panel) pin widget for input and vref at 80% */
5662 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5663 /* Line In pin widget for input */
5664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5665 /* Line-2 pin widget for output */
5666 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5667 /* CD pin widget for input */
5668 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5669 /* unmute amp left and right */
5670 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5671 /* set connection select to line in (default select for this ADC) */
5672 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5673 /* unmute Line-Out mixer amp left and right (volume = 0) */
5674 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5675 /* mute pin widget amp left and right (no gain on this amp) */
5676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5677 /* unmute HP mixer amp left and right (volume = 0) */
5678 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5679 /* mute pin widget amp left and right (no gain on this amp) */
5680 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5681 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5684 /* mute analog inputs */
5685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5686 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5690 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5691 /* Unmute Front out path */
5692 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5693 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5694 /* Unmute Headphone out path */
5695 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5696 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5697 /* Unmute Mono out path */
5698 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5699 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5704 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5705 /* Line out and output */
5706 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5708 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5709 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5710 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5711 /* Mic2 (front panel) pin widget for input and vref at 80% */
5712 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5713 /* Line In pin widget for input */
5714 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5715 /* Headphone pin widget for output */
5716 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5717 /* CD pin widget for input */
5718 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5719 /* unmute amp left and right */
5720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5721 /* set connection select to line in (default select for this ADC) */
5722 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5723 /* unmute Line-Out mixer amp left and right (volume = 0) */
5724 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5725 /* mute pin widget amp left and right (no gain on this amp) */
5726 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5727 /* unmute HP mixer amp left and right (volume = 0) */
5728 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5729 /* mute pin widget amp left and right (no gain on this amp) */
5730 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5731 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5734 /* mute analog inputs */
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5740 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5741 /* Unmute Front out path */
5742 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5743 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5744 /* Unmute Headphone out path */
5745 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5746 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5747 /* Unmute Mono out path */
5748 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5749 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5753 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5754 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5755 * audio = 0x16, internal speaker = 0x10.
5757 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5758 /* Disable all GPIOs */
5759 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5760 /* Internal speaker is connected to headphone pin */
5761 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5762 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5763 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5764 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5765 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5766 /* Ensure all other unused pins are disabled and muted. */
5767 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5769 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5770 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5771 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5772 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5776 /* Disable digital (SPDIF) pins */
5777 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5778 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5780 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5781 * when acting as an output.
5783 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5785 /* Start with output sum widgets muted and their output gains at min */
5786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5787 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5788 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5790 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5791 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5792 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5793 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5794 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5796 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5797 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5798 /* Unmute Line1 pin widget output buffer since it starts as an output.
5799 * If the pin mode is changed by the user the pin mode control will
5800 * take care of enabling the pin's input/output buffers as needed.
5801 * Therefore there's no need to enable the input buffer at this
5804 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5805 /* Unmute input buffer of pin widget used for Line-in (no equiv
5808 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5810 /* Mute capture amp left and right */
5811 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5812 /* Set ADC connection select to match default mixer setting - line
5815 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5817 /* Do the same for the second ADC: mute capture input amp and
5818 * set ADC connection to line in (on mic1 pin)
5820 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5821 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5823 /* Mute all inputs to mixer widget (even unconnected ones) */
5824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5826 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5827 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5829 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5830 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5831 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5836 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5837 * similar laptops (adapted from Fujitsu init verbs).
5839 static struct hda_verb alc260_acer_init_verbs[] = {
5840 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5841 * the headphone jack. Turn this on and rely on the standard mute
5842 * methods whenever the user wants to turn these outputs off.
5844 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5845 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5846 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5847 /* Internal speaker/Headphone jack is connected to Line-out pin */
5848 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5849 /* Internal microphone/Mic jack is connected to Mic1 pin */
5850 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5851 /* Line In jack is connected to Line1 pin */
5852 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5853 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5854 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5855 /* Ensure all other unused pins are disabled and muted. */
5856 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5857 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5858 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5859 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5860 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5861 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5862 /* Disable digital (SPDIF) pins */
5863 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5864 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5866 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5867 * bus when acting as outputs.
5869 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5870 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5872 /* Start with output sum widgets muted and their output gains at min */
5873 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5874 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5875 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5876 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5877 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5878 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5879 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5880 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5881 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5883 /* Unmute Line-out pin widget amp left and right
5884 * (no equiv mixer ctrl)
5886 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5887 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5888 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5889 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5890 * inputs. If the pin mode is changed by the user the pin mode control
5891 * will take care of enabling the pin's input/output buffers as needed.
5892 * Therefore there's no need to enable the input buffer at this
5895 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5896 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5898 /* Mute capture amp left and right */
5899 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5900 /* Set ADC connection select to match default mixer setting - mic
5903 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5905 /* Do similar with the second ADC: mute capture input amp and
5906 * set ADC connection to mic to match ALSA's default state.
5908 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5909 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5911 /* Mute all inputs to mixer widget (even unconnected ones) */
5912 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5924 /* Initialisation sequence for Maxdata Favorit 100XS
5925 * (adapted from Acer init verbs).
5927 static struct hda_verb alc260_favorit100_init_verbs[] = {
5928 /* GPIO 0 enables the output jack.
5929 * Turn this on and rely on the standard mute
5930 * methods whenever the user wants to turn these outputs off.
5932 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5933 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5934 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5935 /* Line/Mic input jack is connected to Mic1 pin */
5936 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5937 /* Ensure all other unused pins are disabled and muted. */
5938 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5939 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5940 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5941 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5942 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5943 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5944 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5945 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5946 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5947 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5948 /* Disable digital (SPDIF) pins */
5949 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5950 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5952 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5953 * bus when acting as outputs.
5955 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5956 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5958 /* Start with output sum widgets muted and their output gains at min */
5959 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5960 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5961 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5962 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5963 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5964 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5965 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5966 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5967 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5969 /* Unmute Line-out pin widget amp left and right
5970 * (no equiv mixer ctrl)
5972 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5973 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5974 * inputs. If the pin mode is changed by the user the pin mode control
5975 * will take care of enabling the pin's input/output buffers as needed.
5976 * Therefore there's no need to enable the input buffer at this
5979 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5981 /* Mute capture amp left and right */
5982 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5983 /* Set ADC connection select to match default mixer setting - mic
5986 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5988 /* Do similar with the second ADC: mute capture input amp and
5989 * set ADC connection to mic to match ALSA's default state.
5991 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5992 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5994 /* Mute all inputs to mixer widget (even unconnected ones) */
5995 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5998 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5999 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6000 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6001 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6007 static struct hda_verb alc260_will_verbs[] = {
6008 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6009 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6010 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6011 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6012 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6013 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6017 static struct hda_verb alc260_replacer_672v_verbs[] = {
6018 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6019 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6020 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6022 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6023 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6024 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6026 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6030 /* toggle speaker-output according to the hp-jack state */
6031 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6033 unsigned int present;
6035 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6036 present = snd_hda_jack_detect(codec, 0x0f);
6038 snd_hda_codec_write_cache(codec, 0x01, 0,
6039 AC_VERB_SET_GPIO_DATA, 1);
6040 snd_hda_codec_write_cache(codec, 0x0f, 0,
6041 AC_VERB_SET_PIN_WIDGET_CONTROL,
6044 snd_hda_codec_write_cache(codec, 0x01, 0,
6045 AC_VERB_SET_GPIO_DATA, 0);
6046 snd_hda_codec_write_cache(codec, 0x0f, 0,
6047 AC_VERB_SET_PIN_WIDGET_CONTROL,
6052 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6055 if ((res >> 26) == ALC880_HP_EVENT)
6056 alc260_replacer_672v_automute(codec);
6059 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6060 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6061 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6062 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6063 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6064 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6065 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6066 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6067 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6068 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6069 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6073 /* Test configuration for debugging, modelled after the ALC880 test
6076 #ifdef CONFIG_SND_DEBUG
6077 static hda_nid_t alc260_test_dac_nids[1] = {
6080 static hda_nid_t alc260_test_adc_nids[2] = {
6083 /* For testing the ALC260, each input MUX needs its own definition since
6084 * the signal assignments are different. This assumes that the first ADC
6087 static struct hda_input_mux alc260_test_capture_sources[2] = {
6091 { "MIC1 pin", 0x0 },
6092 { "MIC2 pin", 0x1 },
6093 { "LINE1 pin", 0x2 },
6094 { "LINE2 pin", 0x3 },
6096 { "LINE-OUT pin", 0x5 },
6097 { "HP-OUT pin", 0x6 },
6103 { "MIC1 pin", 0x0 },
6104 { "MIC2 pin", 0x1 },
6105 { "LINE1 pin", 0x2 },
6106 { "LINE2 pin", 0x3 },
6109 { "LINE-OUT pin", 0x6 },
6110 { "HP-OUT pin", 0x7 },
6114 static struct snd_kcontrol_new alc260_test_mixer[] = {
6115 /* Output driver widgets */
6116 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6117 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6118 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6119 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6120 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6121 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6123 /* Modes for retasking pin widgets
6124 * Note: the ALC260 doesn't seem to act on requests to enable mic
6125 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6126 * mention this restriction. At this stage it's not clear whether
6127 * this behaviour is intentional or is a hardware bug in chip
6128 * revisions available at least up until early 2006. Therefore for
6129 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6130 * choices, but if it turns out that the lack of mic bias for these
6131 * NIDs is intentional we could change their modes from
6132 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6134 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6135 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6136 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6137 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6138 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6139 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6141 /* Loopback mixer controls */
6142 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6143 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6144 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6145 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6146 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6147 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6148 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6149 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6150 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6151 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6152 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6153 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6154 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6155 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6157 /* Controls for GPIO pins, assuming they are configured as outputs */
6158 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6159 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6160 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6161 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6163 /* Switches to allow the digital IO pins to be enabled. The datasheet
6164 * is ambigious as to which NID is which; testing on laptops which
6165 * make this output available should provide clarification.
6167 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6168 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6170 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6171 * this output to turn on an external amplifier.
6173 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6174 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6178 static struct hda_verb alc260_test_init_verbs[] = {
6179 /* Enable all GPIOs as outputs with an initial value of 0 */
6180 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6181 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6182 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6184 /* Enable retasking pins as output, initially without power amp */
6185 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6186 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6187 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6189 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6190 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6192 /* Disable digital (SPDIF) pins initially, but users can enable
6193 * them via a mixer switch. In the case of SPDIF-out, this initverb
6194 * payload also sets the generation to 0, output to be in "consumer"
6195 * PCM format, copyright asserted, no pre-emphasis and no validity
6198 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6199 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6201 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6202 * OUT1 sum bus when acting as an output.
6204 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6205 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6206 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6207 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6209 /* Start with output sum widgets muted and their output gains at min */
6210 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6211 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6212 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6213 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6214 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6215 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6216 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6217 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6218 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6220 /* Unmute retasking pin widget output buffers since the default
6221 * state appears to be output. As the pin mode is changed by the
6222 * user the pin mode control will take care of enabling the pin's
6223 * input/output buffers as needed.
6225 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6226 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6227 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6228 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6229 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6230 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6231 /* Also unmute the mono-out pin widget */
6232 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6234 /* Mute capture amp left and right */
6235 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6236 /* Set ADC connection select to match default mixer setting (mic1
6239 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6241 /* Do the same for the second ADC: mute capture input amp and
6242 * set ADC connection to mic1 pin
6244 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6245 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6247 /* Mute all inputs to mixer widget (even unconnected ones) */
6248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6251 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6253 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6254 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6261 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6262 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6264 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6265 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6268 * for BIOS auto-configuration
6271 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6272 const char *pfx, int *vol_bits)
6275 unsigned long vol_val, sw_val;
6278 if (nid >= 0x0f && nid < 0x11) {
6279 nid_vol = nid - 0x7;
6280 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6281 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6282 } else if (nid == 0x11) {
6283 nid_vol = nid - 0x7;
6284 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6285 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6286 } else if (nid >= 0x12 && nid <= 0x15) {
6288 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6289 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6293 if (!(*vol_bits & (1 << nid_vol))) {
6294 /* first control for the volume widget */
6295 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6298 *vol_bits |= (1 << nid_vol);
6300 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6306 /* add playback controls from the parsed DAC table */
6307 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6308 const struct auto_pin_cfg *cfg)
6314 spec->multiout.num_dacs = 1;
6315 spec->multiout.dac_nids = spec->private_dac_nids;
6316 spec->multiout.dac_nids[0] = 0x02;
6318 nid = cfg->line_out_pins[0];
6321 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6323 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6327 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6332 nid = cfg->speaker_pins[0];
6334 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6339 nid = cfg->hp_pins[0];
6341 err = alc260_add_playback_controls(spec, nid, "Headphone",
6349 /* create playback/capture controls for input pins */
6350 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6351 const struct auto_pin_cfg *cfg)
6353 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6356 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6357 hda_nid_t nid, int pin_type,
6360 alc_set_pin_output(codec, nid, pin_type);
6361 /* need the manual connection? */
6363 int idx = nid - 0x12;
6364 snd_hda_codec_write(codec, idx + 0x0b, 0,
6365 AC_VERB_SET_CONNECT_SEL, sel_idx);
6369 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6371 struct alc_spec *spec = codec->spec;
6374 nid = spec->autocfg.line_out_pins[0];
6376 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6377 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6380 nid = spec->autocfg.speaker_pins[0];
6382 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6384 nid = spec->autocfg.hp_pins[0];
6386 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6389 #define ALC260_PIN_CD_NID 0x16
6390 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6392 struct alc_spec *spec = codec->spec;
6395 for (i = 0; i < AUTO_PIN_LAST; i++) {
6396 hda_nid_t nid = spec->autocfg.input_pins[i];
6398 alc_set_input_pin(codec, nid, i);
6399 if (nid != ALC260_PIN_CD_NID &&
6400 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6401 snd_hda_codec_write(codec, nid, 0,
6402 AC_VERB_SET_AMP_GAIN_MUTE,
6409 * generic initialization of ADC, input mixers and output mixers
6411 static struct hda_verb alc260_volume_init_verbs[] = {
6413 * Unmute ADC0-1 and set the default input to mic-in
6415 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6416 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6417 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6418 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6420 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6422 * Note: PASD motherboards uses the Line In 2 as the input for
6423 * front panel mic (mic 2)
6425 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6426 /* mute analog inputs */
6427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6428 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6430 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6431 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6434 * Set up output mixers (0x08 - 0x0a)
6436 /* set vol=0 to output mixers */
6437 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6438 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6439 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6440 /* set up input amps for analog loopback */
6441 /* Amp Indices: DAC = 0, mixer = 1 */
6442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6444 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6445 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6446 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6447 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6452 static int alc260_parse_auto_config(struct hda_codec *codec)
6454 struct alc_spec *spec = codec->spec;
6456 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6458 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6462 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6465 if (!spec->kctls.list)
6466 return 0; /* can't find valid BIOS pin config */
6467 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6471 spec->multiout.max_channels = 2;
6473 if (spec->autocfg.dig_outs)
6474 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6475 if (spec->kctls.list)
6476 add_mixer(spec, spec->kctls.list);
6478 add_verb(spec, alc260_volume_init_verbs);
6480 spec->num_mux_defs = 1;
6481 spec->input_mux = &spec->private_imux[0];
6483 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6488 /* additional initialization for auto-configuration model */
6489 static void alc260_auto_init(struct hda_codec *codec)
6491 struct alc_spec *spec = codec->spec;
6492 alc260_auto_init_multi_out(codec);
6493 alc260_auto_init_analog_input(codec);
6494 if (spec->unsol_event)
6495 alc_inithook(codec);
6498 #ifdef CONFIG_SND_HDA_POWER_SAVE
6499 static struct hda_amp_list alc260_loopbacks[] = {
6500 { 0x07, HDA_INPUT, 0 },
6501 { 0x07, HDA_INPUT, 1 },
6502 { 0x07, HDA_INPUT, 2 },
6503 { 0x07, HDA_INPUT, 3 },
6504 { 0x07, HDA_INPUT, 4 },
6510 * ALC260 configurations
6512 static const char *alc260_models[ALC260_MODEL_LAST] = {
6513 [ALC260_BASIC] = "basic",
6515 [ALC260_HP_3013] = "hp-3013",
6516 [ALC260_HP_DC7600] = "hp-dc7600",
6517 [ALC260_FUJITSU_S702X] = "fujitsu",
6518 [ALC260_ACER] = "acer",
6519 [ALC260_WILL] = "will",
6520 [ALC260_REPLACER_672V] = "replacer",
6521 [ALC260_FAVORIT100] = "favorit100",
6522 #ifdef CONFIG_SND_DEBUG
6523 [ALC260_TEST] = "test",
6525 [ALC260_AUTO] = "auto",
6528 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6529 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6530 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6531 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6532 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6533 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6534 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6535 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6536 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6537 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6538 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6539 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6540 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6541 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6542 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6543 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6544 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6545 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6546 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6547 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6548 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6552 static struct alc_config_preset alc260_presets[] = {
6554 .mixers = { alc260_base_output_mixer,
6555 alc260_input_mixer },
6556 .init_verbs = { alc260_init_verbs },
6557 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6558 .dac_nids = alc260_dac_nids,
6559 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6560 .adc_nids = alc260_dual_adc_nids,
6561 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6562 .channel_mode = alc260_modes,
6563 .input_mux = &alc260_capture_source,
6566 .mixers = { alc260_hp_output_mixer,
6567 alc260_input_mixer },
6568 .init_verbs = { alc260_init_verbs,
6569 alc260_hp_unsol_verbs },
6570 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6571 .dac_nids = alc260_dac_nids,
6572 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6573 .adc_nids = alc260_adc_nids_alt,
6574 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6575 .channel_mode = alc260_modes,
6576 .input_mux = &alc260_capture_source,
6577 .unsol_event = alc260_hp_unsol_event,
6578 .init_hook = alc260_hp_automute,
6580 [ALC260_HP_DC7600] = {
6581 .mixers = { alc260_hp_dc7600_mixer,
6582 alc260_input_mixer },
6583 .init_verbs = { alc260_init_verbs,
6584 alc260_hp_dc7600_verbs },
6585 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6586 .dac_nids = alc260_dac_nids,
6587 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6588 .adc_nids = alc260_adc_nids_alt,
6589 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6590 .channel_mode = alc260_modes,
6591 .input_mux = &alc260_capture_source,
6592 .unsol_event = alc260_hp_3012_unsol_event,
6593 .init_hook = alc260_hp_3012_automute,
6595 [ALC260_HP_3013] = {
6596 .mixers = { alc260_hp_3013_mixer,
6597 alc260_input_mixer },
6598 .init_verbs = { alc260_hp_3013_init_verbs,
6599 alc260_hp_3013_unsol_verbs },
6600 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6601 .dac_nids = alc260_dac_nids,
6602 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6603 .adc_nids = alc260_adc_nids_alt,
6604 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6605 .channel_mode = alc260_modes,
6606 .input_mux = &alc260_capture_source,
6607 .unsol_event = alc260_hp_3013_unsol_event,
6608 .init_hook = alc260_hp_3013_automute,
6610 [ALC260_FUJITSU_S702X] = {
6611 .mixers = { alc260_fujitsu_mixer },
6612 .init_verbs = { alc260_fujitsu_init_verbs },
6613 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6614 .dac_nids = alc260_dac_nids,
6615 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6616 .adc_nids = alc260_dual_adc_nids,
6617 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6618 .channel_mode = alc260_modes,
6619 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6620 .input_mux = alc260_fujitsu_capture_sources,
6623 .mixers = { alc260_acer_mixer },
6624 .init_verbs = { alc260_acer_init_verbs },
6625 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6626 .dac_nids = alc260_dac_nids,
6627 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6628 .adc_nids = alc260_dual_adc_nids,
6629 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6630 .channel_mode = alc260_modes,
6631 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6632 .input_mux = alc260_acer_capture_sources,
6634 [ALC260_FAVORIT100] = {
6635 .mixers = { alc260_favorit100_mixer },
6636 .init_verbs = { alc260_favorit100_init_verbs },
6637 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6638 .dac_nids = alc260_dac_nids,
6639 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6640 .adc_nids = alc260_dual_adc_nids,
6641 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6642 .channel_mode = alc260_modes,
6643 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6644 .input_mux = alc260_favorit100_capture_sources,
6647 .mixers = { alc260_will_mixer },
6648 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6649 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6650 .dac_nids = alc260_dac_nids,
6651 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6652 .adc_nids = alc260_adc_nids,
6653 .dig_out_nid = ALC260_DIGOUT_NID,
6654 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6655 .channel_mode = alc260_modes,
6656 .input_mux = &alc260_capture_source,
6658 [ALC260_REPLACER_672V] = {
6659 .mixers = { alc260_replacer_672v_mixer },
6660 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6661 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6662 .dac_nids = alc260_dac_nids,
6663 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6664 .adc_nids = alc260_adc_nids,
6665 .dig_out_nid = ALC260_DIGOUT_NID,
6666 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6667 .channel_mode = alc260_modes,
6668 .input_mux = &alc260_capture_source,
6669 .unsol_event = alc260_replacer_672v_unsol_event,
6670 .init_hook = alc260_replacer_672v_automute,
6672 #ifdef CONFIG_SND_DEBUG
6674 .mixers = { alc260_test_mixer },
6675 .init_verbs = { alc260_test_init_verbs },
6676 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6677 .dac_nids = alc260_test_dac_nids,
6678 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6679 .adc_nids = alc260_test_adc_nids,
6680 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6681 .channel_mode = alc260_modes,
6682 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6683 .input_mux = alc260_test_capture_sources,
6688 static int patch_alc260(struct hda_codec *codec)
6690 struct alc_spec *spec;
6691 int err, board_config;
6693 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6699 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6702 if (board_config < 0) {
6703 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6705 board_config = ALC260_AUTO;
6708 if (board_config == ALC260_AUTO) {
6709 /* automatic parse from the BIOS config */
6710 err = alc260_parse_auto_config(codec);
6716 "hda_codec: Cannot set up configuration "
6717 "from BIOS. Using base mode...\n");
6718 board_config = ALC260_BASIC;
6722 err = snd_hda_attach_beep_device(codec, 0x1);
6728 if (board_config != ALC260_AUTO)
6729 setup_preset(codec, &alc260_presets[board_config]);
6731 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6732 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6734 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6735 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6737 if (!spec->adc_nids && spec->input_mux) {
6738 /* check whether NID 0x04 is valid */
6739 unsigned int wcap = get_wcaps(codec, 0x04);
6740 wcap = get_wcaps_type(wcap);
6742 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6743 spec->adc_nids = alc260_adc_nids_alt;
6744 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6746 spec->adc_nids = alc260_adc_nids;
6747 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6750 set_capture_mixer(codec);
6751 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6753 spec->vmaster_nid = 0x08;
6755 codec->patch_ops = alc_patch_ops;
6756 if (board_config == ALC260_AUTO)
6757 spec->init_hook = alc260_auto_init;
6758 #ifdef CONFIG_SND_HDA_POWER_SAVE
6759 if (!spec->loopback.amplist)
6760 spec->loopback.amplist = alc260_loopbacks;
6768 * ALC882/883/885/888/889 support
6770 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6771 * configuration. Each pin widget can choose any input DACs and a mixer.
6772 * Each ADC is connected from a mixer of all inputs. This makes possible
6773 * 6-channel independent captures.
6775 * In addition, an independent DAC for the multi-playback (not used in this
6778 #define ALC882_DIGOUT_NID 0x06
6779 #define ALC882_DIGIN_NID 0x0a
6780 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6781 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6782 #define ALC1200_DIGOUT_NID 0x10
6785 static struct hda_channel_mode alc882_ch_modes[1] = {
6790 static hda_nid_t alc882_dac_nids[4] = {
6791 /* front, rear, clfe, rear_surr */
6792 0x02, 0x03, 0x04, 0x05
6794 #define alc883_dac_nids alc882_dac_nids
6797 #define alc882_adc_nids alc880_adc_nids
6798 #define alc882_adc_nids_alt alc880_adc_nids_alt
6799 #define alc883_adc_nids alc882_adc_nids_alt
6800 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6801 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6802 #define alc889_adc_nids alc880_adc_nids
6804 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6805 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6806 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6807 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6808 #define alc889_capsrc_nids alc882_capsrc_nids
6811 /* FIXME: should be a matrix-type input source selection */
6813 static struct hda_input_mux alc882_capture_source = {
6817 { "Front Mic", 0x1 },
6823 #define alc883_capture_source alc882_capture_source
6825 static struct hda_input_mux alc889_capture_source = {
6828 { "Front Mic", 0x0 },
6834 static struct hda_input_mux mb5_capture_source = {
6843 static struct hda_input_mux macmini3_capture_source = {
6851 static struct hda_input_mux alc883_3stack_6ch_intel = {
6855 { "Front Mic", 0x0 },
6861 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6869 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6879 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6887 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6891 { "Front Mic", 0x1 },
6896 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6904 static struct hda_input_mux alc889A_mb31_capture_source = {
6908 /* Front Mic (0x01) unused */
6910 /* Line 2 (0x03) unused */
6911 /* CD (0x04) unused? */
6918 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6925 static struct hda_verb alc882_3ST_ch2_init[] = {
6926 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6927 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6928 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6929 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6936 static struct hda_verb alc882_3ST_ch4_init[] = {
6937 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6938 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6939 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6940 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6941 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6948 static struct hda_verb alc882_3ST_ch6_init[] = {
6949 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6950 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6951 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6952 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6953 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6954 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6958 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6959 { 2, alc882_3ST_ch2_init },
6960 { 4, alc882_3ST_ch4_init },
6961 { 6, alc882_3ST_ch6_init },
6964 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6969 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6970 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6971 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6972 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6973 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6974 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6981 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6982 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6983 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6984 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6985 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6986 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6987 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6994 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6995 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6996 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6997 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6998 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6999 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7000 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7001 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7005 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7006 { 2, alc883_3ST_ch2_clevo_init },
7007 { 4, alc883_3ST_ch4_clevo_init },
7008 { 6, alc883_3ST_ch6_clevo_init },
7015 static struct hda_verb alc882_sixstack_ch6_init[] = {
7016 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7017 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7018 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7019 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7026 static struct hda_verb alc882_sixstack_ch8_init[] = {
7027 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7028 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7029 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7030 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7034 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7035 { 6, alc882_sixstack_ch6_init },
7036 { 8, alc882_sixstack_ch8_init },
7040 /* Macbook Air 2,1 */
7042 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7047 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7053 static struct hda_verb alc885_mbp_ch2_init[] = {
7054 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7055 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7056 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7063 static struct hda_verb alc885_mbp_ch4_init[] = {
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 },
7067 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7068 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7072 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7073 { 2, alc885_mbp_ch2_init },
7074 { 4, alc885_mbp_ch4_init },
7079 * Speakers/Woofer/HP = Front
7082 static struct hda_verb alc885_mb5_ch2_init[] = {
7083 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7084 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7090 * Speakers/HP = Front
7094 static struct hda_verb alc885_mb5_ch6_init[] = {
7095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7096 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7097 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7101 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7102 { 2, alc885_mb5_ch2_init },
7103 { 6, alc885_mb5_ch6_init },
7106 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7111 static struct hda_verb alc883_4ST_ch2_init[] = {
7112 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7113 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7114 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7115 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7116 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7117 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7124 static struct hda_verb alc883_4ST_ch4_init[] = {
7125 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7126 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7127 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7128 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
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 },
7138 static struct hda_verb alc883_4ST_ch6_init[] = {
7139 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7140 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7141 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7142 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7143 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7144 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7145 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7146 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7153 static struct hda_verb alc883_4ST_ch8_init[] = {
7154 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7155 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7156 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7157 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7158 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7159 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7160 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7161 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7162 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7166 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7167 { 2, alc883_4ST_ch2_init },
7168 { 4, alc883_4ST_ch4_init },
7169 { 6, alc883_4ST_ch6_init },
7170 { 8, alc883_4ST_ch8_init },
7177 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7178 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7179 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7180 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7181 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7188 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7189 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7190 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7191 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7192 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7193 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7200 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7201 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7202 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7203 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7204 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7205 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7206 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7210 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7211 { 2, alc883_3ST_ch2_intel_init },
7212 { 4, alc883_3ST_ch4_intel_init },
7213 { 6, alc883_3ST_ch6_intel_init },
7219 static struct hda_verb alc889_ch2_intel_init[] = {
7220 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7221 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7222 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7223 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7224 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7225 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7232 static struct hda_verb alc889_ch6_intel_init[] = {
7233 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7234 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7235 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7236 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7237 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7238 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7245 static struct hda_verb alc889_ch8_intel_init[] = {
7246 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7247 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7248 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7249 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7250 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7251 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7252 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7256 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7257 { 2, alc889_ch2_intel_init },
7258 { 6, alc889_ch6_intel_init },
7259 { 8, alc889_ch8_intel_init },
7265 static struct hda_verb alc883_sixstack_ch6_init[] = {
7266 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7267 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7268 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7269 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7276 static struct hda_verb alc883_sixstack_ch8_init[] = {
7277 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7278 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7279 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7280 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7284 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7285 { 6, alc883_sixstack_ch6_init },
7286 { 8, alc883_sixstack_ch8_init },
7290 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7291 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7293 static struct snd_kcontrol_new alc882_base_mixer[] = {
7294 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7295 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7296 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7297 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7298 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7299 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7300 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7301 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7302 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7303 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7304 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7305 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7306 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7307 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7308 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7309 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7310 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7311 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7312 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7313 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7314 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7318 /* Macbook Air 2,1 same control for HP and internal Speaker */
7320 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7321 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7322 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7327 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7328 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7329 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7330 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7331 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7332 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7333 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7334 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7336 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7337 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7338 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7342 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7343 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7344 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7345 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7346 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7347 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7348 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7349 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7350 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7351 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7352 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7354 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7355 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7356 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7360 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7361 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7362 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7363 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7364 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7365 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7366 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7367 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7368 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7369 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7370 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7371 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7375 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7376 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7377 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7378 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7379 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7380 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7381 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7382 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7383 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7384 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7389 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7390 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7391 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7392 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7393 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7394 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7395 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7397 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7402 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7403 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7404 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7405 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7406 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7407 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7408 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7409 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7410 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7411 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7412 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7413 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7414 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7415 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7419 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7420 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7422 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7424 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7426 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7427 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7428 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7429 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7430 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7431 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7432 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7435 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7439 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7440 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7441 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7442 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7443 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7444 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
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, 0x0, HDA_INPUT),
7448 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7449 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7453 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7455 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7456 .name = "Channel Mode",
7457 .info = alc_ch_mode_info,
7458 .get = alc_ch_mode_get,
7459 .put = alc_ch_mode_put,
7464 static struct hda_verb alc882_base_init_verbs[] = {
7465 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7469 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7472 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7473 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7476 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7478 /* Front Pin: output 0 (0x0c) */
7479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7481 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7482 /* Rear Pin: output 1 (0x0d) */
7483 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7485 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7486 /* CLFE Pin: output 2 (0x0e) */
7487 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7488 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7489 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7490 /* Side Pin: output 3 (0x0f) */
7491 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7492 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7493 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7494 /* Mic (rear) pin: input vref at 80% */
7495 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7496 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7497 /* Front Mic pin: input vref at 80% */
7498 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7499 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7500 /* Line In pin: input */
7501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7502 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7503 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7504 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7505 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7506 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7507 /* CD pin widget for input */
7508 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7510 /* FIXME: use matrix-type input source selection */
7511 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7513 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7516 /* ADC2: mute amp left and right */
7517 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7518 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7519 /* ADC3: mute amp left and right */
7520 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7521 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7526 static struct hda_verb alc882_adc1_init_verbs[] = {
7527 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7529 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7532 /* ADC1: mute amp left and right */
7533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7534 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7538 static struct hda_verb alc882_eapd_verbs[] = {
7539 /* change to EAPD mode */
7540 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7541 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7545 static struct hda_verb alc889_eapd_verbs[] = {
7546 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7547 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7551 static struct hda_verb alc_hp15_unsol_verbs[] = {
7552 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7553 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7557 static struct hda_verb alc885_init_verbs[] = {
7558 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7562 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7568 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7569 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7571 /* Front HP Pin: output 0 (0x0c) */
7572 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7573 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7574 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7575 /* Front Pin: output 0 (0x0c) */
7576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7577 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7578 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7579 /* Rear Pin: output 1 (0x0d) */
7580 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7581 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7582 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7583 /* CLFE Pin: output 2 (0x0e) */
7584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7585 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7586 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7587 /* Side Pin: output 3 (0x0f) */
7588 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7589 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7590 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7591 /* Mic (rear) pin: input vref at 80% */
7592 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7593 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7594 /* Front Mic pin: input vref at 80% */
7595 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7596 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7597 /* Line In pin: input */
7598 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7599 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7601 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7603 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7605 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7608 /* ADC2: mute amp left and right */
7609 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7610 /* ADC3: mute amp left and right */
7611 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7616 static struct hda_verb alc885_init_input_verbs[] = {
7617 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7618 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7619 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7624 /* Unmute Selector 24h and set the default input to front mic */
7625 static struct hda_verb alc889_init_input_verbs[] = {
7626 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7627 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7632 #define alc883_init_verbs alc882_base_init_verbs
7635 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7636 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7637 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7639 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7640 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7641 /* FIXME: this looks suspicious...
7642 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7643 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7648 static struct hda_verb alc882_macpro_init_verbs[] = {
7649 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7651 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7652 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7653 /* Front Pin: output 0 (0x0c) */
7654 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7656 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7657 /* Front Mic pin: input vref at 80% */
7658 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7659 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7660 /* Speaker: output */
7661 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7662 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7663 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7664 /* Headphone output (output 0 - 0x0c) */
7665 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7666 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7667 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7669 /* FIXME: use matrix-type input source selection */
7670 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7671 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7672 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7674 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7678 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7679 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7680 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7685 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7686 /* ADC1: mute amp left and right */
7687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7688 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7689 /* ADC2: mute amp left and right */
7690 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7691 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7692 /* ADC3: mute amp left and right */
7693 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7694 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7700 static struct hda_verb alc885_mb5_init_verbs[] = {
7702 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7703 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7704 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7705 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7708 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7709 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7710 /* Surround mixer */
7711 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7713 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7717 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7719 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7720 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7721 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7722 /* Front Pin (0x0c) */
7723 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7724 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7725 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7726 /* LFE Pin (0x0e) */
7727 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7728 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7729 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7731 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7732 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7733 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7734 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7735 /* Front Mic pin: input vref at 80% */
7736 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7737 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7739 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7740 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7742 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7743 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7744 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7745 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7750 static struct hda_verb alc885_macmini3_init_verbs[] = {
7752 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7753 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7754 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7755 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7759 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7760 /* Surround mixer */
7761 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7762 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7763 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7765 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7766 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7767 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7769 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7770 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7771 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7772 /* Front Pin (0x0c) */
7773 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7774 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7775 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7776 /* LFE Pin (0x0e) */
7777 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7778 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7779 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7783 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7784 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7787 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7789 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7791 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7792 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7797 static struct hda_verb alc885_mba21_init_verbs[] = {
7798 /*Internal and HP Speaker Mixer*/
7799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7801 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7802 /*Internal Speaker Pin (0x0c)*/
7803 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7804 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7805 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7806 /* HP Pin: output 0 (0x0e) */
7807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7809 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7810 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7811 /* Line in (is hp when jack connected)*/
7812 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7819 /* Macbook Pro rev3 */
7820 static struct hda_verb alc885_mbp3_init_verbs[] = {
7821 /* Front mixer: unmute input/output amp left and right (volume = 0) */
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)},
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)},
7833 /* Front Pin: output 0 (0x0c) */
7834 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7835 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7836 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7837 /* HP Pin: output 0 (0x0e) */
7838 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7840 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7841 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7842 /* Mic (rear) pin: input vref at 80% */
7843 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7844 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7845 /* Front Mic pin: input vref at 80% */
7846 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7847 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7848 /* Line In pin: use output 1 when in LineOut mode */
7849 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7850 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7851 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7853 /* FIXME: use matrix-type input source selection */
7854 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7855 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7861 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7866 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7867 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7869 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7870 /* ADC1: mute amp left and right */
7871 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7872 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7873 /* ADC2: mute amp left and right */
7874 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7875 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7876 /* ADC3: mute amp left and right */
7877 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7878 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7884 static struct hda_verb alc885_imac91_init_verbs[] = {
7885 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7891 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7892 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7893 /* HP Pin: output 0 (0x0c) */
7894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7895 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7896 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7897 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7898 /* Internal Speakers: output 0 (0x0d) */
7899 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7901 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7902 /* Mic (rear) pin: input vref at 80% */
7903 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7904 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7905 /* Front Mic pin: input vref at 80% */
7906 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7907 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7908 /* Line In pin: use output 1 when in LineOut mode */
7909 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7910 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7911 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7913 /* FIXME: use matrix-type input source selection */
7914 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7915 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7916 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7917 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7918 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7919 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7921 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7922 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7923 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7924 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7927 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7928 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7929 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7930 /* ADC1: mute amp left and right */
7931 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7932 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7933 /* ADC2: mute amp left and right */
7934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7935 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7936 /* ADC3: mute amp left and right */
7937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7938 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7943 /* iMac 24 mixer. */
7944 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7945 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7946 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7950 /* iMac 24 init verbs. */
7951 static struct hda_verb alc885_imac24_init_verbs[] = {
7952 /* Internal speakers: output 0 (0x0c) */
7953 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7954 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7955 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7956 /* Internal speakers: output 0 (0x0c) */
7957 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7958 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7959 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7960 /* Headphone: output 0 (0x0c) */
7961 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7962 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7963 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7964 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7965 /* Front Mic: input vref at 80% */
7966 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7967 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7971 /* Toggle speaker-output according to the hp-jack state */
7972 static void alc885_imac24_setup(struct hda_codec *codec)
7974 struct alc_spec *spec = codec->spec;
7976 spec->autocfg.hp_pins[0] = 0x14;
7977 spec->autocfg.speaker_pins[0] = 0x18;
7978 spec->autocfg.speaker_pins[1] = 0x1a;
7981 #define alc885_mb5_setup alc885_imac24_setup
7982 #define alc885_macmini3_setup alc885_imac24_setup
7984 /* Macbook Air 2,1 */
7985 static void alc885_mba21_setup(struct hda_codec *codec)
7987 struct alc_spec *spec = codec->spec;
7989 spec->autocfg.hp_pins[0] = 0x14;
7990 spec->autocfg.speaker_pins[0] = 0x18;
7995 static void alc885_mbp3_setup(struct hda_codec *codec)
7997 struct alc_spec *spec = codec->spec;
7999 spec->autocfg.hp_pins[0] = 0x15;
8000 spec->autocfg.speaker_pins[0] = 0x14;
8003 static void alc885_imac91_setup(struct hda_codec *codec)
8005 struct alc_spec *spec = codec->spec;
8007 spec->autocfg.hp_pins[0] = 0x14;
8008 spec->autocfg.speaker_pins[0] = 0x15;
8009 spec->autocfg.speaker_pins[1] = 0x1a;
8012 static struct hda_verb alc882_targa_verbs[] = {
8013 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8016 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8017 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8019 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8020 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8021 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8023 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8027 /* toggle speaker-output according to the hp-jack state */
8028 static void alc882_targa_automute(struct hda_codec *codec)
8030 struct alc_spec *spec = codec->spec;
8031 alc_automute_amp(codec);
8032 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8033 spec->jack_present ? 1 : 3);
8036 static void alc882_targa_setup(struct hda_codec *codec)
8038 struct alc_spec *spec = codec->spec;
8040 spec->autocfg.hp_pins[0] = 0x14;
8041 spec->autocfg.speaker_pins[0] = 0x1b;
8044 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8046 if ((res >> 26) == ALC880_HP_EVENT)
8047 alc882_targa_automute(codec);
8050 static struct hda_verb alc882_asus_a7j_verbs[] = {
8051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8055 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8056 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8058 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8059 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8060 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8062 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8063 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8064 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8068 static struct hda_verb alc882_asus_a7m_verbs[] = {
8069 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8072 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8073 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8074 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8076 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8077 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8078 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8080 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8081 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8082 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8086 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8088 unsigned int gpiostate, gpiomask, gpiodir;
8090 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8091 AC_VERB_GET_GPIO_DATA, 0);
8094 gpiostate |= (1 << pin);
8096 gpiostate &= ~(1 << pin);
8098 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8099 AC_VERB_GET_GPIO_MASK, 0);
8100 gpiomask |= (1 << pin);
8102 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8103 AC_VERB_GET_GPIO_DIRECTION, 0);
8104 gpiodir |= (1 << pin);
8107 snd_hda_codec_write(codec, codec->afg, 0,
8108 AC_VERB_SET_GPIO_MASK, gpiomask);
8109 snd_hda_codec_write(codec, codec->afg, 0,
8110 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8114 snd_hda_codec_write(codec, codec->afg, 0,
8115 AC_VERB_SET_GPIO_DATA, gpiostate);
8118 /* set up GPIO at initialization */
8119 static void alc885_macpro_init_hook(struct hda_codec *codec)
8121 alc882_gpio_mute(codec, 0, 0);
8122 alc882_gpio_mute(codec, 1, 0);
8125 /* set up GPIO and update auto-muting at initialization */
8126 static void alc885_imac24_init_hook(struct hda_codec *codec)
8128 alc885_macpro_init_hook(codec);
8129 alc_automute_amp(codec);
8133 * generic initialization of ADC, input mixers and output mixers
8135 static struct hda_verb alc883_auto_init_verbs[] = {
8137 * Unmute ADC0-2 and set the default input to mic-in
8139 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8140 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8141 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8142 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8145 * Set up output mixers (0x0c - 0x0f)
8147 /* set vol=0 to output mixers */
8148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8149 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8150 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8151 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8152 /* set up input amps for analog loopback */
8153 /* Amp Indices: DAC = 0, mixer = 1 */
8154 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8156 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8157 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8158 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8159 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8160 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8161 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8162 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8163 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8165 /* FIXME: use matrix-type input source selection */
8166 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8168 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8174 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8175 static struct hda_verb alc889A_mb31_ch2_init[] = {
8176 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8177 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8178 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8179 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8183 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8184 static struct hda_verb alc889A_mb31_ch4_init[] = {
8185 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8186 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8187 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8188 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8192 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8193 static struct hda_verb alc889A_mb31_ch5_init[] = {
8194 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8195 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8196 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8197 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8201 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8202 static struct hda_verb alc889A_mb31_ch6_init[] = {
8203 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8204 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8205 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8206 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8210 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8211 { 2, alc889A_mb31_ch2_init },
8212 { 4, alc889A_mb31_ch4_init },
8213 { 5, alc889A_mb31_ch5_init },
8214 { 6, alc889A_mb31_ch6_init },
8217 static struct hda_verb alc883_medion_eapd_verbs[] = {
8218 /* eanable EAPD on medion laptop */
8219 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8220 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8224 #define alc883_base_mixer alc882_base_mixer
8226 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8229 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8230 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8231 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8232 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8233 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8235 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8237 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8238 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8239 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8243 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8244 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8245 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8247 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8249 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8252 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8253 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8257 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8259 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8260 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8261 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8263 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8264 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8265 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8266 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8267 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8271 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8273 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8274 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8275 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8276 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8277 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8278 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8280 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8282 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8283 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8284 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8288 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8289 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8290 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8291 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8292 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8293 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8294 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8295 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8296 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8297 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8298 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8299 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8300 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8301 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8302 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8303 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8304 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8305 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8306 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8307 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8311 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8312 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8313 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8314 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8315 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8316 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8318 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8319 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8320 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8321 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8322 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8323 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8324 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8325 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8327 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8329 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8330 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8331 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8335 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8336 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8337 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8338 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8339 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8340 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8342 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8343 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8344 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8345 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8346 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8348 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8349 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8351 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8353 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8354 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8355 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8359 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8360 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8361 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8362 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8363 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8364 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8365 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8366 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8367 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8368 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8369 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8370 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8371 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8372 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8374 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8376 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8377 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8378 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8382 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8383 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8384 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8386 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8387 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8388 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8389 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8390 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8391 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8392 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8393 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8394 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8395 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8396 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8397 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8398 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8399 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8403 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8404 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8405 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8406 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8407 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8408 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8409 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8410 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8411 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8412 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8413 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8414 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8415 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8419 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8420 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8421 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8422 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8423 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8424 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8428 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8429 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8430 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8431 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8432 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8433 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8435 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8436 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8440 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8441 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8442 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8443 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8444 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8445 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8446 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8447 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8448 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8449 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8453 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8454 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8455 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8456 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8457 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8458 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8460 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8461 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8462 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8466 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8467 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8468 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8469 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8470 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8471 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8473 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8478 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8479 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8480 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8481 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8482 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8483 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8484 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8485 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8486 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8487 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8488 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8489 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8493 static struct snd_kcontrol_new alc888_lenovo_sky_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("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8497 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8498 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8499 0x0d, 1, 0x0, HDA_OUTPUT),
8500 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8501 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8502 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8503 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8504 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8505 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8506 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8507 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8508 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8510 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8511 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8512 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8513 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8514 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8518 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8520 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8521 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8522 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8523 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8524 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8526 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8527 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8528 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8529 /* Output switches */
8530 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8531 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8532 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8534 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8535 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8539 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8540 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8544 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8545 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8546 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8547 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8548 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8549 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8550 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8554 static struct hda_bind_ctls alc883_bind_cap_vol = {
8555 .ops = &snd_hda_bind_vol,
8557 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8558 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8563 static struct hda_bind_ctls alc883_bind_cap_switch = {
8564 .ops = &snd_hda_bind_sw,
8566 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8567 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8572 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8573 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8574 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8575 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8576 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8577 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8578 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8579 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8584 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8585 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8586 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8588 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8589 /* .name = "Capture Source", */
8590 .name = "Input Source",
8592 .info = alc_mux_enum_info,
8593 .get = alc_mux_enum_get,
8594 .put = alc_mux_enum_put,
8599 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8601 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8602 .name = "Channel Mode",
8603 .info = alc_ch_mode_info,
8604 .get = alc_ch_mode_get,
8605 .put = alc_ch_mode_put,
8610 /* toggle speaker-output according to the hp-jack state */
8611 static void alc883_mitac_setup(struct hda_codec *codec)
8613 struct alc_spec *spec = codec->spec;
8615 spec->autocfg.hp_pins[0] = 0x15;
8616 spec->autocfg.speaker_pins[0] = 0x14;
8617 spec->autocfg.speaker_pins[1] = 0x17;
8620 /* auto-toggle front mic */
8622 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8624 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8626 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8630 static struct hda_verb alc883_mitac_verbs[] = {
8632 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8633 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8635 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8636 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8638 /* enable unsolicited event */
8639 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8640 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8645 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8647 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8648 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8650 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8652 /* enable unsolicited event */
8654 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8655 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8661 static struct hda_verb alc883_clevo_m720_verbs[] = {
8663 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8666 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8667 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8669 /* enable unsolicited event */
8670 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8671 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8676 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8678 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8681 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8682 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8684 /* enable unsolicited event */
8685 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8690 static struct hda_verb alc883_targa_verbs[] = {
8691 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8694 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8695 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8697 /* Connect Line-Out side jack (SPDIF) to Side */
8698 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8699 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8700 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8701 /* Connect Mic jack to CLFE */
8702 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8703 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8704 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8705 /* Connect Line-in jack to Surround */
8706 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8707 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8708 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8709 /* Connect HP out jack to Front */
8710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8711 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8712 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8714 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8719 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8720 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8721 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8722 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8726 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8727 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8729 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8734 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8735 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8737 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8738 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8739 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8743 static struct hda_verb alc883_haier_w66_verbs[] = {
8744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8749 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8750 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8751 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8752 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8756 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8760 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8761 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8762 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8763 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8764 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8768 static struct hda_verb alc888_6st_dell_verbs[] = {
8769 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8773 static struct hda_verb alc883_vaiott_verbs[] = {
8775 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8776 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8778 /* enable unsolicited event */
8779 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8784 static void alc888_3st_hp_setup(struct hda_codec *codec)
8786 struct alc_spec *spec = codec->spec;
8788 spec->autocfg.hp_pins[0] = 0x1b;
8789 spec->autocfg.speaker_pins[0] = 0x14;
8790 spec->autocfg.speaker_pins[1] = 0x16;
8791 spec->autocfg.speaker_pins[2] = 0x18;
8794 static struct hda_verb alc888_3st_hp_verbs[] = {
8795 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8796 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8797 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8798 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8805 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8806 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8807 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8808 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8809 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8816 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8817 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8818 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8819 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8820 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8821 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8828 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8829 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8830 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8831 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8832 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8833 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8834 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8838 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8839 { 2, alc888_3st_hp_2ch_init },
8840 { 4, alc888_3st_hp_4ch_init },
8841 { 6, alc888_3st_hp_6ch_init },
8844 /* toggle front-jack and RCA according to the hp-jack state */
8845 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8847 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8849 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8850 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8851 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8852 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8855 /* toggle RCA according to the front-jack state */
8856 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8858 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8860 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8861 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8864 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8867 if ((res >> 26) == ALC880_HP_EVENT)
8868 alc888_lenovo_ms7195_front_automute(codec);
8869 if ((res >> 26) == ALC880_FRONT_EVENT)
8870 alc888_lenovo_ms7195_rca_automute(codec);
8873 static struct hda_verb alc883_medion_md2_verbs[] = {
8874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8877 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8879 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8883 /* toggle speaker-output according to the hp-jack state */
8884 static void alc883_medion_md2_setup(struct hda_codec *codec)
8886 struct alc_spec *spec = codec->spec;
8888 spec->autocfg.hp_pins[0] = 0x14;
8889 spec->autocfg.speaker_pins[0] = 0x15;
8892 /* toggle speaker-output according to the hp-jack state */
8893 #define alc883_targa_init_hook alc882_targa_init_hook
8894 #define alc883_targa_unsol_event alc882_targa_unsol_event
8896 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8898 unsigned int present;
8900 present = snd_hda_jack_detect(codec, 0x18);
8901 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8902 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8905 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8907 struct alc_spec *spec = codec->spec;
8909 spec->autocfg.hp_pins[0] = 0x15;
8910 spec->autocfg.speaker_pins[0] = 0x14;
8913 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8915 alc_automute_amp(codec);
8916 alc883_clevo_m720_mic_automute(codec);
8919 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8922 switch (res >> 26) {
8923 case ALC880_MIC_EVENT:
8924 alc883_clevo_m720_mic_automute(codec);
8927 alc_automute_amp_unsol_event(codec, res);
8932 /* toggle speaker-output according to the hp-jack state */
8933 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8935 struct alc_spec *spec = codec->spec;
8937 spec->autocfg.hp_pins[0] = 0x14;
8938 spec->autocfg.speaker_pins[0] = 0x15;
8941 static void alc883_haier_w66_setup(struct hda_codec *codec)
8943 struct alc_spec *spec = codec->spec;
8945 spec->autocfg.hp_pins[0] = 0x1b;
8946 spec->autocfg.speaker_pins[0] = 0x14;
8949 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8951 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8953 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8954 HDA_AMP_MUTE, bits);
8957 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8959 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8961 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8962 HDA_AMP_MUTE, bits);
8963 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8964 HDA_AMP_MUTE, bits);
8967 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8970 if ((res >> 26) == ALC880_HP_EVENT)
8971 alc883_lenovo_101e_all_automute(codec);
8972 if ((res >> 26) == ALC880_FRONT_EVENT)
8973 alc883_lenovo_101e_ispeaker_automute(codec);
8976 /* toggle speaker-output according to the hp-jack state */
8977 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8979 struct alc_spec *spec = codec->spec;
8981 spec->autocfg.hp_pins[0] = 0x14;
8982 spec->autocfg.speaker_pins[0] = 0x15;
8983 spec->autocfg.speaker_pins[1] = 0x16;
8986 static struct hda_verb alc883_acer_eapd_verbs[] = {
8987 /* HP Pin: output 0 (0x0c) */
8988 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8989 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8990 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8991 /* Front Pin: output 0 (0x0c) */
8992 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8994 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8995 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8996 /* eanable EAPD on medion laptop */
8997 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8998 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8999 /* enable unsolicited event */
9000 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9004 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9006 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9007 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9011 static void alc888_6st_dell_setup(struct hda_codec *codec)
9013 struct alc_spec *spec = codec->spec;
9015 spec->autocfg.hp_pins[0] = 0x1b;
9016 spec->autocfg.speaker_pins[0] = 0x14;
9017 spec->autocfg.speaker_pins[1] = 0x15;
9018 spec->autocfg.speaker_pins[2] = 0x16;
9019 spec->autocfg.speaker_pins[3] = 0x17;
9022 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9024 struct alc_spec *spec = codec->spec;
9026 spec->autocfg.hp_pins[0] = 0x1b;
9027 spec->autocfg.speaker_pins[0] = 0x14;
9028 spec->autocfg.speaker_pins[1] = 0x15;
9029 spec->autocfg.speaker_pins[2] = 0x16;
9030 spec->autocfg.speaker_pins[3] = 0x17;
9031 spec->autocfg.speaker_pins[4] = 0x1a;
9034 static void alc883_vaiott_setup(struct hda_codec *codec)
9036 struct alc_spec *spec = codec->spec;
9038 spec->autocfg.hp_pins[0] = 0x15;
9039 spec->autocfg.speaker_pins[0] = 0x14;
9040 spec->autocfg.speaker_pins[1] = 0x17;
9043 static struct hda_verb alc888_asus_m90v_verbs[] = {
9044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9045 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9046 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9047 /* enable unsolicited event */
9048 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9049 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9053 static void alc883_mode2_setup(struct hda_codec *codec)
9055 struct alc_spec *spec = codec->spec;
9057 spec->autocfg.hp_pins[0] = 0x1b;
9058 spec->autocfg.speaker_pins[0] = 0x14;
9059 spec->autocfg.speaker_pins[1] = 0x15;
9060 spec->autocfg.speaker_pins[2] = 0x16;
9061 spec->ext_mic.pin = 0x18;
9062 spec->int_mic.pin = 0x19;
9063 spec->ext_mic.mux_idx = 0;
9064 spec->int_mic.mux_idx = 1;
9068 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9069 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9070 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9072 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9074 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9075 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9076 /* enable unsolicited event */
9077 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9081 static void alc883_eee1601_inithook(struct hda_codec *codec)
9083 struct alc_spec *spec = codec->spec;
9085 spec->autocfg.hp_pins[0] = 0x14;
9086 spec->autocfg.speaker_pins[0] = 0x1b;
9087 alc_automute_pin(codec);
9090 static struct hda_verb alc889A_mb31_verbs[] = {
9091 /* Init rear pin (used as headphone output) */
9092 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9093 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9094 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9095 /* Init line pin (used as output in 4ch and 6ch mode) */
9096 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9097 /* Init line 2 pin (used as headphone out by default) */
9098 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9099 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9103 /* Mute speakers according to the headphone jack state */
9104 static void alc889A_mb31_automute(struct hda_codec *codec)
9106 unsigned int present;
9108 /* Mute only in 2ch or 4ch mode */
9109 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9111 present = snd_hda_jack_detect(codec, 0x15);
9112 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9113 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9114 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9115 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9119 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9121 if ((res >> 26) == ALC880_HP_EVENT)
9122 alc889A_mb31_automute(codec);
9126 #ifdef CONFIG_SND_HDA_POWER_SAVE
9127 #define alc882_loopbacks alc880_loopbacks
9130 /* pcm configuration: identical with ALC880 */
9131 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9132 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9133 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9134 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9136 static hda_nid_t alc883_slave_dig_outs[] = {
9137 ALC1200_DIGOUT_NID, 0,
9140 static hda_nid_t alc1200_slave_dig_outs[] = {
9141 ALC883_DIGOUT_NID, 0,
9145 * configuration and preset
9147 static const char *alc882_models[ALC882_MODEL_LAST] = {
9148 [ALC882_3ST_DIG] = "3stack-dig",
9149 [ALC882_6ST_DIG] = "6stack-dig",
9150 [ALC882_ARIMA] = "arima",
9151 [ALC882_W2JC] = "w2jc",
9152 [ALC882_TARGA] = "targa",
9153 [ALC882_ASUS_A7J] = "asus-a7j",
9154 [ALC882_ASUS_A7M] = "asus-a7m",
9155 [ALC885_MACPRO] = "macpro",
9156 [ALC885_MB5] = "mb5",
9157 [ALC885_MACMINI3] = "macmini3",
9158 [ALC885_MBA21] = "mba21",
9159 [ALC885_MBP3] = "mbp3",
9160 [ALC885_IMAC24] = "imac24",
9161 [ALC885_IMAC91] = "imac91",
9162 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9163 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9164 [ALC883_3ST_6ch] = "3stack-6ch",
9165 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9166 [ALC883_TARGA_DIG] = "targa-dig",
9167 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9168 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9169 [ALC883_ACER] = "acer",
9170 [ALC883_ACER_ASPIRE] = "acer-aspire",
9171 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9172 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9173 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9174 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9175 [ALC883_MEDION] = "medion",
9176 [ALC883_MEDION_MD2] = "medion-md2",
9177 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9178 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9179 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9180 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9181 [ALC888_LENOVO_SKY] = "lenovo-sky",
9182 [ALC883_HAIER_W66] = "haier-w66",
9183 [ALC888_3ST_HP] = "3stack-hp",
9184 [ALC888_6ST_DELL] = "6stack-dell",
9185 [ALC883_MITAC] = "mitac",
9186 [ALC883_CLEVO_M540R] = "clevo-m540r",
9187 [ALC883_CLEVO_M720] = "clevo-m720",
9188 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9189 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9190 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9191 [ALC889A_INTEL] = "intel-alc889a",
9192 [ALC889_INTEL] = "intel-x58",
9193 [ALC1200_ASUS_P5Q] = "asus-p5q",
9194 [ALC889A_MB31] = "mb31",
9195 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9196 [ALC882_AUTO] = "auto",
9199 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9200 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9202 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9203 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9204 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9205 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9206 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9207 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9208 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9209 ALC888_ACER_ASPIRE_4930G),
9210 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9211 ALC888_ACER_ASPIRE_4930G),
9212 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9213 ALC888_ACER_ASPIRE_8930G),
9214 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9215 ALC888_ACER_ASPIRE_8930G),
9216 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9217 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9218 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9219 ALC888_ACER_ASPIRE_6530G),
9220 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9221 ALC888_ACER_ASPIRE_6530G),
9222 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9223 ALC888_ACER_ASPIRE_7730G),
9224 /* default Acer -- disabled as it causes more problems.
9225 * model=auto should work fine now
9227 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9229 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9231 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9232 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9233 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9234 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9235 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9236 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9238 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9239 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9240 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9241 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9242 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9243 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9244 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9245 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9246 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9247 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9248 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9250 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9251 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9252 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9253 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9254 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9255 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9256 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9257 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9258 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9260 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9261 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9262 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9263 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9264 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9265 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9266 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9267 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9268 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9269 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9270 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9271 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9272 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9273 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9274 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9275 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9276 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9277 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9278 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9279 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9280 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9281 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9282 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9283 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9284 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9285 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9286 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9287 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9288 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9289 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9290 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9292 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9293 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9294 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9295 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9296 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9297 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9298 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9299 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9300 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9301 ALC883_FUJITSU_PI2515),
9302 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9303 ALC888_FUJITSU_XA3530),
9304 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9305 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9306 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9307 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9308 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9309 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9310 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9311 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9312 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9314 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9315 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9316 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9317 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9318 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9319 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9320 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9325 /* codec SSID table for Intel Mac */
9326 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9327 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9328 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9329 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9330 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9331 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9332 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9333 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9334 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9335 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9336 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9337 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9338 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9339 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9340 * so apparently no perfect solution yet
9342 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9343 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9344 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9348 static struct alc_config_preset alc882_presets[] = {
9349 [ALC882_3ST_DIG] = {
9350 .mixers = { alc882_base_mixer },
9351 .init_verbs = { alc882_base_init_verbs,
9352 alc882_adc1_init_verbs },
9353 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9354 .dac_nids = alc882_dac_nids,
9355 .dig_out_nid = ALC882_DIGOUT_NID,
9356 .dig_in_nid = ALC882_DIGIN_NID,
9357 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9358 .channel_mode = alc882_ch_modes,
9360 .input_mux = &alc882_capture_source,
9362 [ALC882_6ST_DIG] = {
9363 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9364 .init_verbs = { alc882_base_init_verbs,
9365 alc882_adc1_init_verbs },
9366 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9367 .dac_nids = alc882_dac_nids,
9368 .dig_out_nid = ALC882_DIGOUT_NID,
9369 .dig_in_nid = ALC882_DIGIN_NID,
9370 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9371 .channel_mode = alc882_sixstack_modes,
9372 .input_mux = &alc882_capture_source,
9375 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9376 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9377 alc882_eapd_verbs },
9378 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9379 .dac_nids = alc882_dac_nids,
9380 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9381 .channel_mode = alc882_sixstack_modes,
9382 .input_mux = &alc882_capture_source,
9385 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9386 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9387 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9388 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9389 .dac_nids = alc882_dac_nids,
9390 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9391 .channel_mode = alc880_threestack_modes,
9393 .input_mux = &alc882_capture_source,
9394 .dig_out_nid = ALC882_DIGOUT_NID,
9397 .mixers = { alc885_mba21_mixer },
9398 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9400 .dac_nids = alc882_dac_nids,
9401 .channel_mode = alc885_mba21_ch_modes,
9402 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9403 .input_mux = &alc882_capture_source,
9404 .unsol_event = alc_automute_amp_unsol_event,
9405 .setup = alc885_mba21_setup,
9406 .init_hook = alc_automute_amp,
9409 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9410 .init_verbs = { alc885_mbp3_init_verbs,
9411 alc880_gpio1_init_verbs },
9413 .dac_nids = alc882_dac_nids,
9415 .channel_mode = alc885_mbp_4ch_modes,
9416 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9417 .input_mux = &alc882_capture_source,
9418 .dig_out_nid = ALC882_DIGOUT_NID,
9419 .dig_in_nid = ALC882_DIGIN_NID,
9420 .unsol_event = alc_automute_amp_unsol_event,
9421 .setup = alc885_mbp3_setup,
9422 .init_hook = alc_automute_amp,
9425 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9426 .init_verbs = { alc885_mb5_init_verbs,
9427 alc880_gpio1_init_verbs },
9428 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9429 .dac_nids = alc882_dac_nids,
9430 .channel_mode = alc885_mb5_6ch_modes,
9431 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9432 .input_mux = &mb5_capture_source,
9433 .dig_out_nid = ALC882_DIGOUT_NID,
9434 .dig_in_nid = ALC882_DIGIN_NID,
9435 .unsol_event = alc_automute_amp_unsol_event,
9436 .setup = alc885_mb5_setup,
9437 .init_hook = alc_automute_amp,
9439 [ALC885_MACMINI3] = {
9440 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9441 .init_verbs = { alc885_macmini3_init_verbs,
9442 alc880_gpio1_init_verbs },
9443 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9444 .dac_nids = alc882_dac_nids,
9445 .channel_mode = alc885_macmini3_6ch_modes,
9446 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9447 .input_mux = &macmini3_capture_source,
9448 .dig_out_nid = ALC882_DIGOUT_NID,
9449 .dig_in_nid = ALC882_DIGIN_NID,
9450 .unsol_event = alc_automute_amp_unsol_event,
9451 .setup = alc885_macmini3_setup,
9452 .init_hook = alc_automute_amp,
9455 .mixers = { alc882_macpro_mixer },
9456 .init_verbs = { alc882_macpro_init_verbs },
9457 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9458 .dac_nids = alc882_dac_nids,
9459 .dig_out_nid = ALC882_DIGOUT_NID,
9460 .dig_in_nid = ALC882_DIGIN_NID,
9461 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9462 .channel_mode = alc882_ch_modes,
9463 .input_mux = &alc882_capture_source,
9464 .init_hook = alc885_macpro_init_hook,
9467 .mixers = { alc885_imac24_mixer },
9468 .init_verbs = { alc885_imac24_init_verbs },
9469 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9470 .dac_nids = alc882_dac_nids,
9471 .dig_out_nid = ALC882_DIGOUT_NID,
9472 .dig_in_nid = ALC882_DIGIN_NID,
9473 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9474 .channel_mode = alc882_ch_modes,
9475 .input_mux = &alc882_capture_source,
9476 .unsol_event = alc_automute_amp_unsol_event,
9477 .setup = alc885_imac24_setup,
9478 .init_hook = alc885_imac24_init_hook,
9481 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9482 .init_verbs = { alc885_imac91_init_verbs,
9483 alc880_gpio1_init_verbs },
9484 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9485 .dac_nids = alc882_dac_nids,
9486 .channel_mode = alc885_mbp_4ch_modes,
9487 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9488 .input_mux = &alc882_capture_source,
9489 .dig_out_nid = ALC882_DIGOUT_NID,
9490 .dig_in_nid = ALC882_DIGIN_NID,
9491 .unsol_event = alc_automute_amp_unsol_event,
9492 .setup = alc885_imac91_setup,
9493 .init_hook = alc_automute_amp,
9496 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9497 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9498 alc880_gpio3_init_verbs, alc882_targa_verbs},
9499 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9500 .dac_nids = alc882_dac_nids,
9501 .dig_out_nid = ALC882_DIGOUT_NID,
9502 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9503 .adc_nids = alc882_adc_nids,
9504 .capsrc_nids = alc882_capsrc_nids,
9505 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9506 .channel_mode = alc882_3ST_6ch_modes,
9508 .input_mux = &alc882_capture_source,
9509 .unsol_event = alc882_targa_unsol_event,
9510 .setup = alc882_targa_setup,
9511 .init_hook = alc882_targa_automute,
9513 [ALC882_ASUS_A7J] = {
9514 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9515 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9516 alc882_asus_a7j_verbs},
9517 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9518 .dac_nids = alc882_dac_nids,
9519 .dig_out_nid = ALC882_DIGOUT_NID,
9520 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9521 .adc_nids = alc882_adc_nids,
9522 .capsrc_nids = alc882_capsrc_nids,
9523 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9524 .channel_mode = alc882_3ST_6ch_modes,
9526 .input_mux = &alc882_capture_source,
9528 [ALC882_ASUS_A7M] = {
9529 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9530 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9531 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9532 alc882_asus_a7m_verbs },
9533 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9534 .dac_nids = alc882_dac_nids,
9535 .dig_out_nid = ALC882_DIGOUT_NID,
9536 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9537 .channel_mode = alc880_threestack_modes,
9539 .input_mux = &alc882_capture_source,
9541 [ALC883_3ST_2ch_DIG] = {
9542 .mixers = { alc883_3ST_2ch_mixer },
9543 .init_verbs = { alc883_init_verbs },
9544 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9545 .dac_nids = alc883_dac_nids,
9546 .dig_out_nid = ALC883_DIGOUT_NID,
9547 .dig_in_nid = ALC883_DIGIN_NID,
9548 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9549 .channel_mode = alc883_3ST_2ch_modes,
9550 .input_mux = &alc883_capture_source,
9552 [ALC883_3ST_6ch_DIG] = {
9553 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9554 .init_verbs = { alc883_init_verbs },
9555 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9556 .dac_nids = alc883_dac_nids,
9557 .dig_out_nid = ALC883_DIGOUT_NID,
9558 .dig_in_nid = ALC883_DIGIN_NID,
9559 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9560 .channel_mode = alc883_3ST_6ch_modes,
9562 .input_mux = &alc883_capture_source,
9564 [ALC883_3ST_6ch] = {
9565 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9566 .init_verbs = { alc883_init_verbs },
9567 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9568 .dac_nids = alc883_dac_nids,
9569 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9570 .channel_mode = alc883_3ST_6ch_modes,
9572 .input_mux = &alc883_capture_source,
9574 [ALC883_3ST_6ch_INTEL] = {
9575 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9576 .init_verbs = { alc883_init_verbs },
9577 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9578 .dac_nids = alc883_dac_nids,
9579 .dig_out_nid = ALC883_DIGOUT_NID,
9580 .dig_in_nid = ALC883_DIGIN_NID,
9581 .slave_dig_outs = alc883_slave_dig_outs,
9582 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9583 .channel_mode = alc883_3ST_6ch_intel_modes,
9585 .input_mux = &alc883_3stack_6ch_intel,
9588 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9589 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9590 alc_hp15_unsol_verbs },
9591 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9592 .dac_nids = alc883_dac_nids,
9593 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9594 .adc_nids = alc889_adc_nids,
9595 .dig_out_nid = ALC883_DIGOUT_NID,
9596 .dig_in_nid = ALC883_DIGIN_NID,
9597 .slave_dig_outs = alc883_slave_dig_outs,
9598 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9599 .channel_mode = alc889_8ch_intel_modes,
9600 .capsrc_nids = alc889_capsrc_nids,
9601 .input_mux = &alc889_capture_source,
9602 .setup = alc889_automute_setup,
9603 .init_hook = alc_automute_amp,
9604 .unsol_event = alc_automute_amp_unsol_event,
9608 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9609 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9610 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9611 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9612 .dac_nids = alc883_dac_nids,
9613 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9614 .adc_nids = alc889_adc_nids,
9615 .dig_out_nid = ALC883_DIGOUT_NID,
9616 .dig_in_nid = ALC883_DIGIN_NID,
9617 .slave_dig_outs = alc883_slave_dig_outs,
9618 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9619 .channel_mode = alc889_8ch_intel_modes,
9620 .capsrc_nids = alc889_capsrc_nids,
9621 .input_mux = &alc889_capture_source,
9622 .setup = alc889_automute_setup,
9623 .init_hook = alc889_intel_init_hook,
9624 .unsol_event = alc_automute_amp_unsol_event,
9627 [ALC883_6ST_DIG] = {
9628 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9629 .init_verbs = { alc883_init_verbs },
9630 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9631 .dac_nids = alc883_dac_nids,
9632 .dig_out_nid = ALC883_DIGOUT_NID,
9633 .dig_in_nid = ALC883_DIGIN_NID,
9634 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9635 .channel_mode = alc883_sixstack_modes,
9636 .input_mux = &alc883_capture_source,
9638 [ALC883_TARGA_DIG] = {
9639 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9640 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9641 alc883_targa_verbs},
9642 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9643 .dac_nids = alc883_dac_nids,
9644 .dig_out_nid = ALC883_DIGOUT_NID,
9645 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9646 .channel_mode = alc883_3ST_6ch_modes,
9648 .input_mux = &alc883_capture_source,
9649 .unsol_event = alc883_targa_unsol_event,
9650 .setup = alc882_targa_setup,
9651 .init_hook = alc882_targa_automute,
9653 [ALC883_TARGA_2ch_DIG] = {
9654 .mixers = { alc883_targa_2ch_mixer},
9655 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9656 alc883_targa_verbs},
9657 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9658 .dac_nids = alc883_dac_nids,
9659 .adc_nids = alc883_adc_nids_alt,
9660 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9661 .capsrc_nids = alc883_capsrc_nids,
9662 .dig_out_nid = ALC883_DIGOUT_NID,
9663 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9664 .channel_mode = alc883_3ST_2ch_modes,
9665 .input_mux = &alc883_capture_source,
9666 .unsol_event = alc883_targa_unsol_event,
9667 .setup = alc882_targa_setup,
9668 .init_hook = alc882_targa_automute,
9670 [ALC883_TARGA_8ch_DIG] = {
9671 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9672 alc883_chmode_mixer },
9673 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9674 alc883_targa_verbs },
9675 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9676 .dac_nids = alc883_dac_nids,
9677 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9678 .adc_nids = alc883_adc_nids_rev,
9679 .capsrc_nids = alc883_capsrc_nids_rev,
9680 .dig_out_nid = ALC883_DIGOUT_NID,
9681 .dig_in_nid = ALC883_DIGIN_NID,
9682 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9683 .channel_mode = alc883_4ST_8ch_modes,
9685 .input_mux = &alc883_capture_source,
9686 .unsol_event = alc883_targa_unsol_event,
9687 .setup = alc882_targa_setup,
9688 .init_hook = alc882_targa_automute,
9691 .mixers = { alc883_base_mixer },
9692 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9693 * and the headphone jack. Turn this on and rely on the
9694 * standard mute methods whenever the user wants to turn
9695 * these outputs off.
9697 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9698 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9699 .dac_nids = alc883_dac_nids,
9700 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9701 .channel_mode = alc883_3ST_2ch_modes,
9702 .input_mux = &alc883_capture_source,
9704 [ALC883_ACER_ASPIRE] = {
9705 .mixers = { alc883_acer_aspire_mixer },
9706 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_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_2ch_modes),
9711 .channel_mode = alc883_3ST_2ch_modes,
9712 .input_mux = &alc883_capture_source,
9713 .unsol_event = alc_automute_amp_unsol_event,
9714 .setup = alc883_acer_aspire_setup,
9715 .init_hook = alc_automute_amp,
9717 [ALC888_ACER_ASPIRE_4930G] = {
9718 .mixers = { alc888_base_mixer,
9719 alc883_chmode_mixer },
9720 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9721 alc888_acer_aspire_4930g_verbs },
9722 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9723 .dac_nids = alc883_dac_nids,
9724 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9725 .adc_nids = alc883_adc_nids_rev,
9726 .capsrc_nids = alc883_capsrc_nids_rev,
9727 .dig_out_nid = ALC883_DIGOUT_NID,
9728 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9729 .channel_mode = alc883_3ST_6ch_modes,
9731 .const_channel_count = 6,
9733 ARRAY_SIZE(alc888_2_capture_sources),
9734 .input_mux = alc888_2_capture_sources,
9735 .unsol_event = alc_automute_amp_unsol_event,
9736 .setup = alc888_acer_aspire_4930g_setup,
9737 .init_hook = alc_automute_amp,
9739 [ALC888_ACER_ASPIRE_6530G] = {
9740 .mixers = { alc888_acer_aspire_6530_mixer },
9741 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9742 alc888_acer_aspire_6530g_verbs },
9743 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9744 .dac_nids = alc883_dac_nids,
9745 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9746 .adc_nids = alc883_adc_nids_rev,
9747 .capsrc_nids = alc883_capsrc_nids_rev,
9748 .dig_out_nid = ALC883_DIGOUT_NID,
9749 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9750 .channel_mode = alc883_3ST_2ch_modes,
9752 ARRAY_SIZE(alc888_2_capture_sources),
9753 .input_mux = alc888_acer_aspire_6530_sources,
9754 .unsol_event = alc_automute_amp_unsol_event,
9755 .setup = alc888_acer_aspire_6530g_setup,
9756 .init_hook = alc_automute_amp,
9758 [ALC888_ACER_ASPIRE_8930G] = {
9759 .mixers = { alc889_acer_aspire_8930g_mixer,
9760 alc883_chmode_mixer },
9761 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9762 alc889_acer_aspire_8930g_verbs,
9764 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9765 .dac_nids = alc883_dac_nids,
9766 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9767 .adc_nids = alc889_adc_nids,
9768 .capsrc_nids = alc889_capsrc_nids,
9769 .dig_out_nid = ALC883_DIGOUT_NID,
9770 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9771 .channel_mode = alc883_3ST_6ch_modes,
9773 .const_channel_count = 6,
9775 ARRAY_SIZE(alc889_capture_sources),
9776 .input_mux = alc889_capture_sources,
9777 .unsol_event = alc_automute_amp_unsol_event,
9778 .setup = alc889_acer_aspire_8930g_setup,
9779 .init_hook = alc_automute_amp,
9780 #ifdef CONFIG_SND_HDA_POWER_SAVE
9781 .power_hook = alc_power_eapd,
9784 [ALC888_ACER_ASPIRE_7730G] = {
9785 .mixers = { alc883_3ST_6ch_mixer,
9786 alc883_chmode_mixer },
9787 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9788 alc888_acer_aspire_7730G_verbs },
9789 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9790 .dac_nids = alc883_dac_nids,
9791 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9792 .adc_nids = alc883_adc_nids_rev,
9793 .capsrc_nids = alc883_capsrc_nids_rev,
9794 .dig_out_nid = ALC883_DIGOUT_NID,
9795 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9796 .channel_mode = alc883_3ST_6ch_modes,
9798 .const_channel_count = 6,
9799 .input_mux = &alc883_capture_source,
9800 .unsol_event = alc_automute_amp_unsol_event,
9801 .setup = alc888_acer_aspire_6530g_setup,
9802 .init_hook = alc_automute_amp,
9805 .mixers = { alc883_fivestack_mixer,
9806 alc883_chmode_mixer },
9807 .init_verbs = { alc883_init_verbs,
9808 alc883_medion_eapd_verbs },
9809 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9810 .dac_nids = alc883_dac_nids,
9811 .adc_nids = alc883_adc_nids_alt,
9812 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9813 .capsrc_nids = alc883_capsrc_nids,
9814 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9815 .channel_mode = alc883_sixstack_modes,
9816 .input_mux = &alc883_capture_source,
9818 [ALC883_MEDION_MD2] = {
9819 .mixers = { alc883_medion_md2_mixer},
9820 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9821 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9822 .dac_nids = alc883_dac_nids,
9823 .dig_out_nid = ALC883_DIGOUT_NID,
9824 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9825 .channel_mode = alc883_3ST_2ch_modes,
9826 .input_mux = &alc883_capture_source,
9827 .unsol_event = alc_automute_amp_unsol_event,
9828 .setup = alc883_medion_md2_setup,
9829 .init_hook = alc_automute_amp,
9831 [ALC883_LAPTOP_EAPD] = {
9832 .mixers = { alc883_base_mixer },
9833 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9834 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9835 .dac_nids = alc883_dac_nids,
9836 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9837 .channel_mode = alc883_3ST_2ch_modes,
9838 .input_mux = &alc883_capture_source,
9840 [ALC883_CLEVO_M540R] = {
9841 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9842 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9843 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9844 .dac_nids = alc883_dac_nids,
9845 .dig_out_nid = ALC883_DIGOUT_NID,
9846 .dig_in_nid = ALC883_DIGIN_NID,
9847 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9848 .channel_mode = alc883_3ST_6ch_clevo_modes,
9850 .input_mux = &alc883_capture_source,
9851 /* This machine has the hardware HP auto-muting, thus
9852 * we need no software mute via unsol event
9855 [ALC883_CLEVO_M720] = {
9856 .mixers = { alc883_clevo_m720_mixer },
9857 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9858 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9859 .dac_nids = alc883_dac_nids,
9860 .dig_out_nid = ALC883_DIGOUT_NID,
9861 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9862 .channel_mode = alc883_3ST_2ch_modes,
9863 .input_mux = &alc883_capture_source,
9864 .unsol_event = alc883_clevo_m720_unsol_event,
9865 .setup = alc883_clevo_m720_setup,
9866 .init_hook = alc883_clevo_m720_init_hook,
9868 [ALC883_LENOVO_101E_2ch] = {
9869 .mixers = { alc883_lenovo_101e_2ch_mixer},
9870 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9871 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9872 .dac_nids = alc883_dac_nids,
9873 .adc_nids = alc883_adc_nids_alt,
9874 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9875 .capsrc_nids = alc883_capsrc_nids,
9876 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9877 .channel_mode = alc883_3ST_2ch_modes,
9878 .input_mux = &alc883_lenovo_101e_capture_source,
9879 .unsol_event = alc883_lenovo_101e_unsol_event,
9880 .init_hook = alc883_lenovo_101e_all_automute,
9882 [ALC883_LENOVO_NB0763] = {
9883 .mixers = { alc883_lenovo_nb0763_mixer },
9884 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9885 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9886 .dac_nids = alc883_dac_nids,
9887 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9888 .channel_mode = alc883_3ST_2ch_modes,
9890 .input_mux = &alc883_lenovo_nb0763_capture_source,
9891 .unsol_event = alc_automute_amp_unsol_event,
9892 .setup = alc883_medion_md2_setup,
9893 .init_hook = alc_automute_amp,
9895 [ALC888_LENOVO_MS7195_DIG] = {
9896 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9897 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9898 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9899 .dac_nids = alc883_dac_nids,
9900 .dig_out_nid = ALC883_DIGOUT_NID,
9901 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9902 .channel_mode = alc883_3ST_6ch_modes,
9904 .input_mux = &alc883_capture_source,
9905 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9906 .init_hook = alc888_lenovo_ms7195_front_automute,
9908 [ALC883_HAIER_W66] = {
9909 .mixers = { alc883_targa_2ch_mixer},
9910 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9911 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9912 .dac_nids = alc883_dac_nids,
9913 .dig_out_nid = ALC883_DIGOUT_NID,
9914 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9915 .channel_mode = alc883_3ST_2ch_modes,
9916 .input_mux = &alc883_capture_source,
9917 .unsol_event = alc_automute_amp_unsol_event,
9918 .setup = alc883_haier_w66_setup,
9919 .init_hook = alc_automute_amp,
9922 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9923 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9924 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9925 .dac_nids = alc883_dac_nids,
9926 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9927 .channel_mode = alc888_3st_hp_modes,
9929 .input_mux = &alc883_capture_source,
9930 .unsol_event = alc_automute_amp_unsol_event,
9931 .setup = alc888_3st_hp_setup,
9932 .init_hook = alc_automute_amp,
9934 [ALC888_6ST_DELL] = {
9935 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9936 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9937 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9938 .dac_nids = alc883_dac_nids,
9939 .dig_out_nid = ALC883_DIGOUT_NID,
9940 .dig_in_nid = ALC883_DIGIN_NID,
9941 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9942 .channel_mode = alc883_sixstack_modes,
9943 .input_mux = &alc883_capture_source,
9944 .unsol_event = alc_automute_amp_unsol_event,
9945 .setup = alc888_6st_dell_setup,
9946 .init_hook = alc_automute_amp,
9949 .mixers = { alc883_mitac_mixer },
9950 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9951 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9952 .dac_nids = alc883_dac_nids,
9953 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9954 .channel_mode = alc883_3ST_2ch_modes,
9955 .input_mux = &alc883_capture_source,
9956 .unsol_event = alc_automute_amp_unsol_event,
9957 .setup = alc883_mitac_setup,
9958 .init_hook = alc_automute_amp,
9960 [ALC883_FUJITSU_PI2515] = {
9961 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9962 .init_verbs = { alc883_init_verbs,
9963 alc883_2ch_fujitsu_pi2515_verbs},
9964 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9965 .dac_nids = alc883_dac_nids,
9966 .dig_out_nid = ALC883_DIGOUT_NID,
9967 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9968 .channel_mode = alc883_3ST_2ch_modes,
9969 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9970 .unsol_event = alc_automute_amp_unsol_event,
9971 .setup = alc883_2ch_fujitsu_pi2515_setup,
9972 .init_hook = alc_automute_amp,
9974 [ALC888_FUJITSU_XA3530] = {
9975 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9976 .init_verbs = { alc883_init_verbs,
9977 alc888_fujitsu_xa3530_verbs },
9978 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9979 .dac_nids = alc883_dac_nids,
9980 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9981 .adc_nids = alc883_adc_nids_rev,
9982 .capsrc_nids = alc883_capsrc_nids_rev,
9983 .dig_out_nid = ALC883_DIGOUT_NID,
9984 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9985 .channel_mode = alc888_4ST_8ch_intel_modes,
9987 ARRAY_SIZE(alc888_2_capture_sources),
9988 .input_mux = alc888_2_capture_sources,
9989 .unsol_event = alc_automute_amp_unsol_event,
9990 .setup = alc888_fujitsu_xa3530_setup,
9991 .init_hook = alc_automute_amp,
9993 [ALC888_LENOVO_SKY] = {
9994 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9995 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9996 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9997 .dac_nids = alc883_dac_nids,
9998 .dig_out_nid = ALC883_DIGOUT_NID,
9999 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10000 .channel_mode = alc883_sixstack_modes,
10002 .input_mux = &alc883_lenovo_sky_capture_source,
10003 .unsol_event = alc_automute_amp_unsol_event,
10004 .setup = alc888_lenovo_sky_setup,
10005 .init_hook = alc_automute_amp,
10007 [ALC888_ASUS_M90V] = {
10008 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10009 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10010 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10011 .dac_nids = alc883_dac_nids,
10012 .dig_out_nid = ALC883_DIGOUT_NID,
10013 .dig_in_nid = ALC883_DIGIN_NID,
10014 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10015 .channel_mode = alc883_3ST_6ch_modes,
10017 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10018 .unsol_event = alc_sku_unsol_event,
10019 .setup = alc883_mode2_setup,
10020 .init_hook = alc_inithook,
10022 [ALC888_ASUS_EEE1601] = {
10023 .mixers = { alc883_asus_eee1601_mixer },
10024 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10025 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10026 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10027 .dac_nids = alc883_dac_nids,
10028 .dig_out_nid = ALC883_DIGOUT_NID,
10029 .dig_in_nid = ALC883_DIGIN_NID,
10030 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10031 .channel_mode = alc883_3ST_2ch_modes,
10033 .input_mux = &alc883_asus_eee1601_capture_source,
10034 .unsol_event = alc_sku_unsol_event,
10035 .init_hook = alc883_eee1601_inithook,
10037 [ALC1200_ASUS_P5Q] = {
10038 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10039 .init_verbs = { alc883_init_verbs },
10040 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10041 .dac_nids = alc883_dac_nids,
10042 .dig_out_nid = ALC1200_DIGOUT_NID,
10043 .dig_in_nid = ALC883_DIGIN_NID,
10044 .slave_dig_outs = alc1200_slave_dig_outs,
10045 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10046 .channel_mode = alc883_sixstack_modes,
10047 .input_mux = &alc883_capture_source,
10050 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10051 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10052 alc880_gpio1_init_verbs },
10053 .adc_nids = alc883_adc_nids,
10054 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10055 .capsrc_nids = alc883_capsrc_nids,
10056 .dac_nids = alc883_dac_nids,
10057 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10058 .channel_mode = alc889A_mb31_6ch_modes,
10059 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10060 .input_mux = &alc889A_mb31_capture_source,
10061 .dig_out_nid = ALC883_DIGOUT_NID,
10062 .unsol_event = alc889A_mb31_unsol_event,
10063 .init_hook = alc889A_mb31_automute,
10065 [ALC883_SONY_VAIO_TT] = {
10066 .mixers = { alc883_vaiott_mixer },
10067 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10068 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10069 .dac_nids = alc883_dac_nids,
10070 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10071 .channel_mode = alc883_3ST_2ch_modes,
10072 .input_mux = &alc883_capture_source,
10073 .unsol_event = alc_automute_amp_unsol_event,
10074 .setup = alc883_vaiott_setup,
10075 .init_hook = alc_automute_amp,
10084 PINFIX_ABIT_AW9D_MAX
10087 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10088 { 0x15, 0x01080104 }, /* side */
10089 { 0x16, 0x01011012 }, /* rear */
10090 { 0x17, 0x01016011 }, /* clfe */
10094 static const struct alc_fixup alc882_fixups[] = {
10095 [PINFIX_ABIT_AW9D_MAX] = {
10096 .pins = alc882_abit_aw9d_pinfix
10100 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10101 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10106 * BIOS auto configuration
10108 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10109 const struct auto_pin_cfg *cfg)
10111 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10114 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10115 hda_nid_t nid, int pin_type,
10118 /* set as output */
10119 struct alc_spec *spec = codec->spec;
10122 alc_set_pin_output(codec, nid, pin_type);
10123 if (spec->multiout.dac_nids[dac_idx] == 0x25)
10126 idx = spec->multiout.dac_nids[dac_idx] - 2;
10127 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10131 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10133 struct alc_spec *spec = codec->spec;
10136 for (i = 0; i <= HDA_SIDE; i++) {
10137 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10138 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10140 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10145 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10147 struct alc_spec *spec = codec->spec;
10150 pin = spec->autocfg.hp_pins[0];
10151 if (pin) /* connect to front */
10153 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10154 pin = spec->autocfg.speaker_pins[0];
10156 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10159 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10161 struct alc_spec *spec = codec->spec;
10164 for (i = 0; i < AUTO_PIN_LAST; i++) {
10165 hda_nid_t nid = spec->autocfg.input_pins[i];
10168 alc_set_input_pin(codec, nid, i);
10169 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10170 snd_hda_codec_write(codec, nid, 0,
10171 AC_VERB_SET_AMP_GAIN_MUTE,
10176 static void alc882_auto_init_input_src(struct hda_codec *codec)
10178 struct alc_spec *spec = codec->spec;
10181 for (c = 0; c < spec->num_adc_nids; c++) {
10182 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10183 hda_nid_t nid = spec->capsrc_nids[c];
10184 unsigned int mux_idx;
10185 const struct hda_input_mux *imux;
10186 int conns, mute, idx, item;
10188 conns = snd_hda_get_connections(codec, nid, conn_list,
10189 ARRAY_SIZE(conn_list));
10192 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10193 imux = &spec->input_mux[mux_idx];
10194 if (!imux->num_items && mux_idx > 0)
10195 imux = &spec->input_mux[0];
10196 for (idx = 0; idx < conns; idx++) {
10197 /* if the current connection is the selected one,
10198 * unmute it as default - otherwise mute it
10200 mute = AMP_IN_MUTE(idx);
10201 for (item = 0; item < imux->num_items; item++) {
10202 if (imux->items[item].index == idx) {
10203 if (spec->cur_mux[c] == item)
10204 mute = AMP_IN_UNMUTE(idx);
10208 /* check if we have a selector or mixer
10209 * we could check for the widget type instead, but
10210 * just check for Amp-In presence (in case of mixer
10211 * without amp-in there is something wrong, this
10212 * function shouldn't be used or capsrc nid is wrong)
10214 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10215 snd_hda_codec_write(codec, nid, 0,
10216 AC_VERB_SET_AMP_GAIN_MUTE,
10218 else if (mute != AMP_IN_MUTE(idx))
10219 snd_hda_codec_write(codec, nid, 0,
10220 AC_VERB_SET_CONNECT_SEL,
10226 /* add mic boosts if needed */
10227 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10229 struct alc_spec *spec = codec->spec;
10233 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10234 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10235 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10237 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10241 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10242 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10243 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10245 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10252 /* almost identical with ALC880 parser... */
10253 static int alc882_parse_auto_config(struct hda_codec *codec)
10255 struct alc_spec *spec = codec->spec;
10256 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10259 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10263 if (!spec->autocfg.line_outs)
10264 return 0; /* can't find valid BIOS pin config */
10266 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10269 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10272 err = alc880_auto_create_extra_out(spec,
10273 spec->autocfg.speaker_pins[0],
10277 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10281 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10285 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10287 /* check multiple SPDIF-out (for recent codecs) */
10288 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10290 err = snd_hda_get_connections(codec,
10291 spec->autocfg.dig_out_pins[i],
10296 spec->multiout.dig_out_nid = dig_nid;
10298 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10299 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10301 spec->slave_dig_outs[i - 1] = dig_nid;
10304 if (spec->autocfg.dig_in_pin)
10305 spec->dig_in_nid = ALC880_DIGIN_NID;
10307 if (spec->kctls.list)
10308 add_mixer(spec, spec->kctls.list);
10310 add_verb(spec, alc883_auto_init_verbs);
10311 /* if ADC 0x07 is available, initialize it, too */
10312 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10313 add_verb(spec, alc882_adc1_init_verbs);
10315 spec->num_mux_defs = 1;
10316 spec->input_mux = &spec->private_imux[0];
10318 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10320 err = alc_auto_add_mic_boost(codec);
10324 return 1; /* config found */
10327 /* additional initialization for auto-configuration model */
10328 static void alc882_auto_init(struct hda_codec *codec)
10330 struct alc_spec *spec = codec->spec;
10331 alc882_auto_init_multi_out(codec);
10332 alc882_auto_init_hp_out(codec);
10333 alc882_auto_init_analog_input(codec);
10334 alc882_auto_init_input_src(codec);
10335 if (spec->unsol_event)
10336 alc_inithook(codec);
10339 static int patch_alc882(struct hda_codec *codec)
10341 struct alc_spec *spec;
10342 int err, board_config;
10344 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10348 codec->spec = spec;
10350 alc_auto_parse_customize_define(codec);
10352 switch (codec->vendor_id) {
10357 /* ALC883 and variants */
10358 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10362 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10366 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10367 board_config = snd_hda_check_board_codec_sid_config(codec,
10368 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10370 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10371 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10373 board_config = ALC882_AUTO;
10376 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10378 if (board_config == ALC882_AUTO) {
10379 /* automatic parse from the BIOS config */
10380 err = alc882_parse_auto_config(codec);
10386 "hda_codec: Cannot set up configuration "
10387 "from BIOS. Using base mode...\n");
10388 board_config = ALC882_3ST_DIG;
10392 err = snd_hda_attach_beep_device(codec, 0x1);
10398 if (board_config != ALC882_AUTO)
10399 setup_preset(codec, &alc882_presets[board_config]);
10401 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10402 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10403 /* FIXME: setup DAC5 */
10404 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10405 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10407 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10408 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10410 if (codec->vendor_id == 0x10ec0888)
10411 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10413 if (!spec->adc_nids && spec->input_mux) {
10415 spec->num_adc_nids = 0;
10416 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10417 const struct hda_input_mux *imux = spec->input_mux;
10419 hda_nid_t items[16];
10420 hda_nid_t nid = alc882_adc_nids[i];
10421 unsigned int wcap = get_wcaps(codec, nid);
10423 wcap = get_wcaps_type(wcap);
10424 if (wcap != AC_WID_AUD_IN)
10426 spec->private_adc_nids[spec->num_adc_nids] = nid;
10427 err = snd_hda_get_connections(codec, nid, &cap, 1);
10430 err = snd_hda_get_connections(codec, cap, items,
10431 ARRAY_SIZE(items));
10434 for (j = 0; j < imux->num_items; j++)
10435 if (imux->items[j].index >= err)
10437 if (j < imux->num_items)
10439 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10440 spec->num_adc_nids++;
10442 spec->adc_nids = spec->private_adc_nids;
10443 spec->capsrc_nids = spec->private_capsrc_nids;
10446 set_capture_mixer(codec);
10448 if (spec->cdefine.enable_pcbeep)
10449 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10451 spec->vmaster_nid = 0x0c;
10453 codec->patch_ops = alc_patch_ops;
10454 if (board_config == ALC882_AUTO)
10455 spec->init_hook = alc882_auto_init;
10456 #ifdef CONFIG_SND_HDA_POWER_SAVE
10457 if (!spec->loopback.amplist)
10458 spec->loopback.amplist = alc882_loopbacks;
10469 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10470 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10472 #define alc262_dac_nids alc260_dac_nids
10473 #define alc262_adc_nids alc882_adc_nids
10474 #define alc262_adc_nids_alt alc882_adc_nids_alt
10475 #define alc262_capsrc_nids alc882_capsrc_nids
10476 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10478 #define alc262_modes alc260_modes
10479 #define alc262_capture_source alc882_capture_source
10481 static hda_nid_t alc262_dmic_adc_nids[1] = {
10486 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10488 static struct snd_kcontrol_new alc262_base_mixer[] = {
10489 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10490 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10491 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10492 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10494 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10496 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10497 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10498 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10499 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10500 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10501 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10502 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10503 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10504 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10508 /* update HP, line and mono-out pins according to the master switch */
10509 static void alc262_hp_master_update(struct hda_codec *codec)
10511 struct alc_spec *spec = codec->spec;
10512 int val = spec->master_sw;
10514 /* HP & line-out */
10515 snd_hda_codec_write_cache(codec, 0x1b, 0,
10516 AC_VERB_SET_PIN_WIDGET_CONTROL,
10518 snd_hda_codec_write_cache(codec, 0x15, 0,
10519 AC_VERB_SET_PIN_WIDGET_CONTROL,
10521 /* mono (speaker) depending on the HP jack sense */
10522 val = val && !spec->jack_present;
10523 snd_hda_codec_write_cache(codec, 0x16, 0,
10524 AC_VERB_SET_PIN_WIDGET_CONTROL,
10525 val ? PIN_OUT : 0);
10528 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10530 struct alc_spec *spec = codec->spec;
10532 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10533 alc262_hp_master_update(codec);
10536 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10538 if ((res >> 26) != ALC880_HP_EVENT)
10540 alc262_hp_bpc_automute(codec);
10543 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10545 struct alc_spec *spec = codec->spec;
10547 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10548 alc262_hp_master_update(codec);
10551 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10554 if ((res >> 26) != ALC880_HP_EVENT)
10556 alc262_hp_wildwest_automute(codec);
10559 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10561 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10562 struct snd_ctl_elem_value *ucontrol)
10564 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10565 struct alc_spec *spec = codec->spec;
10566 int val = !!*ucontrol->value.integer.value;
10568 if (val == spec->master_sw)
10570 spec->master_sw = val;
10571 alc262_hp_master_update(codec);
10575 #define ALC262_HP_MASTER_SWITCH \
10577 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10578 .name = "Master Playback Switch", \
10579 .info = snd_ctl_boolean_mono_info, \
10580 .get = alc262_hp_master_sw_get, \
10581 .put = alc262_hp_master_sw_put, \
10584 .iface = NID_MAPPING, \
10585 .name = "Master Playback Switch", \
10586 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10590 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10591 ALC262_HP_MASTER_SWITCH,
10592 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10593 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10594 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10595 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10597 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10599 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10600 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10601 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10602 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10603 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10604 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10605 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10606 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10607 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10608 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10609 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10610 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10614 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10615 ALC262_HP_MASTER_SWITCH,
10616 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10617 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10618 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10619 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10620 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10622 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10624 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10625 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10626 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10627 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10628 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10629 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10630 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10634 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10635 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10636 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10637 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10641 /* mute/unmute internal speaker according to the hp jack and mute state */
10642 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10644 struct alc_spec *spec = codec->spec;
10646 spec->autocfg.hp_pins[0] = 0x15;
10647 spec->autocfg.speaker_pins[0] = 0x14;
10650 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10651 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10652 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10653 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10657 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10661 static struct hda_verb alc262_hp_t5735_verbs[] = {
10662 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10663 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10665 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10669 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10670 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10672 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10673 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10674 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10675 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10679 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10680 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10681 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10682 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10683 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10684 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10685 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10686 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10687 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10688 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10689 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10693 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10700 /* bind hp and internal speaker mute (with plug check) as master switch */
10701 static void alc262_hippo_master_update(struct hda_codec *codec)
10703 struct alc_spec *spec = codec->spec;
10704 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10705 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10706 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10710 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10711 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10712 HDA_AMP_MUTE, mute);
10713 /* mute internal speaker per jack sense */
10714 if (spec->jack_present)
10715 mute = HDA_AMP_MUTE;
10717 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10718 HDA_AMP_MUTE, mute);
10719 if (speaker_nid && speaker_nid != line_nid)
10720 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10721 HDA_AMP_MUTE, mute);
10724 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10726 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10727 struct snd_ctl_elem_value *ucontrol)
10729 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10730 struct alc_spec *spec = codec->spec;
10731 int val = !!*ucontrol->value.integer.value;
10733 if (val == spec->master_sw)
10735 spec->master_sw = val;
10736 alc262_hippo_master_update(codec);
10740 #define ALC262_HIPPO_MASTER_SWITCH \
10742 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10743 .name = "Master Playback Switch", \
10744 .info = snd_ctl_boolean_mono_info, \
10745 .get = alc262_hippo_master_sw_get, \
10746 .put = alc262_hippo_master_sw_put, \
10749 .iface = NID_MAPPING, \
10750 .name = "Master Playback Switch", \
10751 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10752 (SUBDEV_SPEAKER(0) << 16), \
10755 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10756 ALC262_HIPPO_MASTER_SWITCH,
10757 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10758 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10759 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10760 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10761 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10762 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10763 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10764 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10765 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10766 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10767 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10768 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10772 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10773 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10774 ALC262_HIPPO_MASTER_SWITCH,
10775 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10776 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10777 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10778 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10780 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10781 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10782 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10783 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10784 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10788 /* mute/unmute internal speaker according to the hp jack and mute state */
10789 static void alc262_hippo_automute(struct hda_codec *codec)
10791 struct alc_spec *spec = codec->spec;
10792 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10794 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10795 alc262_hippo_master_update(codec);
10798 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10800 if ((res >> 26) != ALC880_HP_EVENT)
10802 alc262_hippo_automute(codec);
10805 static void alc262_hippo_setup(struct hda_codec *codec)
10807 struct alc_spec *spec = codec->spec;
10809 spec->autocfg.hp_pins[0] = 0x15;
10810 spec->autocfg.speaker_pins[0] = 0x14;
10813 static void alc262_hippo1_setup(struct hda_codec *codec)
10815 struct alc_spec *spec = codec->spec;
10817 spec->autocfg.hp_pins[0] = 0x1b;
10818 spec->autocfg.speaker_pins[0] = 0x14;
10822 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10823 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10824 ALC262_HIPPO_MASTER_SWITCH,
10825 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10827 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10828 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10832 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10833 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10834 ALC262_HIPPO_MASTER_SWITCH,
10835 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10836 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10837 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10838 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10839 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10843 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10844 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10845 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10846 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10847 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10848 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10849 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10852 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10853 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10854 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10855 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10859 static struct hda_verb alc262_tyan_verbs[] = {
10860 /* Headphone automute */
10861 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10862 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10863 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10865 /* P11 AUX_IN, white 4-pin connector */
10866 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10867 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10868 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10869 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10874 /* unsolicited event for HP jack sensing */
10875 static void alc262_tyan_setup(struct hda_codec *codec)
10877 struct alc_spec *spec = codec->spec;
10879 spec->autocfg.hp_pins[0] = 0x1b;
10880 spec->autocfg.speaker_pins[0] = 0x15;
10884 #define alc262_capture_mixer alc882_capture_mixer
10885 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10888 * generic initialization of ADC, input mixers and output mixers
10890 static struct hda_verb alc262_init_verbs[] = {
10892 * Unmute ADC0-2 and set the default input to mic-in
10894 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10896 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10898 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10899 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10901 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10903 * Note: PASD motherboards uses the Line In 2 as the input for
10904 * front panel mic (mic 2)
10906 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10908 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10909 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10910 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10911 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10914 * Set up output mixers (0x0c - 0x0e)
10916 /* set vol=0 to output mixers */
10917 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10918 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10919 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10920 /* set up input amps for analog loopback */
10921 /* Amp Indices: DAC = 0, mixer = 1 */
10922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10923 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10924 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10925 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10926 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10927 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10929 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10930 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10931 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10932 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10934 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10936 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10937 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10938 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10939 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10940 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10942 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10943 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10945 /* FIXME: use matrix-type input source selection */
10946 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10947 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10948 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10949 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10950 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10953 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10954 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10955 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10956 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10958 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10959 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10960 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10961 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10966 static struct hda_verb alc262_eapd_verbs[] = {
10967 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10968 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10972 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10973 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10974 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10975 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10977 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10978 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10982 static struct hda_verb alc262_sony_unsol_verbs[] = {
10983 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10984 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10985 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10987 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10992 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10993 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10994 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10995 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11001 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11002 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11003 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11006 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11007 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11008 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11013 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11015 struct alc_spec *spec = codec->spec;
11017 spec->autocfg.hp_pins[0] = 0x15;
11018 spec->autocfg.speaker_pins[0] = 0x14;
11019 spec->ext_mic.pin = 0x18;
11020 spec->ext_mic.mux_idx = 0;
11021 spec->int_mic.pin = 0x12;
11022 spec->int_mic.mux_idx = 9;
11023 spec->auto_mic = 1;
11029 * 0x16 = internal speaker
11030 * 0x18 = external mic
11033 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11034 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11035 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11037 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11038 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11039 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11041 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11042 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11046 static struct hda_verb alc262_nec_verbs[] = {
11047 /* Unmute Speaker */
11048 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11051 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11054 /* External mic to headphone */
11055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11056 /* External mic to speaker */
11057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11063 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11064 * 0x1b = port replicator headphone out
11067 #define ALC_HP_EVENT 0x37
11069 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11070 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11072 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11077 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11078 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11079 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11083 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11084 /* Front Mic pin: input vref at 50% */
11085 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11086 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11090 static struct hda_input_mux alc262_fujitsu_capture_source = {
11094 { "Int Mic", 0x1 },
11099 static struct hda_input_mux alc262_HP_capture_source = {
11103 { "Front Mic", 0x1 },
11110 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11114 { "Front Mic", 0x2 },
11120 /* mute/unmute internal speaker according to the hp jacks and mute state */
11121 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11123 struct alc_spec *spec = codec->spec;
11126 if (force || !spec->sense_updated) {
11127 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11128 snd_hda_jack_detect(codec, 0x1b);
11129 spec->sense_updated = 1;
11131 /* unmute internal speaker only if both HPs are unplugged and
11132 * master switch is on
11134 if (spec->jack_present)
11135 mute = HDA_AMP_MUTE;
11137 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11138 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11139 HDA_AMP_MUTE, mute);
11142 /* unsolicited event for HP jack sensing */
11143 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11146 if ((res >> 26) != ALC_HP_EVENT)
11148 alc262_fujitsu_automute(codec, 1);
11151 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11153 alc262_fujitsu_automute(codec, 1);
11156 /* bind volumes of both NID 0x0c and 0x0d */
11157 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11158 .ops = &snd_hda_bind_vol,
11160 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11161 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11166 /* mute/unmute internal speaker according to the hp jack and mute state */
11167 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11169 struct alc_spec *spec = codec->spec;
11172 if (force || !spec->sense_updated) {
11173 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11174 spec->sense_updated = 1;
11176 if (spec->jack_present) {
11177 /* mute internal speaker */
11178 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11179 HDA_AMP_MUTE, HDA_AMP_MUTE);
11180 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11181 HDA_AMP_MUTE, HDA_AMP_MUTE);
11183 /* unmute internal speaker if necessary */
11184 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11185 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11186 HDA_AMP_MUTE, mute);
11187 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11188 HDA_AMP_MUTE, mute);
11192 /* unsolicited event for HP jack sensing */
11193 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11196 if ((res >> 26) != ALC_HP_EVENT)
11198 alc262_lenovo_3000_automute(codec, 1);
11201 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11202 int dir, int idx, long *valp)
11206 for (i = 0; i < 2; i++, valp++)
11207 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11209 *valp ? 0 : HDA_AMP_MUTE);
11213 /* bind hp and internal speaker mute (with plug check) */
11214 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11215 struct snd_ctl_elem_value *ucontrol)
11217 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11218 long *valp = ucontrol->value.integer.value;
11221 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11222 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11224 alc262_fujitsu_automute(codec, 0);
11228 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11229 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11231 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11232 .name = "Master Playback Switch",
11233 .subdevice = HDA_SUBDEV_AMP_FLAG,
11234 .info = snd_hda_mixer_amp_switch_info,
11235 .get = snd_hda_mixer_amp_switch_get,
11236 .put = alc262_fujitsu_master_sw_put,
11237 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11240 .iface = NID_MAPPING,
11241 .name = "Master Playback Switch",
11242 .private_value = 0x1b,
11244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11246 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11247 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11248 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11249 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11250 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11251 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11255 /* bind hp and internal speaker mute (with plug check) */
11256 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11257 struct snd_ctl_elem_value *ucontrol)
11259 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11260 long *valp = ucontrol->value.integer.value;
11263 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11265 alc262_lenovo_3000_automute(codec, 0);
11269 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11270 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11272 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11273 .name = "Master Playback Switch",
11274 .subdevice = HDA_SUBDEV_AMP_FLAG,
11275 .info = snd_hda_mixer_amp_switch_info,
11276 .get = snd_hda_mixer_amp_switch_get,
11277 .put = alc262_lenovo_3000_master_sw_put,
11278 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11280 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11281 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11282 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11283 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11284 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11285 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11286 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11287 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11291 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11292 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11293 ALC262_HIPPO_MASTER_SWITCH,
11294 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11296 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11297 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11298 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11299 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11303 /* additional init verbs for Benq laptops */
11304 static struct hda_verb alc262_EAPD_verbs[] = {
11305 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11306 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11310 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11311 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11312 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11314 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11315 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11319 /* Samsung Q1 Ultra Vista model setup */
11320 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11321 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11322 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11323 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11324 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11325 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11326 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11330 static struct hda_verb alc262_ultra_verbs[] = {
11332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11336 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11337 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11338 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11339 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11342 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11344 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11345 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11347 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11348 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11349 /* ADC, choose mic */
11350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11355 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11356 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11357 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11358 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11363 /* mute/unmute internal speaker according to the hp jack and mute state */
11364 static void alc262_ultra_automute(struct hda_codec *codec)
11366 struct alc_spec *spec = codec->spec;
11370 /* auto-mute only when HP is used as HP */
11371 if (!spec->cur_mux[0]) {
11372 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11373 if (spec->jack_present)
11374 mute = HDA_AMP_MUTE;
11376 /* mute/unmute internal speaker */
11377 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11378 HDA_AMP_MUTE, mute);
11379 /* mute/unmute HP */
11380 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11381 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11384 /* unsolicited event for HP jack sensing */
11385 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11388 if ((res >> 26) != ALC880_HP_EVENT)
11390 alc262_ultra_automute(codec);
11393 static struct hda_input_mux alc262_ultra_capture_source = {
11397 { "Headphone", 0x7 },
11401 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11402 struct snd_ctl_elem_value *ucontrol)
11404 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11405 struct alc_spec *spec = codec->spec;
11408 ret = alc_mux_enum_put(kcontrol, ucontrol);
11411 /* reprogram the HP pin as mic or HP according to the input source */
11412 snd_hda_codec_write_cache(codec, 0x15, 0,
11413 AC_VERB_SET_PIN_WIDGET_CONTROL,
11414 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11415 alc262_ultra_automute(codec); /* mute/unmute HP */
11419 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11420 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11421 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11423 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11424 .name = "Capture Source",
11425 .info = alc_mux_enum_info,
11426 .get = alc_mux_enum_get,
11427 .put = alc262_ultra_mux_enum_put,
11430 .iface = NID_MAPPING,
11431 .name = "Capture Source",
11432 .private_value = 0x15,
11437 /* We use two mixers depending on the output pin; 0x16 is a mono output
11438 * and thus it's bound with a different mixer.
11439 * This function returns which mixer amp should be used.
11441 static int alc262_check_volbit(hda_nid_t nid)
11445 else if (nid == 0x16)
11451 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11452 const char *pfx, int *vbits)
11457 vbit = alc262_check_volbit(nid);
11460 if (*vbits & vbit) /* a volume control for this mixer already there */
11464 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11466 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11467 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11470 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11478 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11480 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11481 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11484 /* add playback controls from the parsed DAC table */
11485 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11486 const struct auto_pin_cfg *cfg)
11492 spec->multiout.num_dacs = 1; /* only use one dac */
11493 spec->multiout.dac_nids = spec->private_dac_nids;
11494 spec->multiout.dac_nids[0] = 2;
11496 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11498 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11502 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11505 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11508 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11512 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11513 alc262_check_volbit(cfg->speaker_pins[0]) |
11514 alc262_check_volbit(cfg->hp_pins[0]);
11515 if (vbits == 1 || vbits == 2)
11516 pfx = "Master"; /* only one mixer is used */
11517 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11522 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11525 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11529 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11536 #define alc262_auto_create_input_ctls \
11537 alc882_auto_create_input_ctls
11540 * generic initialization of ADC, input mixers and output mixers
11542 static struct hda_verb alc262_volume_init_verbs[] = {
11544 * Unmute ADC0-2 and set the default input to mic-in
11546 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11548 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11550 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11551 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11553 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11555 * Note: PASD motherboards uses the Line In 2 as the input for
11556 * front panel mic (mic 2)
11558 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11559 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11560 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11561 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11562 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11563 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11566 * Set up output mixers (0x0c - 0x0f)
11568 /* set vol=0 to output mixers */
11569 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11570 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11571 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11573 /* set up input amps for analog loopback */
11574 /* Amp Indices: DAC = 0, mixer = 1 */
11575 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11577 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11579 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11580 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11582 /* FIXME: use matrix-type input source selection */
11583 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11584 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11585 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11586 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11587 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11588 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11591 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11596 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11598 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11603 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11605 * Unmute ADC0-2 and set the default input to mic-in
11607 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11608 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11609 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11610 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11611 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11612 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11614 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11616 * Note: PASD motherboards uses the Line In 2 as the input for
11617 * front panel mic (mic 2)
11619 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11620 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11621 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11622 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11629 * Set up output mixers (0x0c - 0x0e)
11631 /* set vol=0 to output mixers */
11632 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11633 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11634 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11636 /* set up input amps for analog loopback */
11637 /* Amp Indices: DAC = 0, mixer = 1 */
11638 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11640 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11641 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11642 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11643 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11645 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11646 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11647 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11649 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11652 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11653 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11656 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11657 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11658 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11659 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11661 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11662 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11663 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11664 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11665 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11666 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11669 /* FIXME: use matrix-type input source selection */
11670 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11671 /* Input mixer1: only unmute Mic */
11672 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11674 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11676 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11677 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11678 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11679 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11680 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11682 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11683 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11684 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11685 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11686 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11687 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11688 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11689 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11690 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11692 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11693 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11694 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11695 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11696 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11697 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11698 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11699 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11700 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11702 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11707 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11709 * Unmute ADC0-2 and set the default input to mic-in
11711 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11712 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11713 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11714 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11715 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11716 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11718 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11720 * Note: PASD motherboards uses the Line In 2 as the input for front
11721 * panel mic (mic 2)
11723 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11733 * Set up output mixers (0x0c - 0x0e)
11735 /* set vol=0 to output mixers */
11736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11737 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11738 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11740 /* set up input amps for analog loopback */
11741 /* Amp Indices: DAC = 0, mixer = 1 */
11742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11745 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11746 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11751 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11753 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11756 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11758 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11761 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11762 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11764 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11765 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11766 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11767 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11768 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11769 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11771 /* FIXME: use matrix-type input source selection */
11772 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11773 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11774 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11779 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11780 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11785 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11786 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11787 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11788 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11791 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11792 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11793 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11794 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11795 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11796 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11798 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11803 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11807 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11809 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11810 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11814 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11815 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11816 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11821 #ifdef CONFIG_SND_HDA_POWER_SAVE
11822 #define alc262_loopbacks alc880_loopbacks
11825 /* pcm configuration: identical with ALC880 */
11826 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11827 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11828 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11829 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11832 * BIOS auto configuration
11834 static int alc262_parse_auto_config(struct hda_codec *codec)
11836 struct alc_spec *spec = codec->spec;
11838 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11840 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11844 if (!spec->autocfg.line_outs) {
11845 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11846 spec->multiout.max_channels = 2;
11847 spec->no_analog = 1;
11850 return 0; /* can't find valid BIOS pin config */
11852 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11855 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11859 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11862 if (spec->autocfg.dig_outs) {
11863 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11864 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11866 if (spec->autocfg.dig_in_pin)
11867 spec->dig_in_nid = ALC262_DIGIN_NID;
11869 if (spec->kctls.list)
11870 add_mixer(spec, spec->kctls.list);
11872 add_verb(spec, alc262_volume_init_verbs);
11873 spec->num_mux_defs = 1;
11874 spec->input_mux = &spec->private_imux[0];
11876 err = alc_auto_add_mic_boost(codec);
11880 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11885 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11886 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11887 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11888 #define alc262_auto_init_input_src alc882_auto_init_input_src
11891 /* init callback for auto-configuration model -- overriding the default init */
11892 static void alc262_auto_init(struct hda_codec *codec)
11894 struct alc_spec *spec = codec->spec;
11895 alc262_auto_init_multi_out(codec);
11896 alc262_auto_init_hp_out(codec);
11897 alc262_auto_init_analog_input(codec);
11898 alc262_auto_init_input_src(codec);
11899 if (spec->unsol_event)
11900 alc_inithook(codec);
11904 * configuration and preset
11906 static const char *alc262_models[ALC262_MODEL_LAST] = {
11907 [ALC262_BASIC] = "basic",
11908 [ALC262_HIPPO] = "hippo",
11909 [ALC262_HIPPO_1] = "hippo_1",
11910 [ALC262_FUJITSU] = "fujitsu",
11911 [ALC262_HP_BPC] = "hp-bpc",
11912 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11913 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11914 [ALC262_HP_RP5700] = "hp-rp5700",
11915 [ALC262_BENQ_ED8] = "benq",
11916 [ALC262_BENQ_T31] = "benq-t31",
11917 [ALC262_SONY_ASSAMD] = "sony-assamd",
11918 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11919 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11920 [ALC262_ULTRA] = "ultra",
11921 [ALC262_LENOVO_3000] = "lenovo-3000",
11922 [ALC262_NEC] = "nec",
11923 [ALC262_TYAN] = "tyan",
11924 [ALC262_AUTO] = "auto",
11927 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11928 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11929 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11930 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11932 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11934 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11936 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11937 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11938 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11939 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11940 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11941 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11942 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11943 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11944 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11945 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11946 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11947 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11948 ALC262_HP_TC_T5735),
11949 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11950 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11951 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11952 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11953 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11954 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11955 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11956 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11957 #if 0 /* disable the quirk since model=auto works better in recent versions */
11958 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11959 ALC262_SONY_ASSAMD),
11961 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11962 ALC262_TOSHIBA_RX1),
11963 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11964 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11965 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11966 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11967 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11969 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11970 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11971 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11972 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11973 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11977 static struct alc_config_preset alc262_presets[] = {
11979 .mixers = { alc262_base_mixer },
11980 .init_verbs = { alc262_init_verbs },
11981 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11982 .dac_nids = alc262_dac_nids,
11984 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11985 .channel_mode = alc262_modes,
11986 .input_mux = &alc262_capture_source,
11989 .mixers = { alc262_hippo_mixer },
11990 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11991 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11992 .dac_nids = alc262_dac_nids,
11994 .dig_out_nid = ALC262_DIGOUT_NID,
11995 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11996 .channel_mode = alc262_modes,
11997 .input_mux = &alc262_capture_source,
11998 .unsol_event = alc262_hippo_unsol_event,
11999 .setup = alc262_hippo_setup,
12000 .init_hook = alc262_hippo_automute,
12002 [ALC262_HIPPO_1] = {
12003 .mixers = { alc262_hippo1_mixer },
12004 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12005 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12006 .dac_nids = alc262_dac_nids,
12008 .dig_out_nid = ALC262_DIGOUT_NID,
12009 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12010 .channel_mode = alc262_modes,
12011 .input_mux = &alc262_capture_source,
12012 .unsol_event = alc262_hippo_unsol_event,
12013 .setup = alc262_hippo1_setup,
12014 .init_hook = alc262_hippo_automute,
12016 [ALC262_FUJITSU] = {
12017 .mixers = { alc262_fujitsu_mixer },
12018 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12019 alc262_fujitsu_unsol_verbs },
12020 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12021 .dac_nids = alc262_dac_nids,
12023 .dig_out_nid = ALC262_DIGOUT_NID,
12024 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12025 .channel_mode = alc262_modes,
12026 .input_mux = &alc262_fujitsu_capture_source,
12027 .unsol_event = alc262_fujitsu_unsol_event,
12028 .init_hook = alc262_fujitsu_init_hook,
12030 [ALC262_HP_BPC] = {
12031 .mixers = { alc262_HP_BPC_mixer },
12032 .init_verbs = { alc262_HP_BPC_init_verbs },
12033 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12034 .dac_nids = alc262_dac_nids,
12036 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12037 .channel_mode = alc262_modes,
12038 .input_mux = &alc262_HP_capture_source,
12039 .unsol_event = alc262_hp_bpc_unsol_event,
12040 .init_hook = alc262_hp_bpc_automute,
12042 [ALC262_HP_BPC_D7000_WF] = {
12043 .mixers = { alc262_HP_BPC_WildWest_mixer },
12044 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12045 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12046 .dac_nids = alc262_dac_nids,
12048 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12049 .channel_mode = alc262_modes,
12050 .input_mux = &alc262_HP_D7000_capture_source,
12051 .unsol_event = alc262_hp_wildwest_unsol_event,
12052 .init_hook = alc262_hp_wildwest_automute,
12054 [ALC262_HP_BPC_D7000_WL] = {
12055 .mixers = { alc262_HP_BPC_WildWest_mixer,
12056 alc262_HP_BPC_WildWest_option_mixer },
12057 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12058 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12059 .dac_nids = alc262_dac_nids,
12061 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12062 .channel_mode = alc262_modes,
12063 .input_mux = &alc262_HP_D7000_capture_source,
12064 .unsol_event = alc262_hp_wildwest_unsol_event,
12065 .init_hook = alc262_hp_wildwest_automute,
12067 [ALC262_HP_TC_T5735] = {
12068 .mixers = { alc262_hp_t5735_mixer },
12069 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12070 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12071 .dac_nids = alc262_dac_nids,
12073 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12074 .channel_mode = alc262_modes,
12075 .input_mux = &alc262_capture_source,
12076 .unsol_event = alc_sku_unsol_event,
12077 .setup = alc262_hp_t5735_setup,
12078 .init_hook = alc_inithook,
12080 [ALC262_HP_RP5700] = {
12081 .mixers = { alc262_hp_rp5700_mixer },
12082 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12083 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12084 .dac_nids = alc262_dac_nids,
12085 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12086 .channel_mode = alc262_modes,
12087 .input_mux = &alc262_hp_rp5700_capture_source,
12089 [ALC262_BENQ_ED8] = {
12090 .mixers = { alc262_base_mixer },
12091 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12092 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12093 .dac_nids = alc262_dac_nids,
12095 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12096 .channel_mode = alc262_modes,
12097 .input_mux = &alc262_capture_source,
12099 [ALC262_SONY_ASSAMD] = {
12100 .mixers = { alc262_sony_mixer },
12101 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12102 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12103 .dac_nids = alc262_dac_nids,
12105 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12106 .channel_mode = alc262_modes,
12107 .input_mux = &alc262_capture_source,
12108 .unsol_event = alc262_hippo_unsol_event,
12109 .setup = alc262_hippo_setup,
12110 .init_hook = alc262_hippo_automute,
12112 [ALC262_BENQ_T31] = {
12113 .mixers = { alc262_benq_t31_mixer },
12114 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12115 alc_hp15_unsol_verbs },
12116 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12117 .dac_nids = alc262_dac_nids,
12119 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12120 .channel_mode = alc262_modes,
12121 .input_mux = &alc262_capture_source,
12122 .unsol_event = alc262_hippo_unsol_event,
12123 .setup = alc262_hippo_setup,
12124 .init_hook = alc262_hippo_automute,
12127 .mixers = { alc262_ultra_mixer },
12128 .cap_mixer = alc262_ultra_capture_mixer,
12129 .init_verbs = { alc262_ultra_verbs },
12130 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12131 .dac_nids = alc262_dac_nids,
12132 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12133 .channel_mode = alc262_modes,
12134 .input_mux = &alc262_ultra_capture_source,
12135 .adc_nids = alc262_adc_nids, /* ADC0 */
12136 .capsrc_nids = alc262_capsrc_nids,
12137 .num_adc_nids = 1, /* single ADC */
12138 .unsol_event = alc262_ultra_unsol_event,
12139 .init_hook = alc262_ultra_automute,
12141 [ALC262_LENOVO_3000] = {
12142 .mixers = { alc262_lenovo_3000_mixer },
12143 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12144 alc262_lenovo_3000_unsol_verbs,
12145 alc262_lenovo_3000_init_verbs },
12146 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12147 .dac_nids = alc262_dac_nids,
12149 .dig_out_nid = ALC262_DIGOUT_NID,
12150 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12151 .channel_mode = alc262_modes,
12152 .input_mux = &alc262_fujitsu_capture_source,
12153 .unsol_event = alc262_lenovo_3000_unsol_event,
12156 .mixers = { alc262_nec_mixer },
12157 .init_verbs = { alc262_nec_verbs },
12158 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12159 .dac_nids = alc262_dac_nids,
12161 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12162 .channel_mode = alc262_modes,
12163 .input_mux = &alc262_capture_source,
12165 [ALC262_TOSHIBA_S06] = {
12166 .mixers = { alc262_toshiba_s06_mixer },
12167 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12168 alc262_eapd_verbs },
12169 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12170 .capsrc_nids = alc262_dmic_capsrc_nids,
12171 .dac_nids = alc262_dac_nids,
12172 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12173 .num_adc_nids = 1, /* single ADC */
12174 .dig_out_nid = ALC262_DIGOUT_NID,
12175 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12176 .channel_mode = alc262_modes,
12177 .unsol_event = alc_sku_unsol_event,
12178 .setup = alc262_toshiba_s06_setup,
12179 .init_hook = alc_inithook,
12181 [ALC262_TOSHIBA_RX1] = {
12182 .mixers = { alc262_toshiba_rx1_mixer },
12183 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_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_tyan_mixer },
12196 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12197 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12198 .dac_nids = alc262_dac_nids,
12200 .dig_out_nid = ALC262_DIGOUT_NID,
12201 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12202 .channel_mode = alc262_modes,
12203 .input_mux = &alc262_capture_source,
12204 .unsol_event = alc_automute_amp_unsol_event,
12205 .setup = alc262_tyan_setup,
12206 .init_hook = alc_automute_amp,
12210 static int patch_alc262(struct hda_codec *codec)
12212 struct alc_spec *spec;
12216 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12220 codec->spec = spec;
12222 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12227 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12228 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12229 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12230 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12233 alc_auto_parse_customize_define(codec);
12235 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12237 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12241 if (board_config < 0) {
12242 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12244 board_config = ALC262_AUTO;
12247 if (board_config == ALC262_AUTO) {
12248 /* automatic parse from the BIOS config */
12249 err = alc262_parse_auto_config(codec);
12255 "hda_codec: Cannot set up configuration "
12256 "from BIOS. Using base mode...\n");
12257 board_config = ALC262_BASIC;
12261 if (!spec->no_analog) {
12262 err = snd_hda_attach_beep_device(codec, 0x1);
12269 if (board_config != ALC262_AUTO)
12270 setup_preset(codec, &alc262_presets[board_config]);
12272 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12273 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12275 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12276 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12278 if (!spec->adc_nids && spec->input_mux) {
12280 /* check whether the digital-mic has to be supported */
12281 for (i = 0; i < spec->input_mux->num_items; i++) {
12282 if (spec->input_mux->items[i].index >= 9)
12285 if (i < spec->input_mux->num_items) {
12286 /* use only ADC0 */
12287 spec->adc_nids = alc262_dmic_adc_nids;
12288 spec->num_adc_nids = 1;
12289 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12291 /* all analog inputs */
12292 /* check whether NID 0x07 is valid */
12293 unsigned int wcap = get_wcaps(codec, 0x07);
12296 wcap = get_wcaps_type(wcap);
12297 if (wcap != AC_WID_AUD_IN) {
12298 spec->adc_nids = alc262_adc_nids_alt;
12299 spec->num_adc_nids =
12300 ARRAY_SIZE(alc262_adc_nids_alt);
12301 spec->capsrc_nids = alc262_capsrc_nids_alt;
12303 spec->adc_nids = alc262_adc_nids;
12304 spec->num_adc_nids =
12305 ARRAY_SIZE(alc262_adc_nids);
12306 spec->capsrc_nids = alc262_capsrc_nids;
12310 if (!spec->cap_mixer && !spec->no_analog)
12311 set_capture_mixer(codec);
12312 if (!spec->no_analog && spec->cdefine.enable_pcbeep)
12313 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12315 spec->vmaster_nid = 0x0c;
12317 codec->patch_ops = alc_patch_ops;
12318 if (board_config == ALC262_AUTO)
12319 spec->init_hook = alc262_auto_init;
12320 #ifdef CONFIG_SND_HDA_POWER_SAVE
12321 if (!spec->loopback.amplist)
12322 spec->loopback.amplist = alc262_loopbacks;
12329 * ALC268 channel source setting (2 channel)
12331 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12332 #define alc268_modes alc260_modes
12334 static hda_nid_t alc268_dac_nids[2] = {
12339 static hda_nid_t alc268_adc_nids[2] = {
12344 static hda_nid_t alc268_adc_nids_alt[1] = {
12349 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12351 static struct snd_kcontrol_new alc268_base_mixer[] = {
12352 /* output mixer control */
12353 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12354 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12355 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12356 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12357 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12358 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12359 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12363 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12364 /* output mixer control */
12365 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12366 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12367 ALC262_HIPPO_MASTER_SWITCH,
12368 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12369 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12370 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12374 /* bind Beep switches of both NID 0x0f and 0x10 */
12375 static struct hda_bind_ctls alc268_bind_beep_sw = {
12376 .ops = &snd_hda_bind_sw,
12378 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12379 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12384 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12385 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12386 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12390 static struct hda_verb alc268_eapd_verbs[] = {
12391 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12392 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12396 /* Toshiba specific */
12397 static struct hda_verb alc268_toshiba_verbs[] = {
12398 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12402 /* Acer specific */
12403 /* bind volumes of both NID 0x02 and 0x03 */
12404 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12405 .ops = &snd_hda_bind_vol,
12407 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12408 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12413 /* mute/unmute internal speaker according to the hp jack and mute state */
12414 static void alc268_acer_automute(struct hda_codec *codec, int force)
12416 struct alc_spec *spec = codec->spec;
12419 if (force || !spec->sense_updated) {
12420 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12421 spec->sense_updated = 1;
12423 if (spec->jack_present)
12424 mute = HDA_AMP_MUTE; /* mute internal speaker */
12425 else /* unmute internal speaker if necessary */
12426 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12427 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12428 HDA_AMP_MUTE, mute);
12432 /* bind hp and internal speaker mute (with plug check) */
12433 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12434 struct snd_ctl_elem_value *ucontrol)
12436 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12437 long *valp = ucontrol->value.integer.value;
12440 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12442 alc268_acer_automute(codec, 0);
12446 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12447 /* output mixer control */
12448 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12450 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12451 .name = "Master Playback Switch",
12452 .subdevice = HDA_SUBDEV_AMP_FLAG,
12453 .info = snd_hda_mixer_amp_switch_info,
12454 .get = snd_hda_mixer_amp_switch_get,
12455 .put = alc268_acer_master_sw_put,
12456 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12458 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12462 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12463 /* output mixer control */
12464 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12466 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12467 .name = "Master Playback Switch",
12468 .subdevice = HDA_SUBDEV_AMP_FLAG,
12469 .info = snd_hda_mixer_amp_switch_info,
12470 .get = snd_hda_mixer_amp_switch_get,
12471 .put = alc268_acer_master_sw_put,
12472 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12474 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12475 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12476 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12480 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12481 /* output mixer control */
12482 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12484 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12485 .name = "Master Playback Switch",
12486 .subdevice = HDA_SUBDEV_AMP_FLAG,
12487 .info = snd_hda_mixer_amp_switch_info,
12488 .get = snd_hda_mixer_amp_switch_get,
12489 .put = alc268_acer_master_sw_put,
12490 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12492 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12493 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12497 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12498 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12500 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12501 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12502 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12507 static struct hda_verb alc268_acer_verbs[] = {
12508 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12509 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12511 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12512 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12513 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12514 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12518 /* unsolicited event for HP jack sensing */
12519 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12520 #define alc268_toshiba_setup alc262_hippo_setup
12521 #define alc268_toshiba_automute alc262_hippo_automute
12523 static void alc268_acer_unsol_event(struct hda_codec *codec,
12526 if ((res >> 26) != ALC880_HP_EVENT)
12528 alc268_acer_automute(codec, 1);
12531 static void alc268_acer_init_hook(struct hda_codec *codec)
12533 alc268_acer_automute(codec, 1);
12536 /* toggle speaker-output according to the hp-jack state */
12537 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12539 unsigned int present;
12540 unsigned char bits;
12542 present = snd_hda_jack_detect(codec, 0x15);
12543 bits = present ? AMP_IN_MUTE(0) : 0;
12544 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12545 AMP_IN_MUTE(0), bits);
12546 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12547 AMP_IN_MUTE(0), bits);
12550 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12553 switch (res >> 26) {
12554 case ALC880_HP_EVENT:
12555 alc268_aspire_one_speaker_automute(codec);
12557 case ALC880_MIC_EVENT:
12558 alc_mic_automute(codec);
12563 static void alc268_acer_lc_setup(struct hda_codec *codec)
12565 struct alc_spec *spec = codec->spec;
12566 spec->ext_mic.pin = 0x18;
12567 spec->ext_mic.mux_idx = 0;
12568 spec->int_mic.pin = 0x12;
12569 spec->int_mic.mux_idx = 6;
12570 spec->auto_mic = 1;
12573 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12575 alc268_aspire_one_speaker_automute(codec);
12576 alc_mic_automute(codec);
12579 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12580 /* output mixer control */
12581 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12582 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12583 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12584 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12585 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12586 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12590 static struct hda_verb alc268_dell_verbs[] = {
12591 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12593 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12594 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12598 /* mute/unmute internal speaker according to the hp jack and mute state */
12599 static void alc268_dell_setup(struct hda_codec *codec)
12601 struct alc_spec *spec = codec->spec;
12603 spec->autocfg.hp_pins[0] = 0x15;
12604 spec->autocfg.speaker_pins[0] = 0x14;
12605 spec->ext_mic.pin = 0x18;
12606 spec->ext_mic.mux_idx = 0;
12607 spec->int_mic.pin = 0x19;
12608 spec->int_mic.mux_idx = 1;
12609 spec->auto_mic = 1;
12612 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12613 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12614 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12615 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12617 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12618 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12619 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12620 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12624 static struct hda_verb alc267_quanta_il1_verbs[] = {
12625 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12626 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12630 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12632 struct alc_spec *spec = codec->spec;
12633 spec->autocfg.hp_pins[0] = 0x15;
12634 spec->autocfg.speaker_pins[0] = 0x14;
12635 spec->ext_mic.pin = 0x18;
12636 spec->ext_mic.mux_idx = 0;
12637 spec->int_mic.pin = 0x19;
12638 spec->int_mic.mux_idx = 1;
12639 spec->auto_mic = 1;
12643 * generic initialization of ADC, input mixers and output mixers
12645 static struct hda_verb alc268_base_init_verbs[] = {
12646 /* Unmute DAC0-1 and set vol = 0 */
12647 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12648 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12651 * Set up output mixers (0x0c - 0x0e)
12653 /* set vol=0 to output mixers */
12654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12655 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12657 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12658 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12660 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12663 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12664 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12665 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12666 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12667 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12669 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12672 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12673 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12675 /* set PCBEEP vol = 0, mute connections */
12676 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12677 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12678 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12680 /* Unmute Selector 23h,24h and set the default input to mic-in */
12682 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12683 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12684 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12685 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12691 * generic initialization of ADC, input mixers and output mixers
12693 static struct hda_verb alc268_volume_init_verbs[] = {
12694 /* set output DAC */
12695 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12696 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12698 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12699 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12700 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12701 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12702 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12704 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12705 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12706 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12708 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12709 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12711 /* set PCBEEP vol = 0, mute connections */
12712 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12713 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12714 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12719 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12720 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12721 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12725 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12726 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12727 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12732 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12733 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12734 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12735 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12736 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12741 static struct hda_input_mux alc268_capture_source = {
12745 { "Front Mic", 0x1 },
12751 static struct hda_input_mux alc268_acer_capture_source = {
12755 { "Internal Mic", 0x1 },
12760 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12764 { "Internal Mic", 0x6 },
12769 #ifdef CONFIG_SND_DEBUG
12770 static struct snd_kcontrol_new alc268_test_mixer[] = {
12771 /* Volume widgets */
12772 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12773 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12774 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12775 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12776 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12777 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12778 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12779 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12780 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12781 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12782 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12783 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12784 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12785 /* The below appears problematic on some hardwares */
12786 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12787 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12788 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12789 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12790 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12792 /* Modes for retasking pin widgets */
12793 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12794 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12795 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12796 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12798 /* Controls for GPIO pins, assuming they are configured as outputs */
12799 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12800 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12801 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12802 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12804 /* Switches to allow the digital SPDIF output pin to be enabled.
12805 * The ALC268 does not have an SPDIF input.
12807 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12809 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12810 * this output to turn on an external amplifier.
12812 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12813 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12819 /* create input playback/capture controls for the given pin */
12820 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12821 const char *ctlname, int idx)
12837 if (spec->multiout.dac_nids[0] != dac &&
12838 spec->multiout.dac_nids[1] != dac) {
12839 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12840 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12844 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12848 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12849 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12851 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12852 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12858 /* add playback controls from the parsed DAC table */
12859 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12860 const struct auto_pin_cfg *cfg)
12865 spec->multiout.dac_nids = spec->private_dac_nids;
12867 nid = cfg->line_out_pins[0];
12870 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12874 err = alc268_new_analog_output(spec, nid, name, 0);
12879 nid = cfg->speaker_pins[0];
12881 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12882 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12886 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12890 nid = cfg->hp_pins[0];
12892 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12897 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12899 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12900 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12907 /* create playback/capture controls for input pins */
12908 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12909 const struct auto_pin_cfg *cfg)
12911 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12914 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12915 hda_nid_t nid, int pin_type)
12919 alc_set_pin_output(codec, nid, pin_type);
12920 if (nid == 0x14 || nid == 0x16)
12924 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12927 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12929 struct alc_spec *spec = codec->spec;
12930 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12932 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12933 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12937 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12939 struct alc_spec *spec = codec->spec;
12942 pin = spec->autocfg.hp_pins[0];
12944 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12945 pin = spec->autocfg.speaker_pins[0];
12947 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12950 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12952 struct alc_spec *spec = codec->spec;
12953 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12954 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12955 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12956 unsigned int dac_vol1, dac_vol2;
12958 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12959 snd_hda_codec_write(codec, speaker_nid, 0,
12960 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12961 /* mute mixer inputs from 0x1d */
12962 snd_hda_codec_write(codec, 0x0f, 0,
12963 AC_VERB_SET_AMP_GAIN_MUTE,
12965 snd_hda_codec_write(codec, 0x10, 0,
12966 AC_VERB_SET_AMP_GAIN_MUTE,
12969 /* unmute mixer inputs from 0x1d */
12970 snd_hda_codec_write(codec, 0x0f, 0,
12971 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12972 snd_hda_codec_write(codec, 0x10, 0,
12973 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12976 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12977 if (line_nid == 0x14)
12978 dac_vol2 = AMP_OUT_ZERO;
12979 else if (line_nid == 0x15)
12980 dac_vol1 = AMP_OUT_ZERO;
12981 if (hp_nid == 0x14)
12982 dac_vol2 = AMP_OUT_ZERO;
12983 else if (hp_nid == 0x15)
12984 dac_vol1 = AMP_OUT_ZERO;
12985 if (line_nid != 0x16 || hp_nid != 0x16 ||
12986 spec->autocfg.line_out_pins[1] != 0x16 ||
12987 spec->autocfg.line_out_pins[2] != 0x16)
12988 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12990 snd_hda_codec_write(codec, 0x02, 0,
12991 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12992 snd_hda_codec_write(codec, 0x03, 0,
12993 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12996 /* pcm configuration: identical with ALC880 */
12997 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12998 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12999 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13000 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13003 * BIOS auto configuration
13005 static int alc268_parse_auto_config(struct hda_codec *codec)
13007 struct alc_spec *spec = codec->spec;
13009 static hda_nid_t alc268_ignore[] = { 0 };
13011 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13015 if (!spec->autocfg.line_outs) {
13016 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13017 spec->multiout.max_channels = 2;
13018 spec->no_analog = 1;
13021 return 0; /* can't find valid BIOS pin config */
13023 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13026 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13030 spec->multiout.max_channels = 2;
13033 /* digital only support output */
13034 if (spec->autocfg.dig_outs) {
13035 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13036 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13038 if (spec->kctls.list)
13039 add_mixer(spec, spec->kctls.list);
13041 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13042 add_mixer(spec, alc268_beep_mixer);
13044 add_verb(spec, alc268_volume_init_verbs);
13045 spec->num_mux_defs = 2;
13046 spec->input_mux = &spec->private_imux[0];
13048 err = alc_auto_add_mic_boost(codec);
13052 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13057 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13059 /* init callback for auto-configuration model -- overriding the default init */
13060 static void alc268_auto_init(struct hda_codec *codec)
13062 struct alc_spec *spec = codec->spec;
13063 alc268_auto_init_multi_out(codec);
13064 alc268_auto_init_hp_out(codec);
13065 alc268_auto_init_mono_speaker_out(codec);
13066 alc268_auto_init_analog_input(codec);
13067 if (spec->unsol_event)
13068 alc_inithook(codec);
13072 * configuration and preset
13074 static const char *alc268_models[ALC268_MODEL_LAST] = {
13075 [ALC267_QUANTA_IL1] = "quanta-il1",
13076 [ALC268_3ST] = "3stack",
13077 [ALC268_TOSHIBA] = "toshiba",
13078 [ALC268_ACER] = "acer",
13079 [ALC268_ACER_DMIC] = "acer-dmic",
13080 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13081 [ALC268_DELL] = "dell",
13082 [ALC268_ZEPTO] = "zepto",
13083 #ifdef CONFIG_SND_DEBUG
13084 [ALC268_TEST] = "test",
13086 [ALC268_AUTO] = "auto",
13089 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13090 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13091 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13092 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13093 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13094 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13095 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13096 ALC268_ACER_ASPIRE_ONE),
13097 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13098 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13099 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13100 /* almost compatible with toshiba but with optional digital outs;
13101 * auto-probing seems working fine
13103 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13105 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13106 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13107 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13108 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13109 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13110 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13114 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13115 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13116 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13117 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13118 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13123 static struct alc_config_preset alc268_presets[] = {
13124 [ALC267_QUANTA_IL1] = {
13125 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13126 alc268_capture_nosrc_mixer },
13127 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13128 alc267_quanta_il1_verbs },
13129 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13130 .dac_nids = alc268_dac_nids,
13131 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13132 .adc_nids = alc268_adc_nids_alt,
13134 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13135 .channel_mode = alc268_modes,
13136 .unsol_event = alc_sku_unsol_event,
13137 .setup = alc267_quanta_il1_setup,
13138 .init_hook = alc_inithook,
13141 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13142 alc268_beep_mixer },
13143 .init_verbs = { alc268_base_init_verbs },
13144 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13145 .dac_nids = alc268_dac_nids,
13146 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13147 .adc_nids = alc268_adc_nids_alt,
13148 .capsrc_nids = alc268_capsrc_nids,
13150 .dig_out_nid = ALC268_DIGOUT_NID,
13151 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13152 .channel_mode = alc268_modes,
13153 .input_mux = &alc268_capture_source,
13155 [ALC268_TOSHIBA] = {
13156 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13157 alc268_beep_mixer },
13158 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13159 alc268_toshiba_verbs },
13160 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13161 .dac_nids = alc268_dac_nids,
13162 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13163 .adc_nids = alc268_adc_nids_alt,
13164 .capsrc_nids = alc268_capsrc_nids,
13166 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13167 .channel_mode = alc268_modes,
13168 .input_mux = &alc268_capture_source,
13169 .unsol_event = alc268_toshiba_unsol_event,
13170 .setup = alc268_toshiba_setup,
13171 .init_hook = alc268_toshiba_automute,
13174 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13175 alc268_beep_mixer },
13176 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13177 alc268_acer_verbs },
13178 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13179 .dac_nids = alc268_dac_nids,
13180 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13181 .adc_nids = alc268_adc_nids_alt,
13182 .capsrc_nids = alc268_capsrc_nids,
13184 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13185 .channel_mode = alc268_modes,
13186 .input_mux = &alc268_acer_capture_source,
13187 .unsol_event = alc268_acer_unsol_event,
13188 .init_hook = alc268_acer_init_hook,
13190 [ALC268_ACER_DMIC] = {
13191 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13192 alc268_beep_mixer },
13193 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13194 alc268_acer_verbs },
13195 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13196 .dac_nids = alc268_dac_nids,
13197 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13198 .adc_nids = alc268_adc_nids_alt,
13199 .capsrc_nids = alc268_capsrc_nids,
13201 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13202 .channel_mode = alc268_modes,
13203 .input_mux = &alc268_acer_dmic_capture_source,
13204 .unsol_event = alc268_acer_unsol_event,
13205 .init_hook = alc268_acer_init_hook,
13207 [ALC268_ACER_ASPIRE_ONE] = {
13208 .mixers = { alc268_acer_aspire_one_mixer,
13210 alc268_capture_nosrc_mixer },
13211 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13212 alc268_acer_aspire_one_verbs },
13213 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13214 .dac_nids = alc268_dac_nids,
13215 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13216 .adc_nids = alc268_adc_nids_alt,
13217 .capsrc_nids = alc268_capsrc_nids,
13219 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13220 .channel_mode = alc268_modes,
13221 .unsol_event = alc268_acer_lc_unsol_event,
13222 .setup = alc268_acer_lc_setup,
13223 .init_hook = alc268_acer_lc_init_hook,
13226 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13227 alc268_capture_nosrc_mixer },
13228 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13229 alc268_dell_verbs },
13230 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13231 .dac_nids = alc268_dac_nids,
13232 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13233 .adc_nids = alc268_adc_nids_alt,
13234 .capsrc_nids = alc268_capsrc_nids,
13236 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13237 .channel_mode = alc268_modes,
13238 .unsol_event = alc_sku_unsol_event,
13239 .setup = alc268_dell_setup,
13240 .init_hook = alc_inithook,
13243 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13244 alc268_beep_mixer },
13245 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13246 alc268_toshiba_verbs },
13247 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13248 .dac_nids = alc268_dac_nids,
13249 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13250 .adc_nids = alc268_adc_nids_alt,
13251 .capsrc_nids = alc268_capsrc_nids,
13253 .dig_out_nid = ALC268_DIGOUT_NID,
13254 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13255 .channel_mode = alc268_modes,
13256 .input_mux = &alc268_capture_source,
13257 .setup = alc268_toshiba_setup,
13258 .init_hook = alc268_toshiba_automute,
13260 #ifdef CONFIG_SND_DEBUG
13262 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13263 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13264 alc268_volume_init_verbs },
13265 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13266 .dac_nids = alc268_dac_nids,
13267 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13268 .adc_nids = alc268_adc_nids_alt,
13269 .capsrc_nids = alc268_capsrc_nids,
13271 .dig_out_nid = ALC268_DIGOUT_NID,
13272 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13273 .channel_mode = alc268_modes,
13274 .input_mux = &alc268_capture_source,
13279 static int patch_alc268(struct hda_codec *codec)
13281 struct alc_spec *spec;
13283 int i, has_beep, err;
13285 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13289 codec->spec = spec;
13291 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13295 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13296 board_config = snd_hda_check_board_codec_sid_config(codec,
13297 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13299 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13300 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13302 board_config = ALC268_AUTO;
13305 if (board_config == ALC268_AUTO) {
13306 /* automatic parse from the BIOS config */
13307 err = alc268_parse_auto_config(codec);
13313 "hda_codec: Cannot set up configuration "
13314 "from BIOS. Using base mode...\n");
13315 board_config = ALC268_3ST;
13319 if (board_config != ALC268_AUTO)
13320 setup_preset(codec, &alc268_presets[board_config]);
13322 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13323 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13324 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13326 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13329 for (i = 0; i < spec->num_mixers; i++) {
13330 if (spec->mixers[i] == alc268_beep_mixer) {
13337 err = snd_hda_attach_beep_device(codec, 0x1);
13342 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13343 /* override the amp caps for beep generator */
13344 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13345 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13346 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13347 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13348 (0 << AC_AMPCAP_MUTE_SHIFT));
13351 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13352 /* check whether NID 0x07 is valid */
13353 unsigned int wcap = get_wcaps(codec, 0x07);
13356 spec->capsrc_nids = alc268_capsrc_nids;
13358 wcap = get_wcaps_type(wcap);
13359 if (spec->auto_mic ||
13360 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13361 spec->adc_nids = alc268_adc_nids_alt;
13362 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13363 if (spec->auto_mic)
13364 fixup_automic_adc(codec);
13365 if (spec->auto_mic || spec->input_mux->num_items == 1)
13366 add_mixer(spec, alc268_capture_nosrc_mixer);
13368 add_mixer(spec, alc268_capture_alt_mixer);
13370 spec->adc_nids = alc268_adc_nids;
13371 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13372 add_mixer(spec, alc268_capture_mixer);
13374 /* set default input source */
13375 for (i = 0; i < spec->num_adc_nids; i++)
13376 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13377 0, AC_VERB_SET_CONNECT_SEL,
13378 i < spec->num_mux_defs ?
13379 spec->input_mux[i].items[0].index :
13380 spec->input_mux->items[0].index);
13383 spec->vmaster_nid = 0x02;
13385 codec->patch_ops = alc_patch_ops;
13386 if (board_config == ALC268_AUTO)
13387 spec->init_hook = alc268_auto_init;
13393 * ALC269 channel source setting (2 channel)
13395 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13397 #define alc269_dac_nids alc260_dac_nids
13399 static hda_nid_t alc269_adc_nids[1] = {
13404 static hda_nid_t alc269_capsrc_nids[1] = {
13408 static hda_nid_t alc269vb_adc_nids[1] = {
13413 static hda_nid_t alc269vb_capsrc_nids[1] = {
13417 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13421 #define alc269_modes alc260_modes
13422 #define alc269_capture_source alc880_lg_lw_capture_source
13424 static struct snd_kcontrol_new alc269_base_mixer[] = {
13425 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13426 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13427 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13428 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13429 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13430 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13431 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13432 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13433 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13434 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13435 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13436 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13440 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13441 /* output mixer control */
13442 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13444 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13445 .name = "Master Playback Switch",
13446 .subdevice = HDA_SUBDEV_AMP_FLAG,
13447 .info = snd_hda_mixer_amp_switch_info,
13448 .get = snd_hda_mixer_amp_switch_get,
13449 .put = alc268_acer_master_sw_put,
13450 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13452 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13453 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13454 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13455 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13456 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13457 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13461 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13462 /* output mixer control */
13463 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13465 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13466 .name = "Master Playback Switch",
13467 .subdevice = HDA_SUBDEV_AMP_FLAG,
13468 .info = snd_hda_mixer_amp_switch_info,
13469 .get = snd_hda_mixer_amp_switch_get,
13470 .put = alc268_acer_master_sw_put,
13471 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13473 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13475 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13476 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13477 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13478 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13479 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13480 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13481 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13485 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13486 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13487 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13488 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13489 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13493 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13494 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13495 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13496 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13497 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13501 /* capture mixer elements */
13502 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13503 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13504 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13505 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13506 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13510 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13511 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13512 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13513 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13517 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13518 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13519 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13520 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13521 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13525 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13526 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13527 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13528 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13533 #define alc269_fujitsu_mixer alc269_laptop_mixer
13535 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13536 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13537 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13539 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13540 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13541 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13545 static struct hda_verb alc269_lifebook_verbs[] = {
13546 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13547 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13548 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13549 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13550 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13551 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13552 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13553 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13554 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13555 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13559 /* toggle speaker-output according to the hp-jack state */
13560 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13562 unsigned int present;
13563 unsigned char bits;
13565 present = snd_hda_jack_detect(codec, 0x15);
13566 bits = present ? AMP_IN_MUTE(0) : 0;
13567 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13568 AMP_IN_MUTE(0), bits);
13569 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13570 AMP_IN_MUTE(0), bits);
13572 snd_hda_codec_write(codec, 0x20, 0,
13573 AC_VERB_SET_COEF_INDEX, 0x0c);
13574 snd_hda_codec_write(codec, 0x20, 0,
13575 AC_VERB_SET_PROC_COEF, 0x680);
13577 snd_hda_codec_write(codec, 0x20, 0,
13578 AC_VERB_SET_COEF_INDEX, 0x0c);
13579 snd_hda_codec_write(codec, 0x20, 0,
13580 AC_VERB_SET_PROC_COEF, 0x480);
13583 /* toggle speaker-output according to the hp-jacks state */
13584 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13586 unsigned int present;
13587 unsigned char bits;
13589 /* Check laptop headphone socket */
13590 present = snd_hda_jack_detect(codec, 0x15);
13592 /* Check port replicator headphone socket */
13593 present |= snd_hda_jack_detect(codec, 0x1a);
13595 bits = present ? AMP_IN_MUTE(0) : 0;
13596 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13597 AMP_IN_MUTE(0), bits);
13598 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13599 AMP_IN_MUTE(0), bits);
13601 snd_hda_codec_write(codec, 0x20, 0,
13602 AC_VERB_SET_COEF_INDEX, 0x0c);
13603 snd_hda_codec_write(codec, 0x20, 0,
13604 AC_VERB_SET_PROC_COEF, 0x680);
13606 snd_hda_codec_write(codec, 0x20, 0,
13607 AC_VERB_SET_COEF_INDEX, 0x0c);
13608 snd_hda_codec_write(codec, 0x20, 0,
13609 AC_VERB_SET_PROC_COEF, 0x480);
13612 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13614 unsigned int present_laptop;
13615 unsigned int present_dock;
13617 present_laptop = snd_hda_jack_detect(codec, 0x18);
13618 present_dock = snd_hda_jack_detect(codec, 0x1b);
13620 /* Laptop mic port overrides dock mic port, design decision */
13622 snd_hda_codec_write(codec, 0x23, 0,
13623 AC_VERB_SET_CONNECT_SEL, 0x3);
13624 if (present_laptop)
13625 snd_hda_codec_write(codec, 0x23, 0,
13626 AC_VERB_SET_CONNECT_SEL, 0x0);
13627 if (!present_dock && !present_laptop)
13628 snd_hda_codec_write(codec, 0x23, 0,
13629 AC_VERB_SET_CONNECT_SEL, 0x1);
13632 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13635 switch (res >> 26) {
13636 case ALC880_HP_EVENT:
13637 alc269_quanta_fl1_speaker_automute(codec);
13639 case ALC880_MIC_EVENT:
13640 alc_mic_automute(codec);
13645 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13648 if ((res >> 26) == ALC880_HP_EVENT)
13649 alc269_lifebook_speaker_automute(codec);
13650 if ((res >> 26) == ALC880_MIC_EVENT)
13651 alc269_lifebook_mic_autoswitch(codec);
13654 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13656 struct alc_spec *spec = codec->spec;
13657 spec->autocfg.hp_pins[0] = 0x15;
13658 spec->autocfg.speaker_pins[0] = 0x14;
13659 spec->ext_mic.pin = 0x18;
13660 spec->ext_mic.mux_idx = 0;
13661 spec->int_mic.pin = 0x19;
13662 spec->int_mic.mux_idx = 1;
13663 spec->auto_mic = 1;
13666 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13668 alc269_quanta_fl1_speaker_automute(codec);
13669 alc_mic_automute(codec);
13672 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13674 alc269_lifebook_speaker_automute(codec);
13675 alc269_lifebook_mic_autoswitch(codec);
13678 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13679 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13680 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13681 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13683 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13684 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13685 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13689 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13690 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13691 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13692 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13693 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13694 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13695 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13699 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13700 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13701 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13702 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13703 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13704 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13705 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13706 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13710 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13711 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13712 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13713 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13714 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13715 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13716 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13717 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13721 /* toggle speaker-output according to the hp-jack state */
13722 static void alc269_speaker_automute(struct hda_codec *codec)
13724 struct alc_spec *spec = codec->spec;
13725 unsigned int nid = spec->autocfg.hp_pins[0];
13726 unsigned int present;
13727 unsigned char bits;
13729 present = snd_hda_jack_detect(codec, nid);
13730 bits = present ? AMP_IN_MUTE(0) : 0;
13731 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13732 AMP_IN_MUTE(0), bits);
13733 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13734 AMP_IN_MUTE(0), bits);
13737 /* unsolicited event for HP jack sensing */
13738 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13741 switch (res >> 26) {
13742 case ALC880_HP_EVENT:
13743 alc269_speaker_automute(codec);
13745 case ALC880_MIC_EVENT:
13746 alc_mic_automute(codec);
13751 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13753 struct alc_spec *spec = codec->spec;
13754 spec->autocfg.hp_pins[0] = 0x15;
13755 spec->autocfg.speaker_pins[0] = 0x14;
13756 spec->ext_mic.pin = 0x18;
13757 spec->ext_mic.mux_idx = 0;
13758 spec->int_mic.pin = 0x12;
13759 spec->int_mic.mux_idx = 5;
13760 spec->auto_mic = 1;
13763 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13765 struct alc_spec *spec = codec->spec;
13766 spec->autocfg.hp_pins[0] = 0x15;
13767 spec->autocfg.speaker_pins[0] = 0x14;
13768 spec->ext_mic.pin = 0x18;
13769 spec->ext_mic.mux_idx = 0;
13770 spec->int_mic.pin = 0x12;
13771 spec->int_mic.mux_idx = 6;
13772 spec->auto_mic = 1;
13775 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13777 struct alc_spec *spec = codec->spec;
13778 spec->autocfg.hp_pins[0] = 0x15;
13779 spec->autocfg.speaker_pins[0] = 0x14;
13780 spec->ext_mic.pin = 0x18;
13781 spec->ext_mic.mux_idx = 0;
13782 spec->int_mic.pin = 0x19;
13783 spec->int_mic.mux_idx = 1;
13784 spec->auto_mic = 1;
13787 static void alc269_laptop_inithook(struct hda_codec *codec)
13789 alc269_speaker_automute(codec);
13790 alc_mic_automute(codec);
13794 * generic initialization of ADC, input mixers and output mixers
13796 static struct hda_verb alc269_init_verbs[] = {
13798 * Unmute ADC0 and set the default input to mic-in
13800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13803 * Set up output mixers (0x02 - 0x03)
13805 /* set vol=0 to output mixers */
13806 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13807 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13809 /* set up input amps for analog loopback */
13810 /* Amp Indices: DAC = 0, mixer = 1 */
13811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13816 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13818 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13820 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13821 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13822 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13823 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13826 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13829 /* FIXME: use Mux-type input source selection */
13830 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13831 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13832 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13835 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13839 static struct hda_verb alc269vb_init_verbs[] = {
13841 * Unmute ADC0 and set the default input to mic-in
13843 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13846 * Set up output mixers (0x02 - 0x03)
13848 /* set vol=0 to output mixers */
13849 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13850 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13852 /* set up input amps for analog loopback */
13853 /* Amp Indices: DAC = 0, mixer = 1 */
13854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13855 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13856 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13857 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13858 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13859 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13861 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13862 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13863 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13864 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13865 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13866 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13869 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13870 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13872 /* FIXME: use Mux-type input source selection */
13873 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13874 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13875 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13878 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13882 #define alc269_auto_create_multi_out_ctls \
13883 alc268_auto_create_multi_out_ctls
13884 #define alc269_auto_create_input_ctls \
13885 alc268_auto_create_input_ctls
13887 #ifdef CONFIG_SND_HDA_POWER_SAVE
13888 #define alc269_loopbacks alc880_loopbacks
13891 /* pcm configuration: identical with ALC880 */
13892 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13893 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13894 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13895 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13897 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13901 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13902 /* NID is set in alc_build_pcms */
13904 .open = alc880_playback_pcm_open,
13905 .prepare = alc880_playback_pcm_prepare,
13906 .cleanup = alc880_playback_pcm_cleanup
13910 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13914 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13915 /* NID is set in alc_build_pcms */
13919 * BIOS auto configuration
13921 static int alc269_parse_auto_config(struct hda_codec *codec)
13923 struct alc_spec *spec = codec->spec;
13925 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13926 hda_nid_t real_capsrc_nids;
13928 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13933 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13936 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13940 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13942 if (spec->autocfg.dig_outs)
13943 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13945 if (spec->kctls.list)
13946 add_mixer(spec, spec->kctls.list);
13948 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
13949 add_verb(spec, alc269vb_init_verbs);
13950 real_capsrc_nids = alc269vb_capsrc_nids[0];
13951 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
13953 add_verb(spec, alc269_init_verbs);
13954 real_capsrc_nids = alc269_capsrc_nids[0];
13955 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13958 spec->num_mux_defs = 1;
13959 spec->input_mux = &spec->private_imux[0];
13960 /* set default input source */
13961 snd_hda_codec_write_cache(codec, real_capsrc_nids,
13962 0, AC_VERB_SET_CONNECT_SEL,
13963 spec->input_mux->items[0].index);
13965 err = alc_auto_add_mic_boost(codec);
13969 if (!spec->cap_mixer && !spec->no_analog)
13970 set_capture_mixer(codec);
13975 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13976 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13977 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13980 /* init callback for auto-configuration model -- overriding the default init */
13981 static void alc269_auto_init(struct hda_codec *codec)
13983 struct alc_spec *spec = codec->spec;
13984 alc269_auto_init_multi_out(codec);
13985 alc269_auto_init_hp_out(codec);
13986 alc269_auto_init_analog_input(codec);
13987 if (spec->unsol_event)
13988 alc_inithook(codec);
13992 * configuration and preset
13994 static const char *alc269_models[ALC269_MODEL_LAST] = {
13995 [ALC269_BASIC] = "basic",
13996 [ALC269_QUANTA_FL1] = "quanta",
13997 [ALC269_AMIC] = "laptop-amic",
13998 [ALC269_DMIC] = "laptop-dmic",
13999 [ALC269_FUJITSU] = "fujitsu",
14000 [ALC269_LIFEBOOK] = "lifebook",
14001 [ALC269_AUTO] = "auto",
14004 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14005 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14006 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14008 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14009 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14010 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14011 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14012 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14013 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14014 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14015 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14016 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14017 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14018 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14019 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14020 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14021 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14022 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14023 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14024 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14025 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14026 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14027 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14028 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14029 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14030 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14031 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14032 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14033 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14034 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14035 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14036 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14037 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14038 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14039 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14040 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14041 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14042 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14043 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14044 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14046 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14048 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14049 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14050 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
14051 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14052 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14053 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14054 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14055 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14056 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14057 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14061 static struct alc_config_preset alc269_presets[] = {
14063 .mixers = { alc269_base_mixer },
14064 .init_verbs = { alc269_init_verbs },
14065 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14066 .dac_nids = alc269_dac_nids,
14068 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14069 .channel_mode = alc269_modes,
14070 .input_mux = &alc269_capture_source,
14072 [ALC269_QUANTA_FL1] = {
14073 .mixers = { alc269_quanta_fl1_mixer },
14074 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14075 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14076 .dac_nids = alc269_dac_nids,
14078 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14079 .channel_mode = alc269_modes,
14080 .input_mux = &alc269_capture_source,
14081 .unsol_event = alc269_quanta_fl1_unsol_event,
14082 .setup = alc269_quanta_fl1_setup,
14083 .init_hook = alc269_quanta_fl1_init_hook,
14086 .mixers = { alc269_laptop_mixer },
14087 .cap_mixer = alc269_laptop_analog_capture_mixer,
14088 .init_verbs = { alc269_init_verbs,
14089 alc269_laptop_amic_init_verbs },
14090 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14091 .dac_nids = alc269_dac_nids,
14093 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14094 .channel_mode = alc269_modes,
14095 .unsol_event = alc269_laptop_unsol_event,
14096 .setup = alc269_laptop_amic_setup,
14097 .init_hook = alc269_laptop_inithook,
14100 .mixers = { alc269_laptop_mixer },
14101 .cap_mixer = alc269_laptop_digital_capture_mixer,
14102 .init_verbs = { alc269_init_verbs,
14103 alc269_laptop_dmic_init_verbs },
14104 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14105 .dac_nids = alc269_dac_nids,
14107 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14108 .channel_mode = alc269_modes,
14109 .unsol_event = alc269_laptop_unsol_event,
14110 .setup = alc269_laptop_dmic_setup,
14111 .init_hook = alc269_laptop_inithook,
14113 [ALC269VB_AMIC] = {
14114 .mixers = { alc269vb_laptop_mixer },
14115 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14116 .init_verbs = { alc269vb_init_verbs,
14117 alc269vb_laptop_amic_init_verbs },
14118 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14119 .dac_nids = alc269_dac_nids,
14121 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14122 .channel_mode = alc269_modes,
14123 .unsol_event = alc269_laptop_unsol_event,
14124 .setup = alc269_laptop_amic_setup,
14125 .init_hook = alc269_laptop_inithook,
14127 [ALC269VB_DMIC] = {
14128 .mixers = { alc269vb_laptop_mixer },
14129 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14130 .init_verbs = { alc269vb_init_verbs,
14131 alc269vb_laptop_dmic_init_verbs },
14132 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14133 .dac_nids = alc269_dac_nids,
14135 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14136 .channel_mode = alc269_modes,
14137 .unsol_event = alc269_laptop_unsol_event,
14138 .setup = alc269vb_laptop_dmic_setup,
14139 .init_hook = alc269_laptop_inithook,
14141 [ALC269_FUJITSU] = {
14142 .mixers = { alc269_fujitsu_mixer },
14143 .cap_mixer = alc269_laptop_digital_capture_mixer,
14144 .init_verbs = { alc269_init_verbs,
14145 alc269_laptop_dmic_init_verbs },
14146 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14147 .dac_nids = alc269_dac_nids,
14149 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14150 .channel_mode = alc269_modes,
14151 .unsol_event = alc269_laptop_unsol_event,
14152 .setup = alc269_laptop_dmic_setup,
14153 .init_hook = alc269_laptop_inithook,
14155 [ALC269_LIFEBOOK] = {
14156 .mixers = { alc269_lifebook_mixer },
14157 .init_verbs = { alc269_init_verbs, alc269_lifebook_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 .input_mux = &alc269_capture_source,
14164 .unsol_event = alc269_lifebook_unsol_event,
14165 .init_hook = alc269_lifebook_init_hook,
14169 static int patch_alc269(struct hda_codec *codec)
14171 struct alc_spec *spec;
14174 int is_alc269vb = 0;
14176 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14180 codec->spec = spec;
14182 alc_auto_parse_customize_define(codec);
14184 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14185 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14186 spec->cdefine.platform_type == 1)
14187 alc_codec_rename(codec, "ALC271X");
14189 alc_codec_rename(codec, "ALC259");
14192 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14194 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14198 if (board_config < 0) {
14199 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14201 board_config = ALC269_AUTO;
14204 if (board_config == ALC269_AUTO) {
14205 /* automatic parse from the BIOS config */
14206 err = alc269_parse_auto_config(codec);
14212 "hda_codec: Cannot set up configuration "
14213 "from BIOS. Using base mode...\n");
14214 board_config = ALC269_BASIC;
14218 err = snd_hda_attach_beep_device(codec, 0x1);
14224 if (board_config != ALC269_AUTO)
14225 setup_preset(codec, &alc269_presets[board_config]);
14227 if (board_config == ALC269_QUANTA_FL1) {
14228 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14229 * fix the sample rate of analog I/O to 44.1kHz
14231 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14232 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14234 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14235 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14237 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14238 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14240 if (!is_alc269vb) {
14241 spec->adc_nids = alc269_adc_nids;
14242 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14243 spec->capsrc_nids = alc269_capsrc_nids;
14245 spec->adc_nids = alc269vb_adc_nids;
14246 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14247 spec->capsrc_nids = alc269vb_capsrc_nids;
14250 if (!spec->cap_mixer)
14251 set_capture_mixer(codec);
14252 if (spec->cdefine.enable_pcbeep)
14253 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14255 spec->vmaster_nid = 0x02;
14257 codec->patch_ops = alc_patch_ops;
14258 if (board_config == ALC269_AUTO)
14259 spec->init_hook = alc269_auto_init;
14260 #ifdef CONFIG_SND_HDA_POWER_SAVE
14261 if (!spec->loopback.amplist)
14262 spec->loopback.amplist = alc269_loopbacks;
14269 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14273 * set the path ways for 2 channel output
14274 * need to set the codec line out and mic 1 pin widgets to inputs
14276 static struct hda_verb alc861_threestack_ch2_init[] = {
14277 /* set pin widget 1Ah (line in) for input */
14278 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14279 /* set pin widget 18h (mic1/2) for input, for mic also enable
14282 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14284 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14286 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14287 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14293 * need to set the codec line out and mic 1 pin widgets to outputs
14295 static struct hda_verb alc861_threestack_ch6_init[] = {
14296 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14297 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14298 /* set pin widget 18h (mic1) for output (CLFE)*/
14299 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14301 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14302 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14304 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14306 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14307 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14312 static struct hda_channel_mode alc861_threestack_modes[2] = {
14313 { 2, alc861_threestack_ch2_init },
14314 { 6, alc861_threestack_ch6_init },
14316 /* Set mic1 as input and unmute the mixer */
14317 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14318 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14319 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14322 /* Set mic1 as output and mute mixer */
14323 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14324 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14325 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14329 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14330 { 2, alc861_uniwill_m31_ch2_init },
14331 { 4, alc861_uniwill_m31_ch4_init },
14334 /* Set mic1 and line-in as input and unmute the mixer */
14335 static struct hda_verb alc861_asus_ch2_init[] = {
14336 /* set pin widget 1Ah (line in) for input */
14337 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14338 /* set pin widget 18h (mic1/2) for input, for mic also enable
14341 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14343 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14345 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14346 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14350 /* Set mic1 nad line-in as output and mute mixer */
14351 static struct hda_verb alc861_asus_ch6_init[] = {
14352 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14353 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14354 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14355 /* set pin widget 18h (mic1) for output (CLFE)*/
14356 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14357 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14358 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14359 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14361 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14363 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14364 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14369 static struct hda_channel_mode alc861_asus_modes[2] = {
14370 { 2, alc861_asus_ch2_init },
14371 { 6, alc861_asus_ch6_init },
14376 static struct snd_kcontrol_new alc861_base_mixer[] = {
14377 /* output mixer control */
14378 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14379 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14380 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14381 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14382 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14384 /*Input mixer control */
14385 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14386 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14387 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14388 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14389 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14390 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14391 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14392 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14393 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14399 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14400 /* output mixer control */
14401 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14402 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14403 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14404 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14405 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14407 /* Input mixer control */
14408 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14409 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14410 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14411 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14412 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14413 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14414 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14415 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14416 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14417 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14420 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14421 .name = "Channel Mode",
14422 .info = alc_ch_mode_info,
14423 .get = alc_ch_mode_get,
14424 .put = alc_ch_mode_put,
14425 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14430 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14431 /* output mixer control */
14432 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14434 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14439 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14440 /* output mixer control */
14441 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14442 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14443 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14444 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14445 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14447 /* Input mixer control */
14448 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14449 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14450 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14451 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14452 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14453 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14455 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14456 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14457 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14460 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14461 .name = "Channel Mode",
14462 .info = alc_ch_mode_info,
14463 .get = alc_ch_mode_get,
14464 .put = alc_ch_mode_put,
14465 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14470 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14471 /* output mixer control */
14472 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14473 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14474 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14475 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14476 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14478 /* Input mixer control */
14479 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14480 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14481 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14482 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14483 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14484 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14486 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14487 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14488 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14491 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14492 .name = "Channel Mode",
14493 .info = alc_ch_mode_info,
14494 .get = alc_ch_mode_get,
14495 .put = alc_ch_mode_put,
14496 .private_value = ARRAY_SIZE(alc861_asus_modes),
14501 /* additional mixer */
14502 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14503 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14504 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14509 * generic initialization of ADC, input mixers and output mixers
14511 static struct hda_verb alc861_base_init_verbs[] = {
14513 * Unmute ADC0 and set the default input to mic-in
14515 /* port-A for surround (rear panel) */
14516 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14517 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14518 /* port-B for mic-in (rear panel) with vref */
14519 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14520 /* port-C for line-in (rear panel) */
14521 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14522 /* port-D for Front */
14523 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14524 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14525 /* port-E for HP out (front panel) */
14526 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14527 /* route front PCM to HP */
14528 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14529 /* port-F for mic-in (front panel) with vref */
14530 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14531 /* port-G for CLFE (rear panel) */
14532 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14533 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14534 /* port-H for side (rear panel) */
14535 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14536 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14538 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14539 /* route front mic to ADC1*/
14540 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14541 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14543 /* Unmute DAC0~3 & spdif out*/
14544 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14545 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14546 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14547 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14550 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14551 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14552 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14553 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14554 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14556 /* Unmute Stereo Mixer 15 */
14557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14560 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14562 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14563 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14564 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14565 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14566 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14567 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14568 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14569 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14570 /* hp used DAC 3 (Front) */
14571 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14572 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14577 static struct hda_verb alc861_threestack_init_verbs[] = {
14579 * Unmute ADC0 and set the default input to mic-in
14581 /* port-A for surround (rear panel) */
14582 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14583 /* port-B for mic-in (rear panel) with vref */
14584 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14585 /* port-C for line-in (rear panel) */
14586 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14587 /* port-D for Front */
14588 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14589 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14590 /* port-E for HP out (front panel) */
14591 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14592 /* route front PCM to HP */
14593 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14594 /* port-F for mic-in (front panel) with vref */
14595 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14596 /* port-G for CLFE (rear panel) */
14597 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14598 /* port-H for side (rear panel) */
14599 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14601 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14602 /* route front mic to ADC1*/
14603 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14604 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14605 /* Unmute DAC0~3 & spdif out*/
14606 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14607 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14608 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14609 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14612 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14613 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14614 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14615 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14616 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14618 /* Unmute Stereo Mixer 15 */
14619 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14620 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14621 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14624 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14625 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14626 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14627 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14628 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14629 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14630 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14631 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14632 /* hp used DAC 3 (Front) */
14633 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14634 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14638 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14640 * Unmute ADC0 and set the default input to mic-in
14642 /* port-A for surround (rear panel) */
14643 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14644 /* port-B for mic-in (rear panel) with vref */
14645 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14646 /* port-C for line-in (rear panel) */
14647 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14648 /* port-D for Front */
14649 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14650 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14651 /* port-E for HP out (front panel) */
14652 /* this has to be set to VREF80 */
14653 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14654 /* route front PCM to HP */
14655 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14656 /* port-F for mic-in (front panel) with vref */
14657 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14658 /* port-G for CLFE (rear panel) */
14659 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14660 /* port-H for side (rear panel) */
14661 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14663 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14664 /* route front mic to ADC1*/
14665 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14666 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14667 /* Unmute DAC0~3 & spdif out*/
14668 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14669 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14670 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14671 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14674 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14675 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14676 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14677 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14678 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14680 /* Unmute Stereo Mixer 15 */
14681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14682 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14686 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14687 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14688 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14689 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14690 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14692 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14693 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14694 /* hp used DAC 3 (Front) */
14695 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14696 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14700 static struct hda_verb alc861_asus_init_verbs[] = {
14702 * Unmute ADC0 and set the default input to mic-in
14704 /* port-A for surround (rear panel)
14705 * according to codec#0 this is the HP jack
14707 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14708 /* route front PCM to HP */
14709 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14710 /* port-B for mic-in (rear panel) with vref */
14711 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14712 /* port-C for line-in (rear panel) */
14713 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14714 /* port-D for Front */
14715 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14716 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14717 /* port-E for HP out (front panel) */
14718 /* this has to be set to VREF80 */
14719 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14720 /* route front PCM to HP */
14721 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14722 /* port-F for mic-in (front panel) with vref */
14723 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14724 /* port-G for CLFE (rear panel) */
14725 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14726 /* port-H for side (rear panel) */
14727 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14729 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14730 /* route front mic to ADC1*/
14731 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14733 /* Unmute DAC0~3 & spdif out*/
14734 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14735 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14736 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14737 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14739 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14740 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14741 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14742 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14743 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14745 /* Unmute Stereo Mixer 15 */
14746 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14747 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14749 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14751 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14752 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14753 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14754 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14755 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14756 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14757 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14758 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14759 /* hp used DAC 3 (Front) */
14760 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14761 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14765 /* additional init verbs for ASUS laptops */
14766 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14767 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14768 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14773 * generic initialization of ADC, input mixers and output mixers
14775 static struct hda_verb alc861_auto_init_verbs[] = {
14777 * Unmute ADC0 and set the default input to mic-in
14779 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14780 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14782 /* Unmute DAC0~3 & spdif out*/
14783 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14784 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14785 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14786 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14787 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14789 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14790 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14791 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14792 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14793 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14795 /* Unmute Stereo Mixer 15 */
14796 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14797 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14798 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14801 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14802 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14803 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14804 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14805 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14806 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14807 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14810 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14811 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14812 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14813 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14814 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14815 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14816 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14817 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14819 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14824 static struct hda_verb alc861_toshiba_init_verbs[] = {
14825 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14830 /* toggle speaker-output according to the hp-jack state */
14831 static void alc861_toshiba_automute(struct hda_codec *codec)
14833 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14835 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14836 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14837 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14838 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14841 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14844 if ((res >> 26) == ALC880_HP_EVENT)
14845 alc861_toshiba_automute(codec);
14848 /* pcm configuration: identical with ALC880 */
14849 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14850 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14851 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14852 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14855 #define ALC861_DIGOUT_NID 0x07
14857 static struct hda_channel_mode alc861_8ch_modes[1] = {
14861 static hda_nid_t alc861_dac_nids[4] = {
14862 /* front, surround, clfe, side */
14863 0x03, 0x06, 0x05, 0x04
14866 static hda_nid_t alc660_dac_nids[3] = {
14867 /* front, clfe, surround */
14871 static hda_nid_t alc861_adc_nids[1] = {
14876 static struct hda_input_mux alc861_capture_source = {
14880 { "Front Mic", 0x3 },
14887 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14889 struct alc_spec *spec = codec->spec;
14890 hda_nid_t mix, srcs[5];
14893 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14895 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14898 for (i = 0; i < num; i++) {
14900 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14901 if (type != AC_WID_AUD_OUT)
14903 for (j = 0; j < spec->multiout.num_dacs; j++)
14904 if (spec->multiout.dac_nids[j] == srcs[i])
14906 if (j >= spec->multiout.num_dacs)
14912 /* fill in the dac_nids table from the parsed pin configuration */
14913 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14914 const struct auto_pin_cfg *cfg)
14916 struct alc_spec *spec = codec->spec;
14918 hda_nid_t nid, dac;
14920 spec->multiout.dac_nids = spec->private_dac_nids;
14921 for (i = 0; i < cfg->line_outs; i++) {
14922 nid = cfg->line_out_pins[i];
14923 dac = alc861_look_for_dac(codec, nid);
14926 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14931 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14932 hda_nid_t nid, unsigned int chs)
14934 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14935 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14938 /* add playback controls from the parsed DAC table */
14939 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14940 const struct auto_pin_cfg *cfg)
14942 struct alc_spec *spec = codec->spec;
14943 static const char *chname[4] = {
14944 "Front", "Surround", NULL /*CLFE*/, "Side"
14949 if (cfg->line_outs == 1) {
14950 const char *pfx = NULL;
14953 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14956 nid = spec->multiout.dac_nids[0];
14957 return alc861_create_out_sw(codec, pfx, nid, 3);
14961 for (i = 0; i < cfg->line_outs; i++) {
14962 nid = spec->multiout.dac_nids[i];
14967 err = alc861_create_out_sw(codec, "Center", nid, 1);
14970 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14974 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14982 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14984 struct alc_spec *spec = codec->spec;
14991 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14992 nid = alc861_look_for_dac(codec, pin);
14994 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14997 spec->multiout.hp_nid = nid;
15003 /* create playback/capture controls for input pins */
15004 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15005 const struct auto_pin_cfg *cfg)
15007 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15010 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15012 int pin_type, hda_nid_t dac)
15014 hda_nid_t mix, srcs[5];
15017 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15019 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15021 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15023 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15026 for (i = 0; i < num; i++) {
15028 if (srcs[i] == dac || srcs[i] == 0x15)
15029 mute = AMP_IN_UNMUTE(i);
15031 mute = AMP_IN_MUTE(i);
15032 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15037 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15039 struct alc_spec *spec = codec->spec;
15042 for (i = 0; i < spec->autocfg.line_outs; i++) {
15043 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15044 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15046 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15047 spec->multiout.dac_nids[i]);
15051 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15053 struct alc_spec *spec = codec->spec;
15055 if (spec->autocfg.hp_outs)
15056 alc861_auto_set_output_and_unmute(codec,
15057 spec->autocfg.hp_pins[0],
15059 spec->multiout.hp_nid);
15060 if (spec->autocfg.speaker_outs)
15061 alc861_auto_set_output_and_unmute(codec,
15062 spec->autocfg.speaker_pins[0],
15064 spec->multiout.dac_nids[0]);
15067 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15069 struct alc_spec *spec = codec->spec;
15072 for (i = 0; i < AUTO_PIN_LAST; i++) {
15073 hda_nid_t nid = spec->autocfg.input_pins[i];
15074 if (nid >= 0x0c && nid <= 0x11)
15075 alc_set_input_pin(codec, nid, i);
15079 /* parse the BIOS configuration and set up the alc_spec */
15080 /* return 1 if successful, 0 if the proper config is not found,
15081 * or a negative error code
15083 static int alc861_parse_auto_config(struct hda_codec *codec)
15085 struct alc_spec *spec = codec->spec;
15087 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15089 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15093 if (!spec->autocfg.line_outs)
15094 return 0; /* can't find valid BIOS pin config */
15096 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15099 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15102 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15105 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15109 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15111 if (spec->autocfg.dig_outs)
15112 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15114 if (spec->kctls.list)
15115 add_mixer(spec, spec->kctls.list);
15117 add_verb(spec, alc861_auto_init_verbs);
15119 spec->num_mux_defs = 1;
15120 spec->input_mux = &spec->private_imux[0];
15122 spec->adc_nids = alc861_adc_nids;
15123 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15124 set_capture_mixer(codec);
15126 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15131 /* additional initialization for auto-configuration model */
15132 static void alc861_auto_init(struct hda_codec *codec)
15134 struct alc_spec *spec = codec->spec;
15135 alc861_auto_init_multi_out(codec);
15136 alc861_auto_init_hp_out(codec);
15137 alc861_auto_init_analog_input(codec);
15138 if (spec->unsol_event)
15139 alc_inithook(codec);
15142 #ifdef CONFIG_SND_HDA_POWER_SAVE
15143 static struct hda_amp_list alc861_loopbacks[] = {
15144 { 0x15, HDA_INPUT, 0 },
15145 { 0x15, HDA_INPUT, 1 },
15146 { 0x15, HDA_INPUT, 2 },
15147 { 0x15, HDA_INPUT, 3 },
15154 * configuration and preset
15156 static const char *alc861_models[ALC861_MODEL_LAST] = {
15157 [ALC861_3ST] = "3stack",
15158 [ALC660_3ST] = "3stack-660",
15159 [ALC861_3ST_DIG] = "3stack-dig",
15160 [ALC861_6ST_DIG] = "6stack-dig",
15161 [ALC861_UNIWILL_M31] = "uniwill-m31",
15162 [ALC861_TOSHIBA] = "toshiba",
15163 [ALC861_ASUS] = "asus",
15164 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15165 [ALC861_AUTO] = "auto",
15168 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15169 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15170 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15171 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15172 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15173 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15174 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15175 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15176 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15177 * Any other models that need this preset?
15179 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15180 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15181 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15182 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15183 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15184 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15185 /* FIXME: the below seems conflict */
15186 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15187 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15188 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15192 static struct alc_config_preset alc861_presets[] = {
15194 .mixers = { alc861_3ST_mixer },
15195 .init_verbs = { alc861_threestack_init_verbs },
15196 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15197 .dac_nids = alc861_dac_nids,
15198 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15199 .channel_mode = alc861_threestack_modes,
15201 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15202 .adc_nids = alc861_adc_nids,
15203 .input_mux = &alc861_capture_source,
15205 [ALC861_3ST_DIG] = {
15206 .mixers = { alc861_base_mixer },
15207 .init_verbs = { alc861_threestack_init_verbs },
15208 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15209 .dac_nids = alc861_dac_nids,
15210 .dig_out_nid = ALC861_DIGOUT_NID,
15211 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15212 .channel_mode = alc861_threestack_modes,
15214 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15215 .adc_nids = alc861_adc_nids,
15216 .input_mux = &alc861_capture_source,
15218 [ALC861_6ST_DIG] = {
15219 .mixers = { alc861_base_mixer },
15220 .init_verbs = { alc861_base_init_verbs },
15221 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15222 .dac_nids = alc861_dac_nids,
15223 .dig_out_nid = ALC861_DIGOUT_NID,
15224 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15225 .channel_mode = alc861_8ch_modes,
15226 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15227 .adc_nids = alc861_adc_nids,
15228 .input_mux = &alc861_capture_source,
15231 .mixers = { alc861_3ST_mixer },
15232 .init_verbs = { alc861_threestack_init_verbs },
15233 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15234 .dac_nids = alc660_dac_nids,
15235 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15236 .channel_mode = alc861_threestack_modes,
15238 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15239 .adc_nids = alc861_adc_nids,
15240 .input_mux = &alc861_capture_source,
15242 [ALC861_UNIWILL_M31] = {
15243 .mixers = { alc861_uniwill_m31_mixer },
15244 .init_verbs = { alc861_uniwill_m31_init_verbs },
15245 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15246 .dac_nids = alc861_dac_nids,
15247 .dig_out_nid = ALC861_DIGOUT_NID,
15248 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15249 .channel_mode = alc861_uniwill_m31_modes,
15251 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15252 .adc_nids = alc861_adc_nids,
15253 .input_mux = &alc861_capture_source,
15255 [ALC861_TOSHIBA] = {
15256 .mixers = { alc861_toshiba_mixer },
15257 .init_verbs = { alc861_base_init_verbs,
15258 alc861_toshiba_init_verbs },
15259 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15260 .dac_nids = alc861_dac_nids,
15261 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15262 .channel_mode = alc883_3ST_2ch_modes,
15263 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15264 .adc_nids = alc861_adc_nids,
15265 .input_mux = &alc861_capture_source,
15266 .unsol_event = alc861_toshiba_unsol_event,
15267 .init_hook = alc861_toshiba_automute,
15270 .mixers = { alc861_asus_mixer },
15271 .init_verbs = { alc861_asus_init_verbs },
15272 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15273 .dac_nids = alc861_dac_nids,
15274 .dig_out_nid = ALC861_DIGOUT_NID,
15275 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15276 .channel_mode = alc861_asus_modes,
15279 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15280 .adc_nids = alc861_adc_nids,
15281 .input_mux = &alc861_capture_source,
15283 [ALC861_ASUS_LAPTOP] = {
15284 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15285 .init_verbs = { alc861_asus_init_verbs,
15286 alc861_asus_laptop_init_verbs },
15287 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15288 .dac_nids = alc861_dac_nids,
15289 .dig_out_nid = ALC861_DIGOUT_NID,
15290 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15291 .channel_mode = alc883_3ST_2ch_modes,
15293 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15294 .adc_nids = alc861_adc_nids,
15295 .input_mux = &alc861_capture_source,
15299 /* Pin config fixes */
15301 PINFIX_FSC_AMILO_PI1505,
15304 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15305 { 0x0b, 0x0221101f }, /* HP */
15306 { 0x0f, 0x90170310 }, /* speaker */
15310 static const struct alc_fixup alc861_fixups[] = {
15311 [PINFIX_FSC_AMILO_PI1505] = {
15312 .pins = alc861_fsc_amilo_pi1505_pinfix
15316 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15317 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15321 static int patch_alc861(struct hda_codec *codec)
15323 struct alc_spec *spec;
15327 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15331 codec->spec = spec;
15333 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15337 if (board_config < 0) {
15338 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15340 board_config = ALC861_AUTO;
15343 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15345 if (board_config == ALC861_AUTO) {
15346 /* automatic parse from the BIOS config */
15347 err = alc861_parse_auto_config(codec);
15353 "hda_codec: Cannot set up configuration "
15354 "from BIOS. Using base mode...\n");
15355 board_config = ALC861_3ST_DIG;
15359 err = snd_hda_attach_beep_device(codec, 0x23);
15365 if (board_config != ALC861_AUTO)
15366 setup_preset(codec, &alc861_presets[board_config]);
15368 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15369 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15371 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15372 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15374 if (!spec->cap_mixer)
15375 set_capture_mixer(codec);
15376 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15378 spec->vmaster_nid = 0x03;
15380 codec->patch_ops = alc_patch_ops;
15381 if (board_config == ALC861_AUTO) {
15382 spec->init_hook = alc861_auto_init;
15383 #ifdef CONFIG_SND_HDA_POWER_SAVE
15384 spec->power_hook = alc_power_eapd;
15387 #ifdef CONFIG_SND_HDA_POWER_SAVE
15388 if (!spec->loopback.amplist)
15389 spec->loopback.amplist = alc861_loopbacks;
15396 * ALC861-VD support
15400 * In addition, an independent DAC
15402 #define ALC861VD_DIGOUT_NID 0x06
15404 static hda_nid_t alc861vd_dac_nids[4] = {
15405 /* front, surr, clfe, side surr */
15406 0x02, 0x03, 0x04, 0x05
15409 /* dac_nids for ALC660vd are in a different order - according to
15410 * Realtek's driver.
15411 * This should probably result in a different mixer for 6stack models
15412 * of ALC660vd codecs, but for now there is only 3stack mixer
15413 * - and it is the same as in 861vd.
15414 * adc_nids in ALC660vd are (is) the same as in 861vd
15416 static hda_nid_t alc660vd_dac_nids[3] = {
15417 /* front, rear, clfe, rear_surr */
15421 static hda_nid_t alc861vd_adc_nids[1] = {
15426 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15429 /* FIXME: should be a matrix-type input source selection */
15430 static struct hda_input_mux alc861vd_capture_source = {
15434 { "Front Mic", 0x1 },
15440 static struct hda_input_mux alc861vd_dallas_capture_source = {
15443 { "Ext Mic", 0x0 },
15444 { "Int Mic", 0x1 },
15448 static struct hda_input_mux alc861vd_hp_capture_source = {
15451 { "Front Mic", 0x0 },
15452 { "ATAPI Mic", 0x1 },
15459 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15466 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15467 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15468 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15469 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15470 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15477 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15478 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15479 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15480 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15481 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15485 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15486 { 6, alc861vd_6stack_ch6_init },
15487 { 8, alc861vd_6stack_ch8_init },
15490 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15493 .name = "Channel Mode",
15494 .info = alc_ch_mode_info,
15495 .get = alc_ch_mode_get,
15496 .put = alc_ch_mode_put,
15501 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15502 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15504 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15505 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15506 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15508 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15509 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15511 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15513 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15515 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15516 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15518 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15519 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15523 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15527 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15528 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15529 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15531 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15532 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15534 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15535 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15540 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15541 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15542 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15546 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15548 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15550 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15551 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15552 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15554 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15555 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15557 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15558 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15563 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15564 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15565 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15566 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15568 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15570 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15571 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15572 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15574 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15575 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15576 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15578 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15579 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15584 /* Pin assignment: Speaker=0x14, HP = 0x15,
15585 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15587 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15588 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15589 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15590 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15591 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15592 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15593 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15594 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15595 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15596 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15597 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15601 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15602 * Front Mic=0x18, ATAPI Mic = 0x19,
15604 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15605 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15606 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15607 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15608 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15609 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15610 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15611 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15612 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15618 * generic initialization of ADC, input mixers and output mixers
15620 static struct hda_verb alc861vd_volume_init_verbs[] = {
15622 * Unmute ADC0 and set the default input to mic-in
15624 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15627 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15628 * the analog-loopback mixer widget
15630 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15631 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15633 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15635 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15637 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15638 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15644 * Set up output mixers (0x02 - 0x05)
15646 /* set vol=0 to output mixers */
15647 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15648 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15649 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15650 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15652 /* set up input amps for analog loopback */
15653 /* Amp Indices: DAC = 0, mixer = 1 */
15654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15656 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15658 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15659 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15660 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15661 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15667 * 3-stack pin configuration:
15668 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15670 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15672 * Set pin mode and muting
15674 /* set front pin widgets 0x14 for output */
15675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15676 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15677 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15679 /* Mic (rear) pin: input vref at 80% */
15680 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15681 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15682 /* Front Mic pin: input vref at 80% */
15683 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15684 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15685 /* Line In pin: input */
15686 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15688 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15689 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15690 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15691 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15692 /* CD pin widget for input */
15693 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15699 * 6-stack pin configuration:
15701 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15703 * Set pin mode and muting
15705 /* set front pin widgets 0x14 for output */
15706 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15707 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15708 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15710 /* Rear Pin: output 1 (0x0d) */
15711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15713 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15714 /* CLFE Pin: output 2 (0x0e) */
15715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15716 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15717 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15718 /* Side Pin: output 3 (0x0f) */
15719 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15720 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15721 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15723 /* Mic (rear) pin: input vref at 80% */
15724 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15725 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15726 /* Front Mic pin: input vref at 80% */
15727 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15728 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15729 /* Line In pin: input */
15730 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15731 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15732 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15733 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15734 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15735 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15736 /* CD pin widget for input */
15737 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15742 static struct hda_verb alc861vd_eapd_verbs[] = {
15743 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15747 static struct hda_verb alc660vd_eapd_verbs[] = {
15748 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15749 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15753 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15754 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15756 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15757 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15758 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15762 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15764 unsigned int present;
15765 unsigned char bits;
15767 present = snd_hda_jack_detect(codec, 0x18);
15768 bits = present ? HDA_AMP_MUTE : 0;
15770 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15771 HDA_AMP_MUTE, bits);
15774 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15776 struct alc_spec *spec = codec->spec;
15777 spec->autocfg.hp_pins[0] = 0x1b;
15778 spec->autocfg.speaker_pins[0] = 0x14;
15781 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15783 alc_automute_amp(codec);
15784 alc861vd_lenovo_mic_automute(codec);
15787 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15790 switch (res >> 26) {
15791 case ALC880_MIC_EVENT:
15792 alc861vd_lenovo_mic_automute(codec);
15795 alc_automute_amp_unsol_event(codec, res);
15800 static struct hda_verb alc861vd_dallas_verbs[] = {
15801 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15802 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15803 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15804 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15811 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15812 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15813 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15816 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15817 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15818 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15819 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15820 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15821 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15822 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15824 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15826 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15827 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15830 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15831 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15833 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15834 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15835 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15836 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15838 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15839 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15840 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15845 /* toggle speaker-output according to the hp-jack state */
15846 static void alc861vd_dallas_setup(struct hda_codec *codec)
15848 struct alc_spec *spec = codec->spec;
15850 spec->autocfg.hp_pins[0] = 0x15;
15851 spec->autocfg.speaker_pins[0] = 0x14;
15854 #ifdef CONFIG_SND_HDA_POWER_SAVE
15855 #define alc861vd_loopbacks alc880_loopbacks
15858 /* pcm configuration: identical with ALC880 */
15859 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15860 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15861 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15862 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15865 * configuration and preset
15867 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15868 [ALC660VD_3ST] = "3stack-660",
15869 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15870 [ALC660VD_ASUS_V1S] = "asus-v1s",
15871 [ALC861VD_3ST] = "3stack",
15872 [ALC861VD_3ST_DIG] = "3stack-digout",
15873 [ALC861VD_6ST_DIG] = "6stack-digout",
15874 [ALC861VD_LENOVO] = "lenovo",
15875 [ALC861VD_DALLAS] = "dallas",
15876 [ALC861VD_HP] = "hp",
15877 [ALC861VD_AUTO] = "auto",
15880 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15881 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15882 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15883 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15884 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15885 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15886 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15887 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15888 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15889 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15890 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15891 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15892 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15893 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15894 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15895 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15899 static struct alc_config_preset alc861vd_presets[] = {
15901 .mixers = { alc861vd_3st_mixer },
15902 .init_verbs = { alc861vd_volume_init_verbs,
15903 alc861vd_3stack_init_verbs },
15904 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15905 .dac_nids = alc660vd_dac_nids,
15906 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15907 .channel_mode = alc861vd_3stack_2ch_modes,
15908 .input_mux = &alc861vd_capture_source,
15910 [ALC660VD_3ST_DIG] = {
15911 .mixers = { alc861vd_3st_mixer },
15912 .init_verbs = { alc861vd_volume_init_verbs,
15913 alc861vd_3stack_init_verbs },
15914 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15915 .dac_nids = alc660vd_dac_nids,
15916 .dig_out_nid = ALC861VD_DIGOUT_NID,
15917 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15918 .channel_mode = alc861vd_3stack_2ch_modes,
15919 .input_mux = &alc861vd_capture_source,
15922 .mixers = { alc861vd_3st_mixer },
15923 .init_verbs = { alc861vd_volume_init_verbs,
15924 alc861vd_3stack_init_verbs },
15925 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15926 .dac_nids = alc861vd_dac_nids,
15927 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15928 .channel_mode = alc861vd_3stack_2ch_modes,
15929 .input_mux = &alc861vd_capture_source,
15931 [ALC861VD_3ST_DIG] = {
15932 .mixers = { alc861vd_3st_mixer },
15933 .init_verbs = { alc861vd_volume_init_verbs,
15934 alc861vd_3stack_init_verbs },
15935 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15936 .dac_nids = alc861vd_dac_nids,
15937 .dig_out_nid = ALC861VD_DIGOUT_NID,
15938 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15939 .channel_mode = alc861vd_3stack_2ch_modes,
15940 .input_mux = &alc861vd_capture_source,
15942 [ALC861VD_6ST_DIG] = {
15943 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15944 .init_verbs = { alc861vd_volume_init_verbs,
15945 alc861vd_6stack_init_verbs },
15946 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15947 .dac_nids = alc861vd_dac_nids,
15948 .dig_out_nid = ALC861VD_DIGOUT_NID,
15949 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15950 .channel_mode = alc861vd_6stack_modes,
15951 .input_mux = &alc861vd_capture_source,
15953 [ALC861VD_LENOVO] = {
15954 .mixers = { alc861vd_lenovo_mixer },
15955 .init_verbs = { alc861vd_volume_init_verbs,
15956 alc861vd_3stack_init_verbs,
15957 alc861vd_eapd_verbs,
15958 alc861vd_lenovo_unsol_verbs },
15959 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15960 .dac_nids = alc660vd_dac_nids,
15961 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15962 .channel_mode = alc861vd_3stack_2ch_modes,
15963 .input_mux = &alc861vd_capture_source,
15964 .unsol_event = alc861vd_lenovo_unsol_event,
15965 .setup = alc861vd_lenovo_setup,
15966 .init_hook = alc861vd_lenovo_init_hook,
15968 [ALC861VD_DALLAS] = {
15969 .mixers = { alc861vd_dallas_mixer },
15970 .init_verbs = { alc861vd_dallas_verbs },
15971 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15972 .dac_nids = alc861vd_dac_nids,
15973 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15974 .channel_mode = alc861vd_3stack_2ch_modes,
15975 .input_mux = &alc861vd_dallas_capture_source,
15976 .unsol_event = alc_automute_amp_unsol_event,
15977 .setup = alc861vd_dallas_setup,
15978 .init_hook = alc_automute_amp,
15981 .mixers = { alc861vd_hp_mixer },
15982 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15983 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15984 .dac_nids = alc861vd_dac_nids,
15985 .dig_out_nid = ALC861VD_DIGOUT_NID,
15986 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15987 .channel_mode = alc861vd_3stack_2ch_modes,
15988 .input_mux = &alc861vd_hp_capture_source,
15989 .unsol_event = alc_automute_amp_unsol_event,
15990 .setup = alc861vd_dallas_setup,
15991 .init_hook = alc_automute_amp,
15993 [ALC660VD_ASUS_V1S] = {
15994 .mixers = { alc861vd_lenovo_mixer },
15995 .init_verbs = { alc861vd_volume_init_verbs,
15996 alc861vd_3stack_init_verbs,
15997 alc861vd_eapd_verbs,
15998 alc861vd_lenovo_unsol_verbs },
15999 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16000 .dac_nids = alc660vd_dac_nids,
16001 .dig_out_nid = ALC861VD_DIGOUT_NID,
16002 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16003 .channel_mode = alc861vd_3stack_2ch_modes,
16004 .input_mux = &alc861vd_capture_source,
16005 .unsol_event = alc861vd_lenovo_unsol_event,
16006 .setup = alc861vd_lenovo_setup,
16007 .init_hook = alc861vd_lenovo_init_hook,
16012 * BIOS auto configuration
16014 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16015 const struct auto_pin_cfg *cfg)
16017 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16021 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16022 hda_nid_t nid, int pin_type, int dac_idx)
16024 alc_set_pin_output(codec, nid, pin_type);
16027 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16029 struct alc_spec *spec = codec->spec;
16032 for (i = 0; i <= HDA_SIDE; i++) {
16033 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16034 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16036 alc861vd_auto_set_output_and_unmute(codec, nid,
16042 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16044 struct alc_spec *spec = codec->spec;
16047 pin = spec->autocfg.hp_pins[0];
16048 if (pin) /* connect to front and use dac 0 */
16049 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16050 pin = spec->autocfg.speaker_pins[0];
16052 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16055 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16057 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16059 struct alc_spec *spec = codec->spec;
16062 for (i = 0; i < AUTO_PIN_LAST; i++) {
16063 hda_nid_t nid = spec->autocfg.input_pins[i];
16064 if (alc_is_input_pin(codec, nid)) {
16065 alc_set_input_pin(codec, nid, i);
16066 if (nid != ALC861VD_PIN_CD_NID &&
16067 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16068 snd_hda_codec_write(codec, nid, 0,
16069 AC_VERB_SET_AMP_GAIN_MUTE,
16075 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16077 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16078 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16080 /* add playback controls from the parsed DAC table */
16081 /* Based on ALC880 version. But ALC861VD has separate,
16082 * different NIDs for mute/unmute switch and volume control */
16083 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16084 const struct auto_pin_cfg *cfg)
16086 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16087 hda_nid_t nid_v, nid_s;
16090 for (i = 0; i < cfg->line_outs; i++) {
16091 if (!spec->multiout.dac_nids[i])
16093 nid_v = alc861vd_idx_to_mixer_vol(
16095 spec->multiout.dac_nids[i]));
16096 nid_s = alc861vd_idx_to_mixer_switch(
16098 spec->multiout.dac_nids[i]));
16102 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16104 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16108 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16110 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16114 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16116 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16120 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16122 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16128 if (cfg->line_outs == 1 &&
16129 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16136 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16137 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16141 if (cfg->line_outs == 1 &&
16142 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16144 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16145 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16154 /* add playback controls for speaker and HP outputs */
16155 /* Based on ALC880 version. But ALC861VD has separate,
16156 * different NIDs for mute/unmute switch and volume control */
16157 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16158 hda_nid_t pin, const char *pfx)
16160 hda_nid_t nid_v, nid_s;
16166 if (alc880_is_fixed_pin(pin)) {
16167 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16168 /* specify the DAC as the extra output */
16169 if (!spec->multiout.hp_nid)
16170 spec->multiout.hp_nid = nid_v;
16172 spec->multiout.extra_out_nid[0] = nid_v;
16173 /* control HP volume/switch on the output mixer amp */
16174 nid_v = alc861vd_idx_to_mixer_vol(
16175 alc880_fixed_pin_idx(pin));
16176 nid_s = alc861vd_idx_to_mixer_switch(
16177 alc880_fixed_pin_idx(pin));
16179 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16180 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16183 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16184 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16187 } else if (alc880_is_multi_pin(pin)) {
16188 /* set manual connection */
16189 /* we have only a switch on HP-out PIN */
16190 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16191 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16198 /* parse the BIOS configuration and set up the alc_spec
16199 * return 1 if successful, 0 if the proper config is not found,
16200 * or a negative error code
16201 * Based on ALC880 version - had to change it to override
16202 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16203 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16205 struct alc_spec *spec = codec->spec;
16207 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16209 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16213 if (!spec->autocfg.line_outs)
16214 return 0; /* can't find valid BIOS pin config */
16216 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16219 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16222 err = alc861vd_auto_create_extra_out(spec,
16223 spec->autocfg.speaker_pins[0],
16227 err = alc861vd_auto_create_extra_out(spec,
16228 spec->autocfg.hp_pins[0],
16232 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16236 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16238 if (spec->autocfg.dig_outs)
16239 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16241 if (spec->kctls.list)
16242 add_mixer(spec, spec->kctls.list);
16244 add_verb(spec, alc861vd_volume_init_verbs);
16246 spec->num_mux_defs = 1;
16247 spec->input_mux = &spec->private_imux[0];
16249 err = alc_auto_add_mic_boost(codec);
16253 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16258 /* additional initialization for auto-configuration model */
16259 static void alc861vd_auto_init(struct hda_codec *codec)
16261 struct alc_spec *spec = codec->spec;
16262 alc861vd_auto_init_multi_out(codec);
16263 alc861vd_auto_init_hp_out(codec);
16264 alc861vd_auto_init_analog_input(codec);
16265 alc861vd_auto_init_input_src(codec);
16266 if (spec->unsol_event)
16267 alc_inithook(codec);
16271 ALC660VD_FIX_ASUS_GPIO1
16275 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16276 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16277 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16278 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16282 static const struct alc_fixup alc861vd_fixups[] = {
16283 [ALC660VD_FIX_ASUS_GPIO1] = {
16284 .verbs = alc660vd_fix_asus_gpio1_verbs,
16288 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16289 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16293 static int patch_alc861vd(struct hda_codec *codec)
16295 struct alc_spec *spec;
16296 int err, board_config;
16298 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16302 codec->spec = spec;
16304 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16308 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16309 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16311 board_config = ALC861VD_AUTO;
16314 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16316 if (board_config == ALC861VD_AUTO) {
16317 /* automatic parse from the BIOS config */
16318 err = alc861vd_parse_auto_config(codec);
16324 "hda_codec: Cannot set up configuration "
16325 "from BIOS. Using base mode...\n");
16326 board_config = ALC861VD_3ST;
16330 err = snd_hda_attach_beep_device(codec, 0x23);
16336 if (board_config != ALC861VD_AUTO)
16337 setup_preset(codec, &alc861vd_presets[board_config]);
16339 if (codec->vendor_id == 0x10ec0660) {
16340 /* always turn on EAPD */
16341 add_verb(spec, alc660vd_eapd_verbs);
16344 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16345 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16347 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16348 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16350 if (!spec->adc_nids) {
16351 spec->adc_nids = alc861vd_adc_nids;
16352 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16354 if (!spec->capsrc_nids)
16355 spec->capsrc_nids = alc861vd_capsrc_nids;
16357 set_capture_mixer(codec);
16358 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16360 spec->vmaster_nid = 0x02;
16362 codec->patch_ops = alc_patch_ops;
16364 if (board_config == ALC861VD_AUTO)
16365 spec->init_hook = alc861vd_auto_init;
16366 #ifdef CONFIG_SND_HDA_POWER_SAVE
16367 if (!spec->loopback.amplist)
16368 spec->loopback.amplist = alc861vd_loopbacks;
16377 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16378 * configuration. Each pin widget can choose any input DACs and a mixer.
16379 * Each ADC is connected from a mixer of all inputs. This makes possible
16380 * 6-channel independent captures.
16382 * In addition, an independent DAC for the multi-playback (not used in this
16385 #define ALC662_DIGOUT_NID 0x06
16386 #define ALC662_DIGIN_NID 0x0a
16388 static hda_nid_t alc662_dac_nids[4] = {
16389 /* front, rear, clfe, rear_surr */
16393 static hda_nid_t alc272_dac_nids[2] = {
16397 static hda_nid_t alc662_adc_nids[2] = {
16402 static hda_nid_t alc272_adc_nids[1] = {
16407 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16408 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16412 /* FIXME: should be a matrix-type input source selection */
16413 static struct hda_input_mux alc662_capture_source = {
16417 { "Front Mic", 0x1 },
16423 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16431 static struct hda_input_mux alc663_capture_source = {
16435 { "Front Mic", 0x1 },
16440 #if 0 /* set to 1 for testing other input sources below */
16441 static struct hda_input_mux alc272_nc10_capture_source = {
16444 { "Autoselect Mic", 0x0 },
16445 { "Internal Mic", 0x1 },
16446 { "In-0x02", 0x2 },
16447 { "In-0x03", 0x3 },
16448 { "In-0x04", 0x4 },
16449 { "In-0x05", 0x5 },
16450 { "In-0x06", 0x6 },
16451 { "In-0x07", 0x7 },
16452 { "In-0x08", 0x8 },
16453 { "In-0x09", 0x9 },
16454 { "In-0x0a", 0x0a },
16455 { "In-0x0b", 0x0b },
16456 { "In-0x0c", 0x0c },
16457 { "In-0x0d", 0x0d },
16458 { "In-0x0e", 0x0e },
16459 { "In-0x0f", 0x0f },
16467 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16474 static struct hda_verb alc662_3ST_ch2_init[] = {
16475 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16476 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16477 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16478 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16485 static struct hda_verb alc662_3ST_ch6_init[] = {
16486 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16487 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16488 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16489 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16490 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16491 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16495 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16496 { 2, alc662_3ST_ch2_init },
16497 { 6, alc662_3ST_ch6_init },
16503 static struct hda_verb alc662_sixstack_ch6_init[] = {
16504 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16505 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16506 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16513 static struct hda_verb alc662_sixstack_ch8_init[] = {
16514 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16515 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16516 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16520 static struct hda_channel_mode alc662_5stack_modes[2] = {
16521 { 2, alc662_sixstack_ch6_init },
16522 { 6, alc662_sixstack_ch8_init },
16525 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16526 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16529 static struct snd_kcontrol_new alc662_base_mixer[] = {
16530 /* output mixer control */
16531 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16532 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16533 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16534 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16535 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16536 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16537 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16538 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16539 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16541 /*Input mixer control */
16542 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16543 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16544 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16545 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16546 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16547 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16548 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16549 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16553 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16554 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16555 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16556 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16557 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16558 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16559 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16560 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16562 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16563 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16564 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16568 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16569 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16570 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16571 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16572 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16573 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16574 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16575 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16576 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16577 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16578 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16579 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16580 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16581 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16582 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16584 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16585 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16589 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16590 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16591 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16592 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16593 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16594 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16595 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16596 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16597 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16598 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16602 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16603 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16604 ALC262_HIPPO_MASTER_SWITCH,
16606 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16607 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16608 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16610 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16611 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16612 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16616 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16617 ALC262_HIPPO_MASTER_SWITCH,
16618 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16619 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16620 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16621 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16622 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16623 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16624 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16626 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16630 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16631 .ops = &snd_hda_bind_vol,
16633 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16634 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16639 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16640 .ops = &snd_hda_bind_sw,
16642 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16643 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16648 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16649 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16650 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16651 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16652 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16656 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16657 .ops = &snd_hda_bind_sw,
16659 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16660 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16661 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16666 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16667 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16668 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16671 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16672 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16677 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16678 .ops = &snd_hda_bind_sw,
16680 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16681 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16682 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16687 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16688 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16689 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16690 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16691 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16692 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16693 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16697 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16698 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16699 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16700 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16701 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16702 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16703 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16704 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16708 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16709 .ops = &snd_hda_bind_vol,
16711 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16712 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16717 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16718 .ops = &snd_hda_bind_sw,
16720 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16721 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16726 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16727 HDA_BIND_VOL("Master Playback Volume",
16728 &alc663_asus_two_bind_master_vol),
16729 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16730 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16731 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16737 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16738 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16739 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16740 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16741 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16747 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16748 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16749 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16750 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16751 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16754 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16756 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16757 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16761 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16762 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16763 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16764 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16768 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16769 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16770 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16771 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16775 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16776 .ops = &snd_hda_bind_sw,
16778 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16779 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16780 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16781 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16782 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16787 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16788 .ops = &snd_hda_bind_sw,
16790 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16791 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16796 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16797 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16798 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16799 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16800 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16801 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16802 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16803 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16809 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16810 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16811 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16812 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16813 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16814 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16816 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16821 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16823 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16824 .name = "Channel Mode",
16825 .info = alc_ch_mode_info,
16826 .get = alc_ch_mode_get,
16827 .put = alc_ch_mode_put,
16832 static struct hda_verb alc662_init_verbs[] = {
16833 /* ADC: mute amp left and right */
16834 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16835 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16839 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16840 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16842 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16844 /* Front Pin: output 0 (0x0c) */
16845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16848 /* Rear Pin: output 1 (0x0d) */
16849 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16850 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16852 /* CLFE Pin: output 2 (0x0e) */
16853 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16854 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16856 /* Mic (rear) pin: input vref at 80% */
16857 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16858 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16859 /* Front Mic pin: input vref at 80% */
16860 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16861 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16862 /* Line In pin: input */
16863 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16864 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16865 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16866 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16867 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16868 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16869 /* CD pin widget for input */
16870 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16872 /* FIXME: use matrix-type input source selection */
16873 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16875 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16876 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16878 /* always trun on EAPD */
16879 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16880 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16885 static struct hda_verb alc663_init_verbs[] = {
16886 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16887 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16888 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16889 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16890 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16891 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16895 static struct hda_verb alc272_init_verbs[] = {
16896 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16897 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16898 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16899 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16900 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16901 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16902 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16903 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16907 static struct hda_verb alc662_sue_init_verbs[] = {
16908 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16909 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16913 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16914 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16915 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16919 /* Set Unsolicited Event*/
16920 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16921 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16922 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16926 static struct hda_verb alc663_m51va_init_verbs[] = {
16927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16928 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16929 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16930 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16931 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16934 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16935 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16939 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16940 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16941 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16942 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16943 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16944 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16945 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16946 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16950 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16951 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16952 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16953 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16954 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16957 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16958 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16962 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16965 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16967 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16968 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16969 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16973 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16974 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16975 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16976 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16977 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16979 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16980 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16983 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16984 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16985 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16989 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16990 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16991 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16992 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16993 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16996 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16997 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16998 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16999 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17000 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17001 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17005 static struct hda_verb alc663_g71v_init_verbs[] = {
17006 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17007 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17008 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
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, 0x00}, /* Headphone */
17014 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
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 alc663_g50v_init_verbs[] = {
17021 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17022 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17023 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17025 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17026 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17030 static struct hda_verb alc662_ecs_init_verbs[] = {
17031 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17033 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17034 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17038 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17039 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17040 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17041 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17042 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17043 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17044 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17045 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17046 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17047 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17048 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17049 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17053 static struct hda_verb alc272_dell_init_verbs[] = {
17054 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17055 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17057 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17058 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17059 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17060 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17061 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17062 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17063 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17064 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17068 static struct hda_verb alc663_mode7_init_verbs[] = {
17069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17071 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17072 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17074 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17075 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17076 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17077 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17078 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17081 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17082 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17083 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17087 static struct hda_verb alc663_mode8_init_verbs[] = {
17088 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17089 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17091 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17092 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17093 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17094 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17095 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17096 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17097 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17098 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17101 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17102 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17103 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17107 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17108 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17109 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17113 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17114 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17115 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17119 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17121 unsigned int present;
17122 unsigned char bits;
17124 present = snd_hda_jack_detect(codec, 0x14);
17125 bits = present ? HDA_AMP_MUTE : 0;
17127 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17128 HDA_AMP_MUTE, bits);
17131 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17133 unsigned int present;
17134 unsigned char bits;
17136 present = snd_hda_jack_detect(codec, 0x1b);
17137 bits = present ? HDA_AMP_MUTE : 0;
17139 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17140 HDA_AMP_MUTE, bits);
17141 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17142 HDA_AMP_MUTE, bits);
17145 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17148 if ((res >> 26) == ALC880_HP_EVENT)
17149 alc662_lenovo_101e_all_automute(codec);
17150 if ((res >> 26) == ALC880_FRONT_EVENT)
17151 alc662_lenovo_101e_ispeaker_automute(codec);
17154 /* unsolicited event for HP jack sensing */
17155 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17158 if ((res >> 26) == ALC880_MIC_EVENT)
17159 alc_mic_automute(codec);
17161 alc262_hippo_unsol_event(codec, res);
17164 static void alc662_eeepc_setup(struct hda_codec *codec)
17166 struct alc_spec *spec = codec->spec;
17168 alc262_hippo1_setup(codec);
17169 spec->ext_mic.pin = 0x18;
17170 spec->ext_mic.mux_idx = 0;
17171 spec->int_mic.pin = 0x19;
17172 spec->int_mic.mux_idx = 1;
17173 spec->auto_mic = 1;
17176 static void alc662_eeepc_inithook(struct hda_codec *codec)
17178 alc262_hippo_automute(codec);
17179 alc_mic_automute(codec);
17182 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17184 struct alc_spec *spec = codec->spec;
17186 spec->autocfg.hp_pins[0] = 0x14;
17187 spec->autocfg.speaker_pins[0] = 0x1b;
17190 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17192 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17194 unsigned int present;
17195 unsigned char bits;
17197 present = snd_hda_jack_detect(codec, 0x21);
17198 bits = present ? HDA_AMP_MUTE : 0;
17199 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17200 AMP_IN_MUTE(0), bits);
17201 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17202 AMP_IN_MUTE(0), bits);
17205 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17207 unsigned int present;
17208 unsigned char bits;
17210 present = snd_hda_jack_detect(codec, 0x21);
17211 bits = present ? HDA_AMP_MUTE : 0;
17212 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17213 AMP_IN_MUTE(0), bits);
17214 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17215 AMP_IN_MUTE(0), bits);
17216 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17217 AMP_IN_MUTE(0), bits);
17218 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17219 AMP_IN_MUTE(0), bits);
17222 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17224 unsigned int present;
17225 unsigned char bits;
17227 present = snd_hda_jack_detect(codec, 0x15);
17228 bits = present ? HDA_AMP_MUTE : 0;
17229 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17230 AMP_IN_MUTE(0), bits);
17231 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17232 AMP_IN_MUTE(0), bits);
17233 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17234 AMP_IN_MUTE(0), bits);
17235 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17236 AMP_IN_MUTE(0), bits);
17239 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17241 unsigned int present;
17242 unsigned char bits;
17244 present = snd_hda_jack_detect(codec, 0x1b);
17245 bits = present ? 0 : PIN_OUT;
17246 snd_hda_codec_write(codec, 0x14, 0,
17247 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17250 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17252 unsigned int present1, present2;
17254 present1 = snd_hda_jack_detect(codec, 0x21);
17255 present2 = snd_hda_jack_detect(codec, 0x15);
17257 if (present1 || present2) {
17258 snd_hda_codec_write_cache(codec, 0x14, 0,
17259 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17261 snd_hda_codec_write_cache(codec, 0x14, 0,
17262 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17266 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17268 unsigned int present1, present2;
17270 present1 = snd_hda_jack_detect(codec, 0x1b);
17271 present2 = snd_hda_jack_detect(codec, 0x15);
17273 if (present1 || present2) {
17274 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17275 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17276 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17277 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17279 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17280 AMP_IN_MUTE(0), 0);
17281 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17282 AMP_IN_MUTE(0), 0);
17286 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17288 unsigned int present1, present2;
17290 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17291 AC_VERB_GET_PIN_SENSE, 0)
17292 & AC_PINSENSE_PRESENCE;
17293 present2 = snd_hda_codec_read(codec, 0x21, 0,
17294 AC_VERB_GET_PIN_SENSE, 0)
17295 & AC_PINSENSE_PRESENCE;
17297 if (present1 || present2) {
17298 snd_hda_codec_write_cache(codec, 0x14, 0,
17299 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17300 snd_hda_codec_write_cache(codec, 0x17, 0,
17301 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17303 snd_hda_codec_write_cache(codec, 0x14, 0,
17304 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17305 snd_hda_codec_write_cache(codec, 0x17, 0,
17306 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17310 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17312 unsigned int present1, present2;
17314 present1 = snd_hda_codec_read(codec, 0x21, 0,
17315 AC_VERB_GET_PIN_SENSE, 0)
17316 & AC_PINSENSE_PRESENCE;
17317 present2 = snd_hda_codec_read(codec, 0x15, 0,
17318 AC_VERB_GET_PIN_SENSE, 0)
17319 & AC_PINSENSE_PRESENCE;
17321 if (present1 || present2) {
17322 snd_hda_codec_write_cache(codec, 0x14, 0,
17323 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17324 snd_hda_codec_write_cache(codec, 0x17, 0,
17325 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17327 snd_hda_codec_write_cache(codec, 0x14, 0,
17328 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17329 snd_hda_codec_write_cache(codec, 0x17, 0,
17330 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17334 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17337 switch (res >> 26) {
17338 case ALC880_HP_EVENT:
17339 alc663_m51va_speaker_automute(codec);
17341 case ALC880_MIC_EVENT:
17342 alc_mic_automute(codec);
17347 static void alc663_m51va_setup(struct hda_codec *codec)
17349 struct alc_spec *spec = codec->spec;
17350 spec->ext_mic.pin = 0x18;
17351 spec->ext_mic.mux_idx = 0;
17352 spec->int_mic.pin = 0x12;
17353 spec->int_mic.mux_idx = 9;
17354 spec->auto_mic = 1;
17357 static void alc663_m51va_inithook(struct hda_codec *codec)
17359 alc663_m51va_speaker_automute(codec);
17360 alc_mic_automute(codec);
17363 /* ***************** Mode1 ******************************/
17364 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17366 static void alc663_mode1_setup(struct hda_codec *codec)
17368 struct alc_spec *spec = codec->spec;
17369 spec->ext_mic.pin = 0x18;
17370 spec->ext_mic.mux_idx = 0;
17371 spec->int_mic.pin = 0x19;
17372 spec->int_mic.mux_idx = 1;
17373 spec->auto_mic = 1;
17376 #define alc663_mode1_inithook alc663_m51va_inithook
17378 /* ***************** Mode2 ******************************/
17379 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17382 switch (res >> 26) {
17383 case ALC880_HP_EVENT:
17384 alc662_f5z_speaker_automute(codec);
17386 case ALC880_MIC_EVENT:
17387 alc_mic_automute(codec);
17392 #define alc662_mode2_setup alc663_mode1_setup
17394 static void alc662_mode2_inithook(struct hda_codec *codec)
17396 alc662_f5z_speaker_automute(codec);
17397 alc_mic_automute(codec);
17399 /* ***************** Mode3 ******************************/
17400 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17403 switch (res >> 26) {
17404 case ALC880_HP_EVENT:
17405 alc663_two_hp_m1_speaker_automute(codec);
17407 case ALC880_MIC_EVENT:
17408 alc_mic_automute(codec);
17413 #define alc663_mode3_setup alc663_mode1_setup
17415 static void alc663_mode3_inithook(struct hda_codec *codec)
17417 alc663_two_hp_m1_speaker_automute(codec);
17418 alc_mic_automute(codec);
17420 /* ***************** Mode4 ******************************/
17421 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17424 switch (res >> 26) {
17425 case ALC880_HP_EVENT:
17426 alc663_21jd_two_speaker_automute(codec);
17428 case ALC880_MIC_EVENT:
17429 alc_mic_automute(codec);
17434 #define alc663_mode4_setup alc663_mode1_setup
17436 static void alc663_mode4_inithook(struct hda_codec *codec)
17438 alc663_21jd_two_speaker_automute(codec);
17439 alc_mic_automute(codec);
17441 /* ***************** Mode5 ******************************/
17442 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17445 switch (res >> 26) {
17446 case ALC880_HP_EVENT:
17447 alc663_15jd_two_speaker_automute(codec);
17449 case ALC880_MIC_EVENT:
17450 alc_mic_automute(codec);
17455 #define alc663_mode5_setup alc663_mode1_setup
17457 static void alc663_mode5_inithook(struct hda_codec *codec)
17459 alc663_15jd_two_speaker_automute(codec);
17460 alc_mic_automute(codec);
17462 /* ***************** Mode6 ******************************/
17463 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17466 switch (res >> 26) {
17467 case ALC880_HP_EVENT:
17468 alc663_two_hp_m2_speaker_automute(codec);
17470 case ALC880_MIC_EVENT:
17471 alc_mic_automute(codec);
17476 #define alc663_mode6_setup alc663_mode1_setup
17478 static void alc663_mode6_inithook(struct hda_codec *codec)
17480 alc663_two_hp_m2_speaker_automute(codec);
17481 alc_mic_automute(codec);
17484 /* ***************** Mode7 ******************************/
17485 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17488 switch (res >> 26) {
17489 case ALC880_HP_EVENT:
17490 alc663_two_hp_m7_speaker_automute(codec);
17492 case ALC880_MIC_EVENT:
17493 alc_mic_automute(codec);
17498 #define alc663_mode7_setup alc663_mode1_setup
17500 static void alc663_mode7_inithook(struct hda_codec *codec)
17502 alc663_two_hp_m7_speaker_automute(codec);
17503 alc_mic_automute(codec);
17506 /* ***************** Mode8 ******************************/
17507 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17510 switch (res >> 26) {
17511 case ALC880_HP_EVENT:
17512 alc663_two_hp_m8_speaker_automute(codec);
17514 case ALC880_MIC_EVENT:
17515 alc_mic_automute(codec);
17520 #define alc663_mode8_setup alc663_m51va_setup
17522 static void alc663_mode8_inithook(struct hda_codec *codec)
17524 alc663_two_hp_m8_speaker_automute(codec);
17525 alc_mic_automute(codec);
17528 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17530 unsigned int present;
17531 unsigned char bits;
17533 present = snd_hda_jack_detect(codec, 0x21);
17534 bits = present ? HDA_AMP_MUTE : 0;
17535 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17536 HDA_AMP_MUTE, bits);
17537 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17538 HDA_AMP_MUTE, bits);
17541 static void alc663_g71v_front_automute(struct hda_codec *codec)
17543 unsigned int present;
17544 unsigned char bits;
17546 present = snd_hda_jack_detect(codec, 0x15);
17547 bits = present ? HDA_AMP_MUTE : 0;
17548 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17549 HDA_AMP_MUTE, bits);
17552 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17555 switch (res >> 26) {
17556 case ALC880_HP_EVENT:
17557 alc663_g71v_hp_automute(codec);
17559 case ALC880_FRONT_EVENT:
17560 alc663_g71v_front_automute(codec);
17562 case ALC880_MIC_EVENT:
17563 alc_mic_automute(codec);
17568 #define alc663_g71v_setup alc663_m51va_setup
17570 static void alc663_g71v_inithook(struct hda_codec *codec)
17572 alc663_g71v_front_automute(codec);
17573 alc663_g71v_hp_automute(codec);
17574 alc_mic_automute(codec);
17577 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17580 switch (res >> 26) {
17581 case ALC880_HP_EVENT:
17582 alc663_m51va_speaker_automute(codec);
17584 case ALC880_MIC_EVENT:
17585 alc_mic_automute(codec);
17590 #define alc663_g50v_setup alc663_m51va_setup
17592 static void alc663_g50v_inithook(struct hda_codec *codec)
17594 alc663_m51va_speaker_automute(codec);
17595 alc_mic_automute(codec);
17598 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17599 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17600 ALC262_HIPPO_MASTER_SWITCH,
17602 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17603 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17604 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17606 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17607 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17608 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17612 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17613 /* Master Playback automatically created from Speaker and Headphone */
17614 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17615 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17616 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17617 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17619 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17620 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17621 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17623 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17624 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17625 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17629 #ifdef CONFIG_SND_HDA_POWER_SAVE
17630 #define alc662_loopbacks alc880_loopbacks
17634 /* pcm configuration: identical with ALC880 */
17635 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17636 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17637 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17638 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17641 * configuration and preset
17643 static const char *alc662_models[ALC662_MODEL_LAST] = {
17644 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17645 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17646 [ALC662_3ST_6ch] = "3stack-6ch",
17647 [ALC662_5ST_DIG] = "6stack-dig",
17648 [ALC662_LENOVO_101E] = "lenovo-101e",
17649 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17650 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17651 [ALC662_ECS] = "ecs",
17652 [ALC663_ASUS_M51VA] = "m51va",
17653 [ALC663_ASUS_G71V] = "g71v",
17654 [ALC663_ASUS_H13] = "h13",
17655 [ALC663_ASUS_G50V] = "g50v",
17656 [ALC663_ASUS_MODE1] = "asus-mode1",
17657 [ALC662_ASUS_MODE2] = "asus-mode2",
17658 [ALC663_ASUS_MODE3] = "asus-mode3",
17659 [ALC663_ASUS_MODE4] = "asus-mode4",
17660 [ALC663_ASUS_MODE5] = "asus-mode5",
17661 [ALC663_ASUS_MODE6] = "asus-mode6",
17662 [ALC663_ASUS_MODE7] = "asus-mode7",
17663 [ALC663_ASUS_MODE8] = "asus-mode8",
17664 [ALC272_DELL] = "dell",
17665 [ALC272_DELL_ZM1] = "dell-zm1",
17666 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17667 [ALC662_AUTO] = "auto",
17670 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17671 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17672 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17673 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17674 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17675 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17676 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17677 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17678 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17679 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17680 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17681 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17682 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17683 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17684 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17685 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17686 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17687 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17688 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17689 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17690 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17691 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17692 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17693 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17694 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17695 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17696 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17697 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17698 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17699 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17700 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17701 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17702 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17703 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17704 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17705 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17706 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17707 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17708 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17709 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17710 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17711 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17712 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17713 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17714 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17715 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17716 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17717 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17718 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17719 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17720 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17721 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17722 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17723 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17724 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17725 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17726 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17727 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17728 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17729 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17730 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17731 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17732 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17733 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17734 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17735 ALC662_3ST_6ch_DIG),
17736 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17737 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17738 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17739 ALC662_3ST_6ch_DIG),
17740 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17741 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17742 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17743 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17744 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17745 ALC662_3ST_6ch_DIG),
17746 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17748 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17752 static struct alc_config_preset alc662_presets[] = {
17753 [ALC662_3ST_2ch_DIG] = {
17754 .mixers = { alc662_3ST_2ch_mixer },
17755 .init_verbs = { alc662_init_verbs },
17756 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17757 .dac_nids = alc662_dac_nids,
17758 .dig_out_nid = ALC662_DIGOUT_NID,
17759 .dig_in_nid = ALC662_DIGIN_NID,
17760 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17761 .channel_mode = alc662_3ST_2ch_modes,
17762 .input_mux = &alc662_capture_source,
17764 [ALC662_3ST_6ch_DIG] = {
17765 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17766 .init_verbs = { alc662_init_verbs },
17767 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17768 .dac_nids = alc662_dac_nids,
17769 .dig_out_nid = ALC662_DIGOUT_NID,
17770 .dig_in_nid = ALC662_DIGIN_NID,
17771 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17772 .channel_mode = alc662_3ST_6ch_modes,
17774 .input_mux = &alc662_capture_source,
17776 [ALC662_3ST_6ch] = {
17777 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17778 .init_verbs = { alc662_init_verbs },
17779 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17780 .dac_nids = alc662_dac_nids,
17781 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17782 .channel_mode = alc662_3ST_6ch_modes,
17784 .input_mux = &alc662_capture_source,
17786 [ALC662_5ST_DIG] = {
17787 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17788 .init_verbs = { alc662_init_verbs },
17789 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17790 .dac_nids = alc662_dac_nids,
17791 .dig_out_nid = ALC662_DIGOUT_NID,
17792 .dig_in_nid = ALC662_DIGIN_NID,
17793 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17794 .channel_mode = alc662_5stack_modes,
17795 .input_mux = &alc662_capture_source,
17797 [ALC662_LENOVO_101E] = {
17798 .mixers = { alc662_lenovo_101e_mixer },
17799 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17800 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17801 .dac_nids = alc662_dac_nids,
17802 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17803 .channel_mode = alc662_3ST_2ch_modes,
17804 .input_mux = &alc662_lenovo_101e_capture_source,
17805 .unsol_event = alc662_lenovo_101e_unsol_event,
17806 .init_hook = alc662_lenovo_101e_all_automute,
17808 [ALC662_ASUS_EEEPC_P701] = {
17809 .mixers = { alc662_eeepc_p701_mixer },
17810 .init_verbs = { alc662_init_verbs,
17811 alc662_eeepc_sue_init_verbs },
17812 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17813 .dac_nids = alc662_dac_nids,
17814 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17815 .channel_mode = alc662_3ST_2ch_modes,
17816 .unsol_event = alc662_eeepc_unsol_event,
17817 .setup = alc662_eeepc_setup,
17818 .init_hook = alc662_eeepc_inithook,
17820 [ALC662_ASUS_EEEPC_EP20] = {
17821 .mixers = { alc662_eeepc_ep20_mixer,
17822 alc662_chmode_mixer },
17823 .init_verbs = { alc662_init_verbs,
17824 alc662_eeepc_ep20_sue_init_verbs },
17825 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17826 .dac_nids = alc662_dac_nids,
17827 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17828 .channel_mode = alc662_3ST_6ch_modes,
17829 .input_mux = &alc662_lenovo_101e_capture_source,
17830 .unsol_event = alc662_eeepc_unsol_event,
17831 .setup = alc662_eeepc_ep20_setup,
17832 .init_hook = alc662_eeepc_ep20_inithook,
17835 .mixers = { alc662_ecs_mixer },
17836 .init_verbs = { alc662_init_verbs,
17837 alc662_ecs_init_verbs },
17838 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17839 .dac_nids = alc662_dac_nids,
17840 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17841 .channel_mode = alc662_3ST_2ch_modes,
17842 .unsol_event = alc662_eeepc_unsol_event,
17843 .setup = alc662_eeepc_setup,
17844 .init_hook = alc662_eeepc_inithook,
17846 [ALC663_ASUS_M51VA] = {
17847 .mixers = { alc663_m51va_mixer },
17848 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17849 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17850 .dac_nids = alc662_dac_nids,
17851 .dig_out_nid = ALC662_DIGOUT_NID,
17852 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17853 .channel_mode = alc662_3ST_2ch_modes,
17854 .unsol_event = alc663_m51va_unsol_event,
17855 .setup = alc663_m51va_setup,
17856 .init_hook = alc663_m51va_inithook,
17858 [ALC663_ASUS_G71V] = {
17859 .mixers = { alc663_g71v_mixer },
17860 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17861 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17862 .dac_nids = alc662_dac_nids,
17863 .dig_out_nid = ALC662_DIGOUT_NID,
17864 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17865 .channel_mode = alc662_3ST_2ch_modes,
17866 .unsol_event = alc663_g71v_unsol_event,
17867 .setup = alc663_g71v_setup,
17868 .init_hook = alc663_g71v_inithook,
17870 [ALC663_ASUS_H13] = {
17871 .mixers = { alc663_m51va_mixer },
17872 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17873 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17874 .dac_nids = alc662_dac_nids,
17875 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17876 .channel_mode = alc662_3ST_2ch_modes,
17877 .unsol_event = alc663_m51va_unsol_event,
17878 .init_hook = alc663_m51va_inithook,
17880 [ALC663_ASUS_G50V] = {
17881 .mixers = { alc663_g50v_mixer },
17882 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17883 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17884 .dac_nids = alc662_dac_nids,
17885 .dig_out_nid = ALC662_DIGOUT_NID,
17886 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17887 .channel_mode = alc662_3ST_6ch_modes,
17888 .input_mux = &alc663_capture_source,
17889 .unsol_event = alc663_g50v_unsol_event,
17890 .setup = alc663_g50v_setup,
17891 .init_hook = alc663_g50v_inithook,
17893 [ALC663_ASUS_MODE1] = {
17894 .mixers = { alc663_m51va_mixer },
17895 .cap_mixer = alc662_auto_capture_mixer,
17896 .init_verbs = { alc662_init_verbs,
17897 alc663_21jd_amic_init_verbs },
17898 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17900 .dac_nids = alc662_dac_nids,
17901 .dig_out_nid = ALC662_DIGOUT_NID,
17902 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17903 .channel_mode = alc662_3ST_2ch_modes,
17904 .unsol_event = alc663_mode1_unsol_event,
17905 .setup = alc663_mode1_setup,
17906 .init_hook = alc663_mode1_inithook,
17908 [ALC662_ASUS_MODE2] = {
17909 .mixers = { alc662_1bjd_mixer },
17910 .cap_mixer = alc662_auto_capture_mixer,
17911 .init_verbs = { alc662_init_verbs,
17912 alc662_1bjd_amic_init_verbs },
17913 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17914 .dac_nids = alc662_dac_nids,
17915 .dig_out_nid = ALC662_DIGOUT_NID,
17916 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17917 .channel_mode = alc662_3ST_2ch_modes,
17918 .unsol_event = alc662_mode2_unsol_event,
17919 .setup = alc662_mode2_setup,
17920 .init_hook = alc662_mode2_inithook,
17922 [ALC663_ASUS_MODE3] = {
17923 .mixers = { alc663_two_hp_m1_mixer },
17924 .cap_mixer = alc662_auto_capture_mixer,
17925 .init_verbs = { alc662_init_verbs,
17926 alc663_two_hp_amic_m1_init_verbs },
17927 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17929 .dac_nids = alc662_dac_nids,
17930 .dig_out_nid = ALC662_DIGOUT_NID,
17931 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17932 .channel_mode = alc662_3ST_2ch_modes,
17933 .unsol_event = alc663_mode3_unsol_event,
17934 .setup = alc663_mode3_setup,
17935 .init_hook = alc663_mode3_inithook,
17937 [ALC663_ASUS_MODE4] = {
17938 .mixers = { alc663_asus_21jd_clfe_mixer },
17939 .cap_mixer = alc662_auto_capture_mixer,
17940 .init_verbs = { alc662_init_verbs,
17941 alc663_21jd_amic_init_verbs},
17942 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17944 .dac_nids = alc662_dac_nids,
17945 .dig_out_nid = ALC662_DIGOUT_NID,
17946 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17947 .channel_mode = alc662_3ST_2ch_modes,
17948 .unsol_event = alc663_mode4_unsol_event,
17949 .setup = alc663_mode4_setup,
17950 .init_hook = alc663_mode4_inithook,
17952 [ALC663_ASUS_MODE5] = {
17953 .mixers = { alc663_asus_15jd_clfe_mixer },
17954 .cap_mixer = alc662_auto_capture_mixer,
17955 .init_verbs = { alc662_init_verbs,
17956 alc663_15jd_amic_init_verbs },
17957 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17959 .dac_nids = alc662_dac_nids,
17960 .dig_out_nid = ALC662_DIGOUT_NID,
17961 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17962 .channel_mode = alc662_3ST_2ch_modes,
17963 .unsol_event = alc663_mode5_unsol_event,
17964 .setup = alc663_mode5_setup,
17965 .init_hook = alc663_mode5_inithook,
17967 [ALC663_ASUS_MODE6] = {
17968 .mixers = { alc663_two_hp_m2_mixer },
17969 .cap_mixer = alc662_auto_capture_mixer,
17970 .init_verbs = { alc662_init_verbs,
17971 alc663_two_hp_amic_m2_init_verbs },
17972 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17974 .dac_nids = alc662_dac_nids,
17975 .dig_out_nid = ALC662_DIGOUT_NID,
17976 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17977 .channel_mode = alc662_3ST_2ch_modes,
17978 .unsol_event = alc663_mode6_unsol_event,
17979 .setup = alc663_mode6_setup,
17980 .init_hook = alc663_mode6_inithook,
17982 [ALC663_ASUS_MODE7] = {
17983 .mixers = { alc663_mode7_mixer },
17984 .cap_mixer = alc662_auto_capture_mixer,
17985 .init_verbs = { alc662_init_verbs,
17986 alc663_mode7_init_verbs },
17987 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17989 .dac_nids = alc662_dac_nids,
17990 .dig_out_nid = ALC662_DIGOUT_NID,
17991 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17992 .channel_mode = alc662_3ST_2ch_modes,
17993 .unsol_event = alc663_mode7_unsol_event,
17994 .setup = alc663_mode7_setup,
17995 .init_hook = alc663_mode7_inithook,
17997 [ALC663_ASUS_MODE8] = {
17998 .mixers = { alc663_mode8_mixer },
17999 .cap_mixer = alc662_auto_capture_mixer,
18000 .init_verbs = { alc662_init_verbs,
18001 alc663_mode8_init_verbs },
18002 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18004 .dac_nids = alc662_dac_nids,
18005 .dig_out_nid = ALC662_DIGOUT_NID,
18006 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18007 .channel_mode = alc662_3ST_2ch_modes,
18008 .unsol_event = alc663_mode8_unsol_event,
18009 .setup = alc663_mode8_setup,
18010 .init_hook = alc663_mode8_inithook,
18013 .mixers = { alc663_m51va_mixer },
18014 .cap_mixer = alc272_auto_capture_mixer,
18015 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18016 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18017 .dac_nids = alc662_dac_nids,
18018 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18019 .adc_nids = alc272_adc_nids,
18020 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18021 .capsrc_nids = alc272_capsrc_nids,
18022 .channel_mode = alc662_3ST_2ch_modes,
18023 .unsol_event = alc663_m51va_unsol_event,
18024 .setup = alc663_m51va_setup,
18025 .init_hook = alc663_m51va_inithook,
18027 [ALC272_DELL_ZM1] = {
18028 .mixers = { alc663_m51va_mixer },
18029 .cap_mixer = alc662_auto_capture_mixer,
18030 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18031 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18032 .dac_nids = alc662_dac_nids,
18033 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18034 .adc_nids = alc662_adc_nids,
18036 .capsrc_nids = alc662_capsrc_nids,
18037 .channel_mode = alc662_3ST_2ch_modes,
18038 .unsol_event = alc663_m51va_unsol_event,
18039 .setup = alc663_m51va_setup,
18040 .init_hook = alc663_m51va_inithook,
18042 [ALC272_SAMSUNG_NC10] = {
18043 .mixers = { alc272_nc10_mixer },
18044 .init_verbs = { alc662_init_verbs,
18045 alc663_21jd_amic_init_verbs },
18046 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18047 .dac_nids = alc272_dac_nids,
18048 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18049 .channel_mode = alc662_3ST_2ch_modes,
18050 /*.input_mux = &alc272_nc10_capture_source,*/
18051 .unsol_event = alc663_mode4_unsol_event,
18052 .setup = alc663_mode4_setup,
18053 .init_hook = alc663_mode4_inithook,
18059 * BIOS auto configuration
18062 /* convert from MIX nid to DAC */
18063 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18067 else if (nid >= 0x0c && nid <= 0x0e)
18068 return nid - 0x0c + 0x02;
18073 /* get MIX nid connected to the given pin targeted to DAC */
18074 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18080 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18081 for (i = 0; i < num; i++) {
18082 if (alc662_mix_to_dac(mix[i]) == dac)
18088 /* look for an empty DAC slot */
18089 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18091 struct alc_spec *spec = codec->spec;
18095 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18098 for (i = 0; i < num; i++) {
18099 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18102 for (j = 0; j < spec->multiout.num_dacs; j++)
18103 if (spec->multiout.dac_nids[j] == nid)
18105 if (j >= spec->multiout.num_dacs)
18111 /* fill in the dac_nids table from the parsed pin configuration */
18112 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18113 const struct auto_pin_cfg *cfg)
18115 struct alc_spec *spec = codec->spec;
18119 spec->multiout.dac_nids = spec->private_dac_nids;
18120 for (i = 0; i < cfg->line_outs; i++) {
18121 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18124 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18129 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18130 hda_nid_t nid, unsigned int chs)
18132 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18133 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18136 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18137 hda_nid_t nid, unsigned int chs)
18139 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18140 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18143 #define alc662_add_stereo_vol(spec, pfx, nid) \
18144 alc662_add_vol_ctl(spec, pfx, nid, 3)
18145 #define alc662_add_stereo_sw(spec, pfx, nid) \
18146 alc662_add_sw_ctl(spec, pfx, nid, 3)
18148 /* add playback controls from the parsed DAC table */
18149 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18150 const struct auto_pin_cfg *cfg)
18152 struct alc_spec *spec = codec->spec;
18153 static const char *chname[4] = {
18154 "Front", "Surround", NULL /*CLFE*/, "Side"
18156 hda_nid_t nid, mix;
18159 for (i = 0; i < cfg->line_outs; i++) {
18160 nid = spec->multiout.dac_nids[i];
18163 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18168 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18171 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18174 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18177 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18182 if (cfg->line_outs == 1 &&
18183 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18190 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18193 if (cfg->line_outs == 1 &&
18194 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18196 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18204 /* add playback controls for speaker and HP outputs */
18205 /* return DAC nid if any new DAC is assigned */
18206 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18209 struct alc_spec *spec = codec->spec;
18210 hda_nid_t nid, mix;
18215 nid = alc662_look_for_dac(codec, pin);
18217 /* the corresponding DAC is already occupied */
18218 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18219 return 0; /* no way */
18220 /* create a switch only */
18221 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18222 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18225 mix = alc662_dac_to_mix(codec, pin, nid);
18228 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18231 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18237 /* create playback/capture controls for input pins */
18238 #define alc662_auto_create_input_ctls \
18239 alc882_auto_create_input_ctls
18241 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18242 hda_nid_t nid, int pin_type,
18248 alc_set_pin_output(codec, nid, pin_type);
18249 /* need the manual connection? */
18250 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18253 for (i = 0; i < num; i++) {
18254 if (alc662_mix_to_dac(srcs[i]) != dac)
18256 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18261 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18263 struct alc_spec *spec = codec->spec;
18264 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18267 for (i = 0; i <= HDA_SIDE; i++) {
18268 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18270 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18271 spec->multiout.dac_nids[i]);
18275 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18277 struct alc_spec *spec = codec->spec;
18280 pin = spec->autocfg.hp_pins[0];
18282 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18283 spec->multiout.hp_nid);
18284 pin = spec->autocfg.speaker_pins[0];
18286 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18287 spec->multiout.extra_out_nid[0]);
18290 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18292 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18294 struct alc_spec *spec = codec->spec;
18297 for (i = 0; i < AUTO_PIN_LAST; i++) {
18298 hda_nid_t nid = spec->autocfg.input_pins[i];
18299 if (alc_is_input_pin(codec, nid)) {
18300 alc_set_input_pin(codec, nid, i);
18301 if (nid != ALC662_PIN_CD_NID &&
18302 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18303 snd_hda_codec_write(codec, nid, 0,
18304 AC_VERB_SET_AMP_GAIN_MUTE,
18310 #define alc662_auto_init_input_src alc882_auto_init_input_src
18312 static int alc662_parse_auto_config(struct hda_codec *codec)
18314 struct alc_spec *spec = codec->spec;
18316 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18318 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18322 if (!spec->autocfg.line_outs)
18323 return 0; /* can't find valid BIOS pin config */
18325 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18328 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18331 err = alc662_auto_create_extra_out(codec,
18332 spec->autocfg.speaker_pins[0],
18337 spec->multiout.extra_out_nid[0] = err;
18338 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18343 spec->multiout.hp_nid = err;
18344 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18348 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18350 if (spec->autocfg.dig_outs)
18351 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18353 if (spec->kctls.list)
18354 add_mixer(spec, spec->kctls.list);
18356 spec->num_mux_defs = 1;
18357 spec->input_mux = &spec->private_imux[0];
18359 add_verb(spec, alc662_init_verbs);
18360 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18361 codec->vendor_id == 0x10ec0665)
18362 add_verb(spec, alc663_init_verbs);
18364 if (codec->vendor_id == 0x10ec0272)
18365 add_verb(spec, alc272_init_verbs);
18367 err = alc_auto_add_mic_boost(codec);
18371 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18372 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18373 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18375 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18380 /* additional initialization for auto-configuration model */
18381 static void alc662_auto_init(struct hda_codec *codec)
18383 struct alc_spec *spec = codec->spec;
18384 alc662_auto_init_multi_out(codec);
18385 alc662_auto_init_hp_out(codec);
18386 alc662_auto_init_analog_input(codec);
18387 alc662_auto_init_input_src(codec);
18388 if (spec->unsol_event)
18389 alc_inithook(codec);
18392 static int patch_alc662(struct hda_codec *codec)
18394 struct alc_spec *spec;
18395 int err, board_config;
18397 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18401 codec->spec = spec;
18403 alc_auto_parse_customize_define(codec);
18405 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18407 if (alc_read_coef_idx(codec, 0) == 0x8020)
18408 alc_codec_rename(codec, "ALC661");
18409 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18410 codec->bus->pci->subsystem_vendor == 0x1025 &&
18411 spec->cdefine.platform_type == 1)
18412 alc_codec_rename(codec, "ALC272X");
18414 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18417 if (board_config < 0) {
18418 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18420 board_config = ALC662_AUTO;
18423 if (board_config == ALC662_AUTO) {
18424 /* automatic parse from the BIOS config */
18425 err = alc662_parse_auto_config(codec);
18431 "hda_codec: Cannot set up configuration "
18432 "from BIOS. Using base mode...\n");
18433 board_config = ALC662_3ST_2ch_DIG;
18437 err = snd_hda_attach_beep_device(codec, 0x1);
18443 if (board_config != ALC662_AUTO)
18444 setup_preset(codec, &alc662_presets[board_config]);
18446 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18447 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18449 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18450 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18452 if (!spec->adc_nids) {
18453 spec->adc_nids = alc662_adc_nids;
18454 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18456 if (!spec->capsrc_nids)
18457 spec->capsrc_nids = alc662_capsrc_nids;
18459 if (!spec->cap_mixer)
18460 set_capture_mixer(codec);
18462 if (spec->cdefine.enable_pcbeep) {
18463 switch (codec->vendor_id) {
18465 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18470 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18473 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18477 spec->vmaster_nid = 0x02;
18479 codec->patch_ops = alc_patch_ops;
18480 if (board_config == ALC662_AUTO)
18481 spec->init_hook = alc662_auto_init;
18482 #ifdef CONFIG_SND_HDA_POWER_SAVE
18483 if (!spec->loopback.amplist)
18484 spec->loopback.amplist = alc662_loopbacks;
18490 static int patch_alc888(struct hda_codec *codec)
18492 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18493 kfree(codec->chip_name);
18494 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18495 if (!codec->chip_name) {
18499 return patch_alc662(codec);
18501 return patch_alc882(codec);
18507 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18508 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18509 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18510 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18511 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18512 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18513 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18514 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18515 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18516 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18517 .patch = patch_alc861 },
18518 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18519 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18520 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18521 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18522 .patch = patch_alc882 },
18523 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18524 .patch = patch_alc662 },
18525 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18526 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18527 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18528 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18529 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18530 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18531 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18532 .patch = patch_alc882 },
18533 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18534 .patch = patch_alc882 },
18535 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18536 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18537 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18538 .patch = patch_alc882 },
18539 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18540 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18541 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18542 {} /* terminator */
18545 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18547 MODULE_LICENSE("GPL");
18548 MODULE_DESCRIPTION("Realtek HD-audio codec");
18550 static struct hda_codec_preset_list realtek_list = {
18551 .preset = snd_hda_preset_realtek,
18552 .owner = THIS_MODULE,
18555 static int __init patch_realtek_init(void)
18557 return snd_hda_add_codec_preset(&realtek_list);
18560 static void __exit patch_realtek_exit(void)
18562 snd_hda_delete_codec_preset(&realtek_list);
18565 module_init(patch_realtek_init)
18566 module_exit(patch_realtek_exit)