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,
3852 * Test configuration for debugging
3854 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3857 #ifdef CONFIG_SND_DEBUG
3858 static hda_nid_t alc880_test_dac_nids[4] = {
3859 0x02, 0x03, 0x04, 0x05
3862 static struct hda_input_mux alc880_test_capture_source = {
3871 { "Surround", 0x6 },
3875 static struct hda_channel_mode alc880_test_modes[4] = {
3882 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3883 struct snd_ctl_elem_info *uinfo)
3885 static char *texts[] = {
3886 "N/A", "Line Out", "HP Out",
3887 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3889 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3891 uinfo->value.enumerated.items = 8;
3892 if (uinfo->value.enumerated.item >= 8)
3893 uinfo->value.enumerated.item = 7;
3894 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3898 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3899 struct snd_ctl_elem_value *ucontrol)
3901 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3902 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3903 unsigned int pin_ctl, item = 0;
3905 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3906 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3907 if (pin_ctl & AC_PINCTL_OUT_EN) {
3908 if (pin_ctl & AC_PINCTL_HP_EN)
3912 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3913 switch (pin_ctl & AC_PINCTL_VREFEN) {
3914 case AC_PINCTL_VREF_HIZ: item = 3; break;
3915 case AC_PINCTL_VREF_50: item = 4; break;
3916 case AC_PINCTL_VREF_GRD: item = 5; break;
3917 case AC_PINCTL_VREF_80: item = 6; break;
3918 case AC_PINCTL_VREF_100: item = 7; break;
3921 ucontrol->value.enumerated.item[0] = item;
3925 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3926 struct snd_ctl_elem_value *ucontrol)
3928 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3929 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3930 static unsigned int ctls[] = {
3931 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3932 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3933 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3934 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3935 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3936 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3938 unsigned int old_ctl, new_ctl;
3940 old_ctl = snd_hda_codec_read(codec, nid, 0,
3941 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3942 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3943 if (old_ctl != new_ctl) {
3945 snd_hda_codec_write_cache(codec, nid, 0,
3946 AC_VERB_SET_PIN_WIDGET_CONTROL,
3948 val = ucontrol->value.enumerated.item[0] >= 3 ?
3950 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3957 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3958 struct snd_ctl_elem_info *uinfo)
3960 static char *texts[] = {
3961 "Front", "Surround", "CLFE", "Side"
3963 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3965 uinfo->value.enumerated.items = 4;
3966 if (uinfo->value.enumerated.item >= 4)
3967 uinfo->value.enumerated.item = 3;
3968 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3972 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3973 struct snd_ctl_elem_value *ucontrol)
3975 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3976 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3979 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3980 ucontrol->value.enumerated.item[0] = sel & 3;
3984 static int alc_test_pin_src_put(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) & 3;
3992 if (ucontrol->value.enumerated.item[0] != sel) {
3993 sel = ucontrol->value.enumerated.item[0] & 3;
3994 snd_hda_codec_write_cache(codec, nid, 0,
3995 AC_VERB_SET_CONNECT_SEL, sel);
4001 #define PIN_CTL_TEST(xname,nid) { \
4002 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4004 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4005 .info = alc_test_pin_ctl_info, \
4006 .get = alc_test_pin_ctl_get, \
4007 .put = alc_test_pin_ctl_put, \
4008 .private_value = nid \
4011 #define PIN_SRC_TEST(xname,nid) { \
4012 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4014 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4015 .info = alc_test_pin_src_info, \
4016 .get = alc_test_pin_src_get, \
4017 .put = alc_test_pin_src_put, \
4018 .private_value = nid \
4021 static struct snd_kcontrol_new alc880_test_mixer[] = {
4022 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4023 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4024 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4025 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4026 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4027 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4028 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4029 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4030 PIN_CTL_TEST("Front Pin Mode", 0x14),
4031 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4032 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4033 PIN_CTL_TEST("Side Pin Mode", 0x17),
4034 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4035 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4036 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4037 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4038 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4039 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4040 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4041 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4042 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4043 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4044 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4045 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4046 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4047 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4048 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4049 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4050 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4051 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4053 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4054 .name = "Channel Mode",
4055 .info = alc_ch_mode_info,
4056 .get = alc_ch_mode_get,
4057 .put = alc_ch_mode_put,
4062 static struct hda_verb alc880_test_init_verbs[] = {
4063 /* Unmute inputs of 0x0c - 0x0f */
4064 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4065 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4066 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4067 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4068 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4069 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4070 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4071 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4072 /* Vol output for 0x0c-0x0f */
4073 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4074 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4076 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4077 /* Set output pins 0x14-0x17 */
4078 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4079 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4080 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4081 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4082 /* Unmute output pins 0x14-0x17 */
4083 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4084 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4085 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4086 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4087 /* Set input pins 0x18-0x1c */
4088 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4089 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4090 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4091 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4092 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4093 /* Mute input pins 0x18-0x1b */
4094 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4095 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4096 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4097 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4100 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4101 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4102 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4103 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4104 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4105 /* Analog input/passthru */
4106 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4118 static const char *alc880_models[ALC880_MODEL_LAST] = {
4119 [ALC880_3ST] = "3stack",
4120 [ALC880_TCL_S700] = "tcl",
4121 [ALC880_3ST_DIG] = "3stack-digout",
4122 [ALC880_CLEVO] = "clevo",
4123 [ALC880_5ST] = "5stack",
4124 [ALC880_5ST_DIG] = "5stack-digout",
4125 [ALC880_W810] = "w810",
4126 [ALC880_Z71V] = "z71v",
4127 [ALC880_6ST] = "6stack",
4128 [ALC880_6ST_DIG] = "6stack-digout",
4129 [ALC880_ASUS] = "asus",
4130 [ALC880_ASUS_W1V] = "asus-w1v",
4131 [ALC880_ASUS_DIG] = "asus-dig",
4132 [ALC880_ASUS_DIG2] = "asus-dig2",
4133 [ALC880_UNIWILL_DIG] = "uniwill",
4134 [ALC880_UNIWILL_P53] = "uniwill-p53",
4135 [ALC880_FUJITSU] = "fujitsu",
4136 [ALC880_F1734] = "F1734",
4138 [ALC880_LG_LW] = "lg-lw",
4139 [ALC880_MEDION_RIM] = "medion",
4140 #ifdef CONFIG_SND_DEBUG
4141 [ALC880_TEST] = "test",
4143 [ALC880_AUTO] = "auto",
4146 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4147 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4148 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4149 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4150 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4151 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4152 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4153 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4154 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4155 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4156 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4157 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4158 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4159 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4160 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4161 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4162 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4163 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4164 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4165 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4166 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4167 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4168 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4169 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4170 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4171 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4172 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4173 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4174 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4175 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4176 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4177 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4178 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4179 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4180 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4181 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4182 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4183 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4184 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4185 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4186 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4187 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4188 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4189 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4190 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4191 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4192 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4193 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4194 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4195 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4196 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4197 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4198 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4199 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4200 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4201 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4202 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4203 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4204 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4205 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4206 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4207 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4208 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4209 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4210 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4211 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4212 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4213 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4214 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4216 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4217 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4218 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4223 * ALC880 codec presets
4225 static struct alc_config_preset alc880_presets[] = {
4227 .mixers = { alc880_three_stack_mixer },
4228 .init_verbs = { alc880_volume_init_verbs,
4229 alc880_pin_3stack_init_verbs },
4230 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4231 .dac_nids = alc880_dac_nids,
4232 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4233 .channel_mode = alc880_threestack_modes,
4235 .input_mux = &alc880_capture_source,
4237 [ALC880_3ST_DIG] = {
4238 .mixers = { alc880_three_stack_mixer },
4239 .init_verbs = { alc880_volume_init_verbs,
4240 alc880_pin_3stack_init_verbs },
4241 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4242 .dac_nids = alc880_dac_nids,
4243 .dig_out_nid = ALC880_DIGOUT_NID,
4244 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4245 .channel_mode = alc880_threestack_modes,
4247 .input_mux = &alc880_capture_source,
4249 [ALC880_TCL_S700] = {
4250 .mixers = { alc880_tcl_s700_mixer },
4251 .init_verbs = { alc880_volume_init_verbs,
4252 alc880_pin_tcl_S700_init_verbs,
4253 alc880_gpio2_init_verbs },
4254 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4255 .dac_nids = alc880_dac_nids,
4256 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4257 .num_adc_nids = 1, /* single ADC */
4259 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4260 .channel_mode = alc880_2_jack_modes,
4261 .input_mux = &alc880_capture_source,
4264 .mixers = { alc880_three_stack_mixer,
4265 alc880_five_stack_mixer},
4266 .init_verbs = { alc880_volume_init_verbs,
4267 alc880_pin_5stack_init_verbs },
4268 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4269 .dac_nids = alc880_dac_nids,
4270 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4271 .channel_mode = alc880_fivestack_modes,
4272 .input_mux = &alc880_capture_source,
4274 [ALC880_5ST_DIG] = {
4275 .mixers = { alc880_three_stack_mixer,
4276 alc880_five_stack_mixer },
4277 .init_verbs = { alc880_volume_init_verbs,
4278 alc880_pin_5stack_init_verbs },
4279 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4280 .dac_nids = alc880_dac_nids,
4281 .dig_out_nid = ALC880_DIGOUT_NID,
4282 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4283 .channel_mode = alc880_fivestack_modes,
4284 .input_mux = &alc880_capture_source,
4287 .mixers = { alc880_six_stack_mixer },
4288 .init_verbs = { alc880_volume_init_verbs,
4289 alc880_pin_6stack_init_verbs },
4290 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4291 .dac_nids = alc880_6st_dac_nids,
4292 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4293 .channel_mode = alc880_sixstack_modes,
4294 .input_mux = &alc880_6stack_capture_source,
4296 [ALC880_6ST_DIG] = {
4297 .mixers = { alc880_six_stack_mixer },
4298 .init_verbs = { alc880_volume_init_verbs,
4299 alc880_pin_6stack_init_verbs },
4300 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4301 .dac_nids = alc880_6st_dac_nids,
4302 .dig_out_nid = ALC880_DIGOUT_NID,
4303 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4304 .channel_mode = alc880_sixstack_modes,
4305 .input_mux = &alc880_6stack_capture_source,
4308 .mixers = { alc880_w810_base_mixer },
4309 .init_verbs = { alc880_volume_init_verbs,
4310 alc880_pin_w810_init_verbs,
4311 alc880_gpio2_init_verbs },
4312 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4313 .dac_nids = alc880_w810_dac_nids,
4314 .dig_out_nid = ALC880_DIGOUT_NID,
4315 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4316 .channel_mode = alc880_w810_modes,
4317 .input_mux = &alc880_capture_source,
4320 .mixers = { alc880_z71v_mixer },
4321 .init_verbs = { alc880_volume_init_verbs,
4322 alc880_pin_z71v_init_verbs },
4323 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4324 .dac_nids = alc880_z71v_dac_nids,
4325 .dig_out_nid = ALC880_DIGOUT_NID,
4327 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4328 .channel_mode = alc880_2_jack_modes,
4329 .input_mux = &alc880_capture_source,
4332 .mixers = { alc880_f1734_mixer },
4333 .init_verbs = { alc880_volume_init_verbs,
4334 alc880_pin_f1734_init_verbs },
4335 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4336 .dac_nids = alc880_f1734_dac_nids,
4338 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4339 .channel_mode = alc880_2_jack_modes,
4340 .input_mux = &alc880_f1734_capture_source,
4341 .unsol_event = alc880_uniwill_p53_unsol_event,
4342 .setup = alc880_uniwill_p53_setup,
4343 .init_hook = alc_automute_amp,
4346 .mixers = { alc880_asus_mixer },
4347 .init_verbs = { alc880_volume_init_verbs,
4348 alc880_pin_asus_init_verbs,
4349 alc880_gpio1_init_verbs },
4350 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4351 .dac_nids = alc880_asus_dac_nids,
4352 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4353 .channel_mode = alc880_asus_modes,
4355 .input_mux = &alc880_capture_source,
4357 [ALC880_ASUS_DIG] = {
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 .dig_out_nid = ALC880_DIGOUT_NID,
4365 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4366 .channel_mode = alc880_asus_modes,
4368 .input_mux = &alc880_capture_source,
4370 [ALC880_ASUS_DIG2] = {
4371 .mixers = { alc880_asus_mixer },
4372 .init_verbs = { alc880_volume_init_verbs,
4373 alc880_pin_asus_init_verbs,
4374 alc880_gpio2_init_verbs }, /* use GPIO2 */
4375 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4376 .dac_nids = alc880_asus_dac_nids,
4377 .dig_out_nid = ALC880_DIGOUT_NID,
4378 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4379 .channel_mode = alc880_asus_modes,
4381 .input_mux = &alc880_capture_source,
4383 [ALC880_ASUS_W1V] = {
4384 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4385 .init_verbs = { alc880_volume_init_verbs,
4386 alc880_pin_asus_init_verbs,
4387 alc880_gpio1_init_verbs },
4388 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4389 .dac_nids = alc880_asus_dac_nids,
4390 .dig_out_nid = ALC880_DIGOUT_NID,
4391 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4392 .channel_mode = alc880_asus_modes,
4394 .input_mux = &alc880_capture_source,
4396 [ALC880_UNIWILL_DIG] = {
4397 .mixers = { alc880_asus_mixer },
4398 .init_verbs = { alc880_volume_init_verbs,
4399 alc880_pin_asus_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] = {
4409 .mixers = { alc880_uniwill_mixer },
4410 .init_verbs = { alc880_volume_init_verbs,
4411 alc880_uniwill_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_threestack_modes),
4416 .channel_mode = alc880_threestack_modes,
4418 .input_mux = &alc880_capture_source,
4419 .unsol_event = alc880_uniwill_unsol_event,
4420 .setup = alc880_uniwill_setup,
4421 .init_hook = alc880_uniwill_init_hook,
4423 [ALC880_UNIWILL_P53] = {
4424 .mixers = { alc880_uniwill_p53_mixer },
4425 .init_verbs = { alc880_volume_init_verbs,
4426 alc880_uniwill_p53_init_verbs },
4427 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4428 .dac_nids = alc880_asus_dac_nids,
4429 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4430 .channel_mode = alc880_threestack_modes,
4431 .input_mux = &alc880_capture_source,
4432 .unsol_event = alc880_uniwill_p53_unsol_event,
4433 .setup = alc880_uniwill_p53_setup,
4434 .init_hook = alc_automute_amp,
4436 [ALC880_FUJITSU] = {
4437 .mixers = { alc880_fujitsu_mixer },
4438 .init_verbs = { alc880_volume_init_verbs,
4439 alc880_uniwill_p53_init_verbs,
4440 alc880_beep_init_verbs },
4441 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4442 .dac_nids = alc880_dac_nids,
4443 .dig_out_nid = ALC880_DIGOUT_NID,
4444 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4445 .channel_mode = alc880_2_jack_modes,
4446 .input_mux = &alc880_capture_source,
4447 .unsol_event = alc880_uniwill_p53_unsol_event,
4448 .setup = alc880_uniwill_p53_setup,
4449 .init_hook = alc_automute_amp,
4452 .mixers = { alc880_three_stack_mixer },
4453 .init_verbs = { alc880_volume_init_verbs,
4454 alc880_pin_clevo_init_verbs },
4455 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4456 .dac_nids = alc880_dac_nids,
4458 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4459 .channel_mode = alc880_threestack_modes,
4461 .input_mux = &alc880_capture_source,
4464 .mixers = { alc880_lg_mixer },
4465 .init_verbs = { alc880_volume_init_verbs,
4466 alc880_lg_init_verbs },
4467 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4468 .dac_nids = alc880_lg_dac_nids,
4469 .dig_out_nid = ALC880_DIGOUT_NID,
4470 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4471 .channel_mode = alc880_lg_ch_modes,
4473 .input_mux = &alc880_lg_capture_source,
4474 .unsol_event = alc_automute_amp_unsol_event,
4475 .setup = alc880_lg_setup,
4476 .init_hook = alc_automute_amp,
4477 #ifdef CONFIG_SND_HDA_POWER_SAVE
4478 .loopbacks = alc880_lg_loopbacks,
4482 .mixers = { alc880_lg_lw_mixer },
4483 .init_verbs = { alc880_volume_init_verbs,
4484 alc880_lg_lw_init_verbs },
4485 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4486 .dac_nids = alc880_dac_nids,
4487 .dig_out_nid = ALC880_DIGOUT_NID,
4488 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4489 .channel_mode = alc880_lg_lw_modes,
4490 .input_mux = &alc880_lg_lw_capture_source,
4491 .unsol_event = alc_automute_amp_unsol_event,
4492 .setup = alc880_lg_lw_setup,
4493 .init_hook = alc_automute_amp,
4495 [ALC880_MEDION_RIM] = {
4496 .mixers = { alc880_medion_rim_mixer },
4497 .init_verbs = { alc880_volume_init_verbs,
4498 alc880_medion_rim_init_verbs,
4499 alc_gpio2_init_verbs },
4500 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4501 .dac_nids = alc880_dac_nids,
4502 .dig_out_nid = ALC880_DIGOUT_NID,
4503 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4504 .channel_mode = alc880_2_jack_modes,
4505 .input_mux = &alc880_medion_rim_capture_source,
4506 .unsol_event = alc880_medion_rim_unsol_event,
4507 .setup = alc880_medion_rim_setup,
4508 .init_hook = alc880_medion_rim_automute,
4510 #ifdef CONFIG_SND_DEBUG
4512 .mixers = { alc880_test_mixer },
4513 .init_verbs = { alc880_test_init_verbs },
4514 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4515 .dac_nids = alc880_test_dac_nids,
4516 .dig_out_nid = ALC880_DIGOUT_NID,
4517 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4518 .channel_mode = alc880_test_modes,
4519 .input_mux = &alc880_test_capture_source,
4525 * Automatic parse of I/O pins from the BIOS configuration
4530 ALC_CTL_WIDGET_MUTE,
4533 static struct snd_kcontrol_new alc880_control_templates[] = {
4534 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4535 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4536 HDA_BIND_MUTE(NULL, 0, 0, 0),
4539 /* add dynamic controls */
4540 static int add_control(struct alc_spec *spec, int type, const char *name,
4543 struct snd_kcontrol_new *knew;
4545 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4546 knew = snd_array_new(&spec->kctls);
4549 *knew = alc880_control_templates[type];
4550 knew->name = kstrdup(name, GFP_KERNEL);
4553 if (get_amp_nid_(val))
4554 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4555 knew->private_value = val;
4559 static int add_control_with_pfx(struct alc_spec *spec, int type,
4560 const char *pfx, const char *dir,
4561 const char *sfx, unsigned long val)
4564 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4565 return add_control(spec, type, name, val);
4568 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4569 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4570 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4571 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4573 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4574 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4575 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4576 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4577 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4578 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4579 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4580 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4581 #define ALC880_PIN_CD_NID 0x1c
4583 /* fill in the dac_nids table from the parsed pin configuration */
4584 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4585 const struct auto_pin_cfg *cfg)
4591 memset(assigned, 0, sizeof(assigned));
4592 spec->multiout.dac_nids = spec->private_dac_nids;
4594 /* check the pins hardwired to audio widget */
4595 for (i = 0; i < cfg->line_outs; i++) {
4596 nid = cfg->line_out_pins[i];
4597 if (alc880_is_fixed_pin(nid)) {
4598 int idx = alc880_fixed_pin_idx(nid);
4599 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4603 /* left pins can be connect to any audio widget */
4604 for (i = 0; i < cfg->line_outs; i++) {
4605 nid = cfg->line_out_pins[i];
4606 if (alc880_is_fixed_pin(nid))
4608 /* search for an empty channel */
4609 for (j = 0; j < cfg->line_outs; j++) {
4611 spec->multiout.dac_nids[i] =
4612 alc880_idx_to_dac(j);
4618 spec->multiout.num_dacs = cfg->line_outs;
4622 /* add playback controls from the parsed DAC table */
4623 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4624 const struct auto_pin_cfg *cfg)
4626 static const char *chname[4] = {
4627 "Front", "Surround", NULL /*CLFE*/, "Side"
4632 for (i = 0; i < cfg->line_outs; i++) {
4633 if (!spec->multiout.dac_nids[i])
4635 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4638 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4640 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4644 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4646 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4650 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4652 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4656 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4658 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4664 if (cfg->line_outs == 1 &&
4665 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4669 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4670 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4674 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4675 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4684 /* add playback controls for speaker and HP outputs */
4685 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4694 if (alc880_is_fixed_pin(pin)) {
4695 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4696 /* specify the DAC as the extra output */
4697 if (!spec->multiout.hp_nid)
4698 spec->multiout.hp_nid = nid;
4700 spec->multiout.extra_out_nid[0] = nid;
4701 /* control HP volume/switch on the output mixer amp */
4702 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4703 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4704 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4707 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4708 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4711 } else if (alc880_is_multi_pin(pin)) {
4712 /* set manual connection */
4713 /* we have only a switch on HP-out PIN */
4714 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4715 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4722 /* create input playback/capture controls for the given pin */
4723 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4724 const char *ctlname,
4725 int idx, hda_nid_t mix_nid)
4729 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4730 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4733 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4734 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4740 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4742 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4743 return (pincap & AC_PINCAP_IN) != 0;
4746 /* create playback/capture controls for input pins */
4747 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4748 const struct auto_pin_cfg *cfg,
4750 hda_nid_t cap1, hda_nid_t cap2)
4752 struct alc_spec *spec = codec->spec;
4753 struct hda_input_mux *imux = &spec->private_imux[0];
4756 for (i = 0; i < AUTO_PIN_LAST; i++) {
4759 pin = cfg->input_pins[i];
4760 if (!alc_is_input_pin(codec, pin))
4764 idx = get_connection_index(codec, mixer, pin);
4766 err = new_analog_input(spec, pin,
4767 auto_pin_cfg_labels[i],
4776 idx = get_connection_index(codec, cap1, pin);
4777 if (idx < 0 && cap2)
4778 idx = get_connection_index(codec, cap2, pin);
4780 imux->items[imux->num_items].label =
4781 auto_pin_cfg_labels[i];
4782 imux->items[imux->num_items].index = idx;
4789 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4790 const struct auto_pin_cfg *cfg)
4792 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4795 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4796 unsigned int pin_type)
4798 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4801 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4805 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4806 hda_nid_t nid, int pin_type,
4809 alc_set_pin_output(codec, nid, pin_type);
4810 /* need the manual connection? */
4811 if (alc880_is_multi_pin(nid)) {
4812 struct alc_spec *spec = codec->spec;
4813 int idx = alc880_multi_pin_idx(nid);
4814 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4815 AC_VERB_SET_CONNECT_SEL,
4816 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4820 static int get_pin_type(int line_out_type)
4822 if (line_out_type == AUTO_PIN_HP_OUT)
4828 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4830 struct alc_spec *spec = codec->spec;
4833 for (i = 0; i < spec->autocfg.line_outs; i++) {
4834 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4835 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4836 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4840 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4842 struct alc_spec *spec = codec->spec;
4845 pin = spec->autocfg.speaker_pins[0];
4846 if (pin) /* connect to front */
4847 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4848 pin = spec->autocfg.hp_pins[0];
4849 if (pin) /* connect to front */
4850 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4853 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4855 struct alc_spec *spec = codec->spec;
4858 for (i = 0; i < AUTO_PIN_LAST; i++) {
4859 hda_nid_t nid = spec->autocfg.input_pins[i];
4860 if (alc_is_input_pin(codec, nid)) {
4861 alc_set_input_pin(codec, nid, i);
4862 if (nid != ALC880_PIN_CD_NID &&
4863 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4864 snd_hda_codec_write(codec, nid, 0,
4865 AC_VERB_SET_AMP_GAIN_MUTE,
4871 /* parse the BIOS configuration and set up the alc_spec */
4872 /* return 1 if successful, 0 if the proper config is not found,
4873 * or a negative error code
4875 static int alc880_parse_auto_config(struct hda_codec *codec)
4877 struct alc_spec *spec = codec->spec;
4879 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4881 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4885 if (!spec->autocfg.line_outs)
4886 return 0; /* can't find valid BIOS pin config */
4888 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4891 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4894 err = alc880_auto_create_extra_out(spec,
4895 spec->autocfg.speaker_pins[0],
4899 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4903 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4907 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4909 /* check multiple SPDIF-out (for recent codecs) */
4910 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4912 err = snd_hda_get_connections(codec,
4913 spec->autocfg.dig_out_pins[i],
4918 spec->multiout.dig_out_nid = dig_nid;
4920 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4921 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4923 spec->slave_dig_outs[i - 1] = dig_nid;
4926 if (spec->autocfg.dig_in_pin)
4927 spec->dig_in_nid = ALC880_DIGIN_NID;
4929 if (spec->kctls.list)
4930 add_mixer(spec, spec->kctls.list);
4932 add_verb(spec, alc880_volume_init_verbs);
4934 spec->num_mux_defs = 1;
4935 spec->input_mux = &spec->private_imux[0];
4937 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4942 /* additional initialization for auto-configuration model */
4943 static void alc880_auto_init(struct hda_codec *codec)
4945 struct alc_spec *spec = codec->spec;
4946 alc880_auto_init_multi_out(codec);
4947 alc880_auto_init_extra_out(codec);
4948 alc880_auto_init_analog_input(codec);
4949 if (spec->unsol_event)
4950 alc_inithook(codec);
4953 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4954 * one of two digital mic pins, e.g. on ALC272
4956 static void fixup_automic_adc(struct hda_codec *codec)
4958 struct alc_spec *spec = codec->spec;
4961 for (i = 0; i < spec->num_adc_nids; i++) {
4962 hda_nid_t cap = spec->capsrc_nids ?
4963 spec->capsrc_nids[i] : spec->adc_nids[i];
4966 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4969 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4972 spec->int_mic.mux_idx = iidx;
4973 spec->ext_mic.mux_idx = eidx;
4974 if (spec->capsrc_nids)
4975 spec->capsrc_nids += i;
4976 spec->adc_nids += i;
4977 spec->num_adc_nids = 1;
4980 snd_printd(KERN_INFO "hda_codec: %s: "
4981 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4982 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4983 spec->auto_mic = 0; /* disable auto-mic to be sure */
4986 /* choose the ADC/MUX containing the input pin and initialize the setup */
4987 static void fixup_single_adc(struct hda_codec *codec)
4989 struct alc_spec *spec = codec->spec;
4993 /* search for the input pin; there must be only one */
4994 for (i = 0; i < AUTO_PIN_LAST; i++) {
4995 if (spec->autocfg.input_pins[i]) {
4996 pin = spec->autocfg.input_pins[i];
5003 /* set the default connection to that pin */
5004 for (i = 0; i < spec->num_adc_nids; i++) {
5005 hda_nid_t cap = spec->capsrc_nids ?
5006 spec->capsrc_nids[i] : spec->adc_nids[i];
5009 idx = get_connection_index(codec, cap, pin);
5012 /* use only this ADC */
5013 if (spec->capsrc_nids)
5014 spec->capsrc_nids += i;
5015 spec->adc_nids += i;
5016 spec->num_adc_nids = 1;
5017 /* select or unmute this route */
5018 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5019 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5022 snd_hda_codec_write_cache(codec, cap, 0,
5023 AC_VERB_SET_CONNECT_SEL, idx);
5029 static void set_capture_mixer(struct hda_codec *codec)
5031 struct alc_spec *spec = codec->spec;
5032 static struct snd_kcontrol_new *caps[2][3] = {
5033 { alc_capture_mixer_nosrc1,
5034 alc_capture_mixer_nosrc2,
5035 alc_capture_mixer_nosrc3 },
5036 { alc_capture_mixer1,
5038 alc_capture_mixer3 },
5040 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5043 fixup_automic_adc(codec);
5044 else if (spec->input_mux) {
5045 if (spec->input_mux->num_items > 1)
5047 else if (spec->input_mux->num_items == 1)
5048 fixup_single_adc(codec);
5050 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
5054 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5055 #define set_beep_amp(spec, nid, idx, dir) \
5056 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5058 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5062 * OK, here we have finally the patch for ALC880
5065 static int patch_alc880(struct hda_codec *codec)
5067 struct alc_spec *spec;
5071 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5077 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5080 if (board_config < 0) {
5081 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5083 board_config = ALC880_AUTO;
5086 if (board_config == ALC880_AUTO) {
5087 /* automatic parse from the BIOS config */
5088 err = alc880_parse_auto_config(codec);
5094 "hda_codec: Cannot set up configuration "
5095 "from BIOS. Using 3-stack mode...\n");
5096 board_config = ALC880_3ST;
5100 err = snd_hda_attach_beep_device(codec, 0x1);
5106 if (board_config != ALC880_AUTO)
5107 setup_preset(codec, &alc880_presets[board_config]);
5109 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5110 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5111 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5113 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5114 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5116 if (!spec->adc_nids && spec->input_mux) {
5117 /* check whether NID 0x07 is valid */
5118 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5120 wcap = get_wcaps_type(wcap);
5121 if (wcap != AC_WID_AUD_IN) {
5122 spec->adc_nids = alc880_adc_nids_alt;
5123 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5125 spec->adc_nids = alc880_adc_nids;
5126 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5129 set_capture_mixer(codec);
5130 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5132 spec->vmaster_nid = 0x0c;
5134 codec->patch_ops = alc_patch_ops;
5135 if (board_config == ALC880_AUTO)
5136 spec->init_hook = alc880_auto_init;
5137 #ifdef CONFIG_SND_HDA_POWER_SAVE
5138 if (!spec->loopback.amplist)
5139 spec->loopback.amplist = alc880_loopbacks;
5150 static hda_nid_t alc260_dac_nids[1] = {
5155 static hda_nid_t alc260_adc_nids[1] = {
5160 static hda_nid_t alc260_adc_nids_alt[1] = {
5165 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5166 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5168 static hda_nid_t alc260_dual_adc_nids[2] = {
5173 #define ALC260_DIGOUT_NID 0x03
5174 #define ALC260_DIGIN_NID 0x06
5176 static struct hda_input_mux alc260_capture_source = {
5180 { "Front Mic", 0x1 },
5186 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5187 * headphone jack and the internal CD lines since these are the only pins at
5188 * which audio can appear. For flexibility, also allow the option of
5189 * recording the mixer output on the second ADC (ADC0 doesn't have a
5190 * connection to the mixer output).
5192 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5196 { "Mic/Line", 0x0 },
5198 { "Headphone", 0x2 },
5204 { "Mic/Line", 0x0 },
5206 { "Headphone", 0x2 },
5213 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5214 * the Fujitsu S702x, but jacks are marked differently.
5216 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5223 { "Headphone", 0x5 },
5232 { "Headphone", 0x6 },
5238 /* Maxdata Favorit 100XS */
5239 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5243 { "Line/Mic", 0x0 },
5250 { "Line/Mic", 0x0 },
5258 * This is just place-holder, so there's something for alc_build_pcms to look
5259 * at when it calculates the maximum number of channels. ALC260 has no mixer
5260 * element which allows changing the channel mode, so the verb list is
5263 static struct hda_channel_mode alc260_modes[1] = {
5268 /* Mixer combinations
5270 * basic: base_output + input + pc_beep + capture
5271 * HP: base_output + input + capture_alt
5272 * HP_3013: hp_3013 + input + capture
5273 * fujitsu: fujitsu + capture
5274 * acer: acer + capture
5277 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5278 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5279 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5280 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5281 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5282 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5283 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5287 static struct snd_kcontrol_new alc260_input_mixer[] = {
5288 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5289 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5290 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5291 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5293 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5294 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5295 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5299 /* update HP, line and mono out pins according to the master switch */
5300 static void alc260_hp_master_update(struct hda_codec *codec,
5301 hda_nid_t hp, hda_nid_t line,
5304 struct alc_spec *spec = codec->spec;
5305 unsigned int val = spec->master_sw ? PIN_HP : 0;
5306 /* change HP and line-out pins */
5307 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5309 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5311 /* mono (speaker) depending on the HP jack sense */
5312 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5313 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5317 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5318 struct snd_ctl_elem_value *ucontrol)
5320 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5321 struct alc_spec *spec = codec->spec;
5322 *ucontrol->value.integer.value = spec->master_sw;
5326 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5327 struct snd_ctl_elem_value *ucontrol)
5329 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5330 struct alc_spec *spec = codec->spec;
5331 int val = !!*ucontrol->value.integer.value;
5332 hda_nid_t hp, line, mono;
5334 if (val == spec->master_sw)
5336 spec->master_sw = val;
5337 hp = (kcontrol->private_value >> 16) & 0xff;
5338 line = (kcontrol->private_value >> 8) & 0xff;
5339 mono = kcontrol->private_value & 0xff;
5340 alc260_hp_master_update(codec, hp, line, mono);
5344 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5346 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5347 .name = "Master Playback Switch",
5348 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5349 .info = snd_ctl_boolean_mono_info,
5350 .get = alc260_hp_master_sw_get,
5351 .put = alc260_hp_master_sw_put,
5352 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5354 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5355 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5356 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5357 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5358 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5360 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5364 static struct hda_verb alc260_hp_unsol_verbs[] = {
5365 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5369 static void alc260_hp_automute(struct hda_codec *codec)
5371 struct alc_spec *spec = codec->spec;
5373 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5374 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5377 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5379 if ((res >> 26) == ALC880_HP_EVENT)
5380 alc260_hp_automute(codec);
5383 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5385 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5386 .name = "Master Playback Switch",
5387 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5388 .info = snd_ctl_boolean_mono_info,
5389 .get = alc260_hp_master_sw_get,
5390 .put = alc260_hp_master_sw_put,
5391 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5393 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5394 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5395 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5396 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5397 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5399 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5400 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5404 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5405 .ops = &snd_hda_bind_vol,
5407 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5408 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5409 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5414 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5415 .ops = &snd_hda_bind_sw,
5417 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5418 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5423 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5424 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5425 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5426 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5431 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5432 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5436 static void alc260_hp_3013_automute(struct hda_codec *codec)
5438 struct alc_spec *spec = codec->spec;
5440 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5441 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5444 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5447 if ((res >> 26) == ALC880_HP_EVENT)
5448 alc260_hp_3013_automute(codec);
5451 static void alc260_hp_3012_automute(struct hda_codec *codec)
5453 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5455 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5457 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5459 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5463 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5466 if ((res >> 26) == ALC880_HP_EVENT)
5467 alc260_hp_3012_automute(codec);
5470 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5471 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5473 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5474 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5475 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5476 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5477 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5478 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5479 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5480 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5481 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5482 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5483 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5487 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5488 * versions of the ALC260 don't act on requests to enable mic bias from NID
5489 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5490 * datasheet doesn't mention this restriction. At this stage it's not clear
5491 * whether this behaviour is intentional or is a hardware bug in chip
5492 * revisions available in early 2006. Therefore for now allow the
5493 * "Headphone Jack Mode" control to span all choices, but if it turns out
5494 * that the lack of mic bias for this NID is intentional we could change the
5495 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5497 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5498 * don't appear to make the mic bias available from the "line" jack, even
5499 * though the NID used for this jack (0x14) can supply it. The theory is
5500 * that perhaps Acer have included blocking capacitors between the ALC260
5501 * and the output jack. If this turns out to be the case for all such
5502 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5503 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5505 * The C20x Tablet series have a mono internal speaker which is controlled
5506 * via the chip's Mono sum widget and pin complex, so include the necessary
5507 * controls for such models. On models without a "mono speaker" the control
5508 * won't do anything.
5510 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5511 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5512 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5513 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5514 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5516 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5518 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5519 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5521 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5522 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5523 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5524 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5525 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5529 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5531 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5532 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5533 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5534 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5535 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5536 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5537 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5541 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5542 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5544 static struct snd_kcontrol_new alc260_will_mixer[] = {
5545 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5546 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5548 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5549 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5550 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5551 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5552 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5553 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5554 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5558 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5559 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5561 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5562 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5563 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5564 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5565 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5566 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5567 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5568 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5569 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5570 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5571 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5576 * initialization verbs
5578 static struct hda_verb alc260_init_verbs[] = {
5579 /* Line In pin widget for input */
5580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5581 /* CD pin widget for input */
5582 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5583 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5584 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5585 /* Mic2 (front panel) pin widget for input and vref at 80% */
5586 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5587 /* LINE-2 is used for line-out in rear */
5588 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5589 /* select line-out */
5590 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5592 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5594 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5596 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5597 /* mute capture amp left and right */
5598 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5599 /* set connection select to line in (default select for this ADC) */
5600 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5601 /* mute capture amp left and right */
5602 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5603 /* set connection select to line in (default select for this ADC) */
5604 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5605 /* set vol=0 Line-Out mixer amp left and right */
5606 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5607 /* unmute pin widget amp left and right (no gain on this amp) */
5608 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5609 /* set vol=0 HP mixer amp left and right */
5610 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5611 /* unmute pin widget amp left and right (no gain on this amp) */
5612 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5613 /* set vol=0 Mono mixer amp left and right */
5614 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5615 /* unmute pin widget amp left and right (no gain on this amp) */
5616 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5617 /* unmute LINE-2 out pin */
5618 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5619 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5622 /* mute analog inputs */
5623 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5626 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5627 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5628 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5629 /* mute Front out path */
5630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5632 /* mute Headphone out path */
5633 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5634 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5635 /* mute Mono out path */
5636 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5637 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5641 #if 0 /* should be identical with alc260_init_verbs? */
5642 static struct hda_verb alc260_hp_init_verbs[] = {
5643 /* Headphone and output */
5644 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5646 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5647 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5648 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5649 /* Mic2 (front panel) pin widget for input and vref at 80% */
5650 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5651 /* Line In pin widget for input */
5652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5653 /* Line-2 pin widget for output */
5654 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5655 /* CD pin widget for input */
5656 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5657 /* unmute amp left and right */
5658 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5659 /* set connection select to line in (default select for this ADC) */
5660 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5661 /* unmute Line-Out mixer amp left and right (volume = 0) */
5662 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5663 /* mute pin widget amp left and right (no gain on this amp) */
5664 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5665 /* unmute HP mixer amp left and right (volume = 0) */
5666 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5667 /* mute pin widget amp left and right (no gain on this amp) */
5668 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5669 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5672 /* mute analog inputs */
5673 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5674 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5675 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5676 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5677 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5678 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5679 /* Unmute Front out path */
5680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5682 /* Unmute Headphone out path */
5683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5685 /* Unmute Mono out path */
5686 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5687 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5692 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5693 /* Line out and output */
5694 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5696 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5697 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5698 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5699 /* Mic2 (front panel) pin widget for input and vref at 80% */
5700 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5701 /* Line In pin widget for input */
5702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5703 /* Headphone pin widget for output */
5704 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5705 /* CD pin widget for input */
5706 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5707 /* unmute amp left and right */
5708 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5709 /* set connection select to line in (default select for this ADC) */
5710 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5711 /* unmute Line-Out mixer amp left and right (volume = 0) */
5712 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5713 /* mute pin widget amp left and right (no gain on this amp) */
5714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5715 /* unmute HP mixer amp left and right (volume = 0) */
5716 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5717 /* mute pin widget amp left and right (no gain on this amp) */
5718 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5719 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5722 /* mute analog inputs */
5723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5725 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5727 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5728 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5729 /* Unmute Front out path */
5730 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5731 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5732 /* Unmute Headphone out path */
5733 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5734 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5735 /* Unmute Mono out path */
5736 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5737 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5741 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5742 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5743 * audio = 0x16, internal speaker = 0x10.
5745 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5746 /* Disable all GPIOs */
5747 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5748 /* Internal speaker is connected to headphone pin */
5749 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5750 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5751 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5752 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5753 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5754 /* Ensure all other unused pins are disabled and muted. */
5755 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5756 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5757 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5758 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5759 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5760 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5761 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5762 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5764 /* Disable digital (SPDIF) pins */
5765 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5766 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5768 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5769 * when acting as an output.
5771 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5773 /* Start with output sum widgets muted and their output gains at min */
5774 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5775 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5776 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5777 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5778 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5779 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5780 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5781 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5782 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5784 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5785 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5786 /* Unmute Line1 pin widget output buffer since it starts as an output.
5787 * If the pin mode is changed by the user the pin mode control will
5788 * take care of enabling the pin's input/output buffers as needed.
5789 * Therefore there's no need to enable the input buffer at this
5792 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5793 /* Unmute input buffer of pin widget used for Line-in (no equiv
5796 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5798 /* Mute capture amp left and right */
5799 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5800 /* Set ADC connection select to match default mixer setting - line
5803 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5805 /* Do the same for the second ADC: mute capture input amp and
5806 * set ADC connection to line in (on mic1 pin)
5808 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5809 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5811 /* Mute all inputs to mixer widget (even unconnected ones) */
5812 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5813 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5814 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5815 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5816 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5817 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5824 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5825 * similar laptops (adapted from Fujitsu init verbs).
5827 static struct hda_verb alc260_acer_init_verbs[] = {
5828 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5829 * the headphone jack. Turn this on and rely on the standard mute
5830 * methods whenever the user wants to turn these outputs off.
5832 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5833 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5834 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5835 /* Internal speaker/Headphone jack is connected to Line-out pin */
5836 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5837 /* Internal microphone/Mic jack is connected to Mic1 pin */
5838 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5839 /* Line In jack is connected to Line1 pin */
5840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5841 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5842 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5843 /* Ensure all other unused pins are disabled and muted. */
5844 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5845 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5846 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5847 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5849 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5850 /* Disable digital (SPDIF) pins */
5851 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5852 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5854 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5855 * bus when acting as outputs.
5857 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5858 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5860 /* Start with output sum widgets muted and their output gains at min */
5861 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5862 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5863 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5864 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5865 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5866 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5867 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5868 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5869 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5871 /* Unmute Line-out pin widget amp left and right
5872 * (no equiv mixer ctrl)
5874 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5875 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5876 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5877 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5878 * inputs. If the pin mode is changed by the user the pin mode control
5879 * will take care of enabling the pin's input/output buffers as needed.
5880 * Therefore there's no need to enable the input buffer at this
5883 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5884 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5886 /* Mute capture amp left and right */
5887 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5888 /* Set ADC connection select to match default mixer setting - mic
5891 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5893 /* Do similar with the second ADC: mute capture input amp and
5894 * set ADC connection to mic to match ALSA's default state.
5896 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5897 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5899 /* Mute all inputs to mixer widget (even unconnected ones) */
5900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5902 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5912 /* Initialisation sequence for Maxdata Favorit 100XS
5913 * (adapted from Acer init verbs).
5915 static struct hda_verb alc260_favorit100_init_verbs[] = {
5916 /* GPIO 0 enables the output jack.
5917 * Turn this on and rely on the standard mute
5918 * methods whenever the user wants to turn these outputs off.
5920 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5921 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5922 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5923 /* Line/Mic input jack is connected to Mic1 pin */
5924 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5925 /* Ensure all other unused pins are disabled and muted. */
5926 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5927 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5928 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5929 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5930 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5931 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5932 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5933 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5934 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5936 /* Disable digital (SPDIF) pins */
5937 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5938 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5940 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5941 * bus when acting as outputs.
5943 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5944 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5946 /* Start with output sum widgets muted and their output gains at min */
5947 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5948 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5949 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5950 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5951 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5952 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5953 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5954 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5955 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5957 /* Unmute Line-out pin widget amp left and right
5958 * (no equiv mixer ctrl)
5960 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5961 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5962 * inputs. If the pin mode is changed by the user the pin mode control
5963 * will take care of enabling the pin's input/output buffers as needed.
5964 * Therefore there's no need to enable the input buffer at this
5967 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5969 /* Mute capture amp left and right */
5970 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5971 /* Set ADC connection select to match default mixer setting - mic
5974 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5976 /* Do similar with the second ADC: mute capture input amp and
5977 * set ADC connection to mic to match ALSA's default state.
5979 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5980 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5982 /* Mute all inputs to mixer widget (even unconnected ones) */
5983 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5984 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5985 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5989 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5990 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5995 static struct hda_verb alc260_will_verbs[] = {
5996 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5997 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5998 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5999 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6000 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6001 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6005 static struct hda_verb alc260_replacer_672v_verbs[] = {
6006 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6007 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6008 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6010 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6011 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6012 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6014 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6018 /* toggle speaker-output according to the hp-jack state */
6019 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6021 unsigned int present;
6023 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6024 present = snd_hda_jack_detect(codec, 0x0f);
6026 snd_hda_codec_write_cache(codec, 0x01, 0,
6027 AC_VERB_SET_GPIO_DATA, 1);
6028 snd_hda_codec_write_cache(codec, 0x0f, 0,
6029 AC_VERB_SET_PIN_WIDGET_CONTROL,
6032 snd_hda_codec_write_cache(codec, 0x01, 0,
6033 AC_VERB_SET_GPIO_DATA, 0);
6034 snd_hda_codec_write_cache(codec, 0x0f, 0,
6035 AC_VERB_SET_PIN_WIDGET_CONTROL,
6040 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6043 if ((res >> 26) == ALC880_HP_EVENT)
6044 alc260_replacer_672v_automute(codec);
6047 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6048 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6049 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6050 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6051 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6052 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6053 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6054 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6055 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6056 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6057 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6061 /* Test configuration for debugging, modelled after the ALC880 test
6064 #ifdef CONFIG_SND_DEBUG
6065 static hda_nid_t alc260_test_dac_nids[1] = {
6068 static hda_nid_t alc260_test_adc_nids[2] = {
6071 /* For testing the ALC260, each input MUX needs its own definition since
6072 * the signal assignments are different. This assumes that the first ADC
6075 static struct hda_input_mux alc260_test_capture_sources[2] = {
6079 { "MIC1 pin", 0x0 },
6080 { "MIC2 pin", 0x1 },
6081 { "LINE1 pin", 0x2 },
6082 { "LINE2 pin", 0x3 },
6084 { "LINE-OUT pin", 0x5 },
6085 { "HP-OUT pin", 0x6 },
6091 { "MIC1 pin", 0x0 },
6092 { "MIC2 pin", 0x1 },
6093 { "LINE1 pin", 0x2 },
6094 { "LINE2 pin", 0x3 },
6097 { "LINE-OUT pin", 0x6 },
6098 { "HP-OUT pin", 0x7 },
6102 static struct snd_kcontrol_new alc260_test_mixer[] = {
6103 /* Output driver widgets */
6104 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6105 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6106 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6107 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6108 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6109 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6111 /* Modes for retasking pin widgets
6112 * Note: the ALC260 doesn't seem to act on requests to enable mic
6113 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6114 * mention this restriction. At this stage it's not clear whether
6115 * this behaviour is intentional or is a hardware bug in chip
6116 * revisions available at least up until early 2006. Therefore for
6117 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6118 * choices, but if it turns out that the lack of mic bias for these
6119 * NIDs is intentional we could change their modes from
6120 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6122 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6123 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6124 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6125 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6126 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6127 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6129 /* Loopback mixer controls */
6130 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6131 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6132 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6133 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6134 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6135 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6136 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6137 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6138 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6139 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6140 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6141 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6142 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6143 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6145 /* Controls for GPIO pins, assuming they are configured as outputs */
6146 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6147 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6148 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6149 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6151 /* Switches to allow the digital IO pins to be enabled. The datasheet
6152 * is ambigious as to which NID is which; testing on laptops which
6153 * make this output available should provide clarification.
6155 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6156 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6158 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6159 * this output to turn on an external amplifier.
6161 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6162 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6166 static struct hda_verb alc260_test_init_verbs[] = {
6167 /* Enable all GPIOs as outputs with an initial value of 0 */
6168 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6169 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6170 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6172 /* Enable retasking pins as output, initially without power amp */
6173 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6174 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6177 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6178 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6180 /* Disable digital (SPDIF) pins initially, but users can enable
6181 * them via a mixer switch. In the case of SPDIF-out, this initverb
6182 * payload also sets the generation to 0, output to be in "consumer"
6183 * PCM format, copyright asserted, no pre-emphasis and no validity
6186 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6187 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6189 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6190 * OUT1 sum bus when acting as an output.
6192 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6193 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6194 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6195 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6197 /* Start with output sum widgets muted and their output gains at min */
6198 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6199 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6201 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6202 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6203 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6204 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6205 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6206 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6208 /* Unmute retasking pin widget output buffers since the default
6209 * state appears to be output. As the pin mode is changed by the
6210 * user the pin mode control will take care of enabling the pin's
6211 * input/output buffers as needed.
6213 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6214 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6215 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6216 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6217 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6218 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6219 /* Also unmute the mono-out pin widget */
6220 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6222 /* Mute capture amp left and right */
6223 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6224 /* Set ADC connection select to match default mixer setting (mic1
6227 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6229 /* Do the same for the second ADC: mute capture input amp and
6230 * set ADC connection to mic1 pin
6232 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6233 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6235 /* Mute all inputs to mixer widget (even unconnected ones) */
6236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6239 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6240 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6242 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6243 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6249 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6250 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6252 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6253 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6256 * for BIOS auto-configuration
6259 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6260 const char *pfx, int *vol_bits)
6263 unsigned long vol_val, sw_val;
6266 if (nid >= 0x0f && nid < 0x11) {
6267 nid_vol = nid - 0x7;
6268 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6269 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6270 } else if (nid == 0x11) {
6271 nid_vol = nid - 0x7;
6272 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6273 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6274 } else if (nid >= 0x12 && nid <= 0x15) {
6276 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6277 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6281 if (!(*vol_bits & (1 << nid_vol))) {
6282 /* first control for the volume widget */
6283 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6286 *vol_bits |= (1 << nid_vol);
6288 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6294 /* add playback controls from the parsed DAC table */
6295 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6296 const struct auto_pin_cfg *cfg)
6302 spec->multiout.num_dacs = 1;
6303 spec->multiout.dac_nids = spec->private_dac_nids;
6304 spec->multiout.dac_nids[0] = 0x02;
6306 nid = cfg->line_out_pins[0];
6309 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6311 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6315 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6320 nid = cfg->speaker_pins[0];
6322 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6327 nid = cfg->hp_pins[0];
6329 err = alc260_add_playback_controls(spec, nid, "Headphone",
6337 /* create playback/capture controls for input pins */
6338 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6339 const struct auto_pin_cfg *cfg)
6341 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6344 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6345 hda_nid_t nid, int pin_type,
6348 alc_set_pin_output(codec, nid, pin_type);
6349 /* need the manual connection? */
6351 int idx = nid - 0x12;
6352 snd_hda_codec_write(codec, idx + 0x0b, 0,
6353 AC_VERB_SET_CONNECT_SEL, sel_idx);
6357 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6359 struct alc_spec *spec = codec->spec;
6362 nid = spec->autocfg.line_out_pins[0];
6364 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6365 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6368 nid = spec->autocfg.speaker_pins[0];
6370 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6372 nid = spec->autocfg.hp_pins[0];
6374 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6377 #define ALC260_PIN_CD_NID 0x16
6378 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6380 struct alc_spec *spec = codec->spec;
6383 for (i = 0; i < AUTO_PIN_LAST; i++) {
6384 hda_nid_t nid = spec->autocfg.input_pins[i];
6386 alc_set_input_pin(codec, nid, i);
6387 if (nid != ALC260_PIN_CD_NID &&
6388 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6389 snd_hda_codec_write(codec, nid, 0,
6390 AC_VERB_SET_AMP_GAIN_MUTE,
6397 * generic initialization of ADC, input mixers and output mixers
6399 static struct hda_verb alc260_volume_init_verbs[] = {
6401 * Unmute ADC0-1 and set the default input to mic-in
6403 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6404 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6405 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6406 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6408 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6410 * Note: PASD motherboards uses the Line In 2 as the input for
6411 * front panel mic (mic 2)
6413 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6414 /* mute analog inputs */
6415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6422 * Set up output mixers (0x08 - 0x0a)
6424 /* set vol=0 to output mixers */
6425 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6426 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6427 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6428 /* set up input amps for analog loopback */
6429 /* Amp Indices: DAC = 0, mixer = 1 */
6430 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6432 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6433 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6434 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6435 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6440 static int alc260_parse_auto_config(struct hda_codec *codec)
6442 struct alc_spec *spec = codec->spec;
6444 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6446 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6450 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6453 if (!spec->kctls.list)
6454 return 0; /* can't find valid BIOS pin config */
6455 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6459 spec->multiout.max_channels = 2;
6461 if (spec->autocfg.dig_outs)
6462 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6463 if (spec->kctls.list)
6464 add_mixer(spec, spec->kctls.list);
6466 add_verb(spec, alc260_volume_init_verbs);
6468 spec->num_mux_defs = 1;
6469 spec->input_mux = &spec->private_imux[0];
6471 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6476 /* additional initialization for auto-configuration model */
6477 static void alc260_auto_init(struct hda_codec *codec)
6479 struct alc_spec *spec = codec->spec;
6480 alc260_auto_init_multi_out(codec);
6481 alc260_auto_init_analog_input(codec);
6482 if (spec->unsol_event)
6483 alc_inithook(codec);
6486 #ifdef CONFIG_SND_HDA_POWER_SAVE
6487 static struct hda_amp_list alc260_loopbacks[] = {
6488 { 0x07, HDA_INPUT, 0 },
6489 { 0x07, HDA_INPUT, 1 },
6490 { 0x07, HDA_INPUT, 2 },
6491 { 0x07, HDA_INPUT, 3 },
6492 { 0x07, HDA_INPUT, 4 },
6498 * ALC260 configurations
6500 static const char *alc260_models[ALC260_MODEL_LAST] = {
6501 [ALC260_BASIC] = "basic",
6503 [ALC260_HP_3013] = "hp-3013",
6504 [ALC260_HP_DC7600] = "hp-dc7600",
6505 [ALC260_FUJITSU_S702X] = "fujitsu",
6506 [ALC260_ACER] = "acer",
6507 [ALC260_WILL] = "will",
6508 [ALC260_REPLACER_672V] = "replacer",
6509 [ALC260_FAVORIT100] = "favorit100",
6510 #ifdef CONFIG_SND_DEBUG
6511 [ALC260_TEST] = "test",
6513 [ALC260_AUTO] = "auto",
6516 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6517 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6518 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6519 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6520 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6521 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6522 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6523 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6524 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6525 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6526 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6527 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6528 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6529 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6530 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6531 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6532 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6533 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6534 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6535 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6536 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6540 static struct alc_config_preset alc260_presets[] = {
6542 .mixers = { alc260_base_output_mixer,
6543 alc260_input_mixer },
6544 .init_verbs = { alc260_init_verbs },
6545 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6546 .dac_nids = alc260_dac_nids,
6547 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6548 .adc_nids = alc260_dual_adc_nids,
6549 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6550 .channel_mode = alc260_modes,
6551 .input_mux = &alc260_capture_source,
6554 .mixers = { alc260_hp_output_mixer,
6555 alc260_input_mixer },
6556 .init_verbs = { alc260_init_verbs,
6557 alc260_hp_unsol_verbs },
6558 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6559 .dac_nids = alc260_dac_nids,
6560 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6561 .adc_nids = alc260_adc_nids_alt,
6562 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6563 .channel_mode = alc260_modes,
6564 .input_mux = &alc260_capture_source,
6565 .unsol_event = alc260_hp_unsol_event,
6566 .init_hook = alc260_hp_automute,
6568 [ALC260_HP_DC7600] = {
6569 .mixers = { alc260_hp_dc7600_mixer,
6570 alc260_input_mixer },
6571 .init_verbs = { alc260_init_verbs,
6572 alc260_hp_dc7600_verbs },
6573 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6574 .dac_nids = alc260_dac_nids,
6575 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6576 .adc_nids = alc260_adc_nids_alt,
6577 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6578 .channel_mode = alc260_modes,
6579 .input_mux = &alc260_capture_source,
6580 .unsol_event = alc260_hp_3012_unsol_event,
6581 .init_hook = alc260_hp_3012_automute,
6583 [ALC260_HP_3013] = {
6584 .mixers = { alc260_hp_3013_mixer,
6585 alc260_input_mixer },
6586 .init_verbs = { alc260_hp_3013_init_verbs,
6587 alc260_hp_3013_unsol_verbs },
6588 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6589 .dac_nids = alc260_dac_nids,
6590 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6591 .adc_nids = alc260_adc_nids_alt,
6592 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6593 .channel_mode = alc260_modes,
6594 .input_mux = &alc260_capture_source,
6595 .unsol_event = alc260_hp_3013_unsol_event,
6596 .init_hook = alc260_hp_3013_automute,
6598 [ALC260_FUJITSU_S702X] = {
6599 .mixers = { alc260_fujitsu_mixer },
6600 .init_verbs = { alc260_fujitsu_init_verbs },
6601 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6602 .dac_nids = alc260_dac_nids,
6603 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6604 .adc_nids = alc260_dual_adc_nids,
6605 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6606 .channel_mode = alc260_modes,
6607 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6608 .input_mux = alc260_fujitsu_capture_sources,
6611 .mixers = { alc260_acer_mixer },
6612 .init_verbs = { alc260_acer_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_acer_capture_sources),
6620 .input_mux = alc260_acer_capture_sources,
6622 [ALC260_FAVORIT100] = {
6623 .mixers = { alc260_favorit100_mixer },
6624 .init_verbs = { alc260_favorit100_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_favorit100_capture_sources),
6632 .input_mux = alc260_favorit100_capture_sources,
6635 .mixers = { alc260_will_mixer },
6636 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6637 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6638 .dac_nids = alc260_dac_nids,
6639 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6640 .adc_nids = alc260_adc_nids,
6641 .dig_out_nid = ALC260_DIGOUT_NID,
6642 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6643 .channel_mode = alc260_modes,
6644 .input_mux = &alc260_capture_source,
6646 [ALC260_REPLACER_672V] = {
6647 .mixers = { alc260_replacer_672v_mixer },
6648 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_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,
6657 .unsol_event = alc260_replacer_672v_unsol_event,
6658 .init_hook = alc260_replacer_672v_automute,
6660 #ifdef CONFIG_SND_DEBUG
6662 .mixers = { alc260_test_mixer },
6663 .init_verbs = { alc260_test_init_verbs },
6664 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6665 .dac_nids = alc260_test_dac_nids,
6666 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6667 .adc_nids = alc260_test_adc_nids,
6668 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6669 .channel_mode = alc260_modes,
6670 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6671 .input_mux = alc260_test_capture_sources,
6676 static int patch_alc260(struct hda_codec *codec)
6678 struct alc_spec *spec;
6679 int err, board_config;
6681 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6687 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6690 if (board_config < 0) {
6691 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6693 board_config = ALC260_AUTO;
6696 if (board_config == ALC260_AUTO) {
6697 /* automatic parse from the BIOS config */
6698 err = alc260_parse_auto_config(codec);
6704 "hda_codec: Cannot set up configuration "
6705 "from BIOS. Using base mode...\n");
6706 board_config = ALC260_BASIC;
6710 err = snd_hda_attach_beep_device(codec, 0x1);
6716 if (board_config != ALC260_AUTO)
6717 setup_preset(codec, &alc260_presets[board_config]);
6719 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6720 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6722 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6723 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6725 if (!spec->adc_nids && spec->input_mux) {
6726 /* check whether NID 0x04 is valid */
6727 unsigned int wcap = get_wcaps(codec, 0x04);
6728 wcap = get_wcaps_type(wcap);
6730 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6731 spec->adc_nids = alc260_adc_nids_alt;
6732 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6734 spec->adc_nids = alc260_adc_nids;
6735 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6738 set_capture_mixer(codec);
6739 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6741 spec->vmaster_nid = 0x08;
6743 codec->patch_ops = alc_patch_ops;
6744 if (board_config == ALC260_AUTO)
6745 spec->init_hook = alc260_auto_init;
6746 #ifdef CONFIG_SND_HDA_POWER_SAVE
6747 if (!spec->loopback.amplist)
6748 spec->loopback.amplist = alc260_loopbacks;
6756 * ALC882/883/885/888/889 support
6758 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6759 * configuration. Each pin widget can choose any input DACs and a mixer.
6760 * Each ADC is connected from a mixer of all inputs. This makes possible
6761 * 6-channel independent captures.
6763 * In addition, an independent DAC for the multi-playback (not used in this
6766 #define ALC882_DIGOUT_NID 0x06
6767 #define ALC882_DIGIN_NID 0x0a
6768 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6769 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6770 #define ALC1200_DIGOUT_NID 0x10
6773 static struct hda_channel_mode alc882_ch_modes[1] = {
6778 static hda_nid_t alc882_dac_nids[4] = {
6779 /* front, rear, clfe, rear_surr */
6780 0x02, 0x03, 0x04, 0x05
6782 #define alc883_dac_nids alc882_dac_nids
6785 #define alc882_adc_nids alc880_adc_nids
6786 #define alc882_adc_nids_alt alc880_adc_nids_alt
6787 #define alc883_adc_nids alc882_adc_nids_alt
6788 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6789 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6790 #define alc889_adc_nids alc880_adc_nids
6792 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6793 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6794 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6795 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6796 #define alc889_capsrc_nids alc882_capsrc_nids
6799 /* FIXME: should be a matrix-type input source selection */
6801 static struct hda_input_mux alc882_capture_source = {
6805 { "Front Mic", 0x1 },
6811 #define alc883_capture_source alc882_capture_source
6813 static struct hda_input_mux alc889_capture_source = {
6816 { "Front Mic", 0x0 },
6822 static struct hda_input_mux mb5_capture_source = {
6831 static struct hda_input_mux macmini3_capture_source = {
6839 static struct hda_input_mux alc883_3stack_6ch_intel = {
6843 { "Front Mic", 0x0 },
6849 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6857 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6867 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6875 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6879 { "Front Mic", 0x1 },
6884 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6892 static struct hda_input_mux alc889A_mb31_capture_source = {
6896 /* Front Mic (0x01) unused */
6898 /* Line 2 (0x03) unused */
6899 /* CD (0x04) unused? */
6906 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6913 static struct hda_verb alc882_3ST_ch2_init[] = {
6914 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6915 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6916 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6917 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6924 static struct hda_verb alc882_3ST_ch4_init[] = {
6925 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6926 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6927 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6928 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6929 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6936 static struct hda_verb alc882_3ST_ch6_init[] = {
6937 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6938 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6939 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6940 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6941 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6942 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6946 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6947 { 2, alc882_3ST_ch2_init },
6948 { 4, alc882_3ST_ch4_init },
6949 { 6, alc882_3ST_ch6_init },
6952 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6957 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6958 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6959 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6960 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6961 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6962 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6969 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6970 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
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_OUT },
6974 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6975 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6982 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6983 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6984 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6985 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6986 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6987 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6988 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6989 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6993 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6994 { 2, alc883_3ST_ch2_clevo_init },
6995 { 4, alc883_3ST_ch4_clevo_init },
6996 { 6, alc883_3ST_ch6_clevo_init },
7003 static struct hda_verb alc882_sixstack_ch6_init[] = {
7004 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7005 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7006 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7007 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7014 static struct hda_verb alc882_sixstack_ch8_init[] = {
7015 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7016 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7017 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7018 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7022 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7023 { 6, alc882_sixstack_ch6_init },
7024 { 8, alc882_sixstack_ch8_init },
7028 /* Macbook Air 2,1 */
7030 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7035 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7041 static struct hda_verb alc885_mbp_ch2_init[] = {
7042 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7043 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7044 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7051 static struct hda_verb alc885_mbp_ch4_init[] = {
7052 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7053 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7054 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7055 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7056 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7060 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7061 { 2, alc885_mbp_ch2_init },
7062 { 4, alc885_mbp_ch4_init },
7067 * Speakers/Woofer/HP = Front
7070 static struct hda_verb alc885_mb5_ch2_init[] = {
7071 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7072 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7078 * Speakers/HP = Front
7082 static struct hda_verb alc885_mb5_ch6_init[] = {
7083 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7084 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7085 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7089 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7090 { 2, alc885_mb5_ch2_init },
7091 { 6, alc885_mb5_ch6_init },
7094 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7099 static struct hda_verb alc883_4ST_ch2_init[] = {
7100 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7101 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7102 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7103 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7104 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7105 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7112 static struct hda_verb alc883_4ST_ch4_init[] = {
7113 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7114 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7115 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7116 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7117 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7118 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7119 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7126 static struct hda_verb alc883_4ST_ch6_init[] = {
7127 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7128 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7129 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7130 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7131 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7132 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7133 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7134 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7141 static struct hda_verb alc883_4ST_ch8_init[] = {
7142 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7143 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7144 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7145 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7146 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7147 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7148 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7149 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7150 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7154 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7155 { 2, alc883_4ST_ch2_init },
7156 { 4, alc883_4ST_ch4_init },
7157 { 6, alc883_4ST_ch6_init },
7158 { 8, alc883_4ST_ch8_init },
7165 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7166 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7167 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7168 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7169 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7176 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7177 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7178 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7179 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7180 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7181 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7188 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7189 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7190 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7191 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7192 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7193 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7194 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7198 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7199 { 2, alc883_3ST_ch2_intel_init },
7200 { 4, alc883_3ST_ch4_intel_init },
7201 { 6, alc883_3ST_ch6_intel_init },
7207 static struct hda_verb alc889_ch2_intel_init[] = {
7208 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7209 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7210 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7211 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7212 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7213 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7220 static struct hda_verb alc889_ch6_intel_init[] = {
7221 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7222 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7223 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7224 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7225 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7226 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7233 static struct hda_verb alc889_ch8_intel_init[] = {
7234 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7235 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7236 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7237 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7238 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7239 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7240 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7244 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7245 { 2, alc889_ch2_intel_init },
7246 { 6, alc889_ch6_intel_init },
7247 { 8, alc889_ch8_intel_init },
7253 static struct hda_verb alc883_sixstack_ch6_init[] = {
7254 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7255 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7256 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7257 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7264 static struct hda_verb alc883_sixstack_ch8_init[] = {
7265 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7266 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7267 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7268 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7272 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7273 { 6, alc883_sixstack_ch6_init },
7274 { 8, alc883_sixstack_ch8_init },
7278 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7279 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7281 static struct snd_kcontrol_new alc882_base_mixer[] = {
7282 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7283 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7284 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7285 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7286 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7287 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7288 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7289 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7290 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7291 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7293 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7294 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7295 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7296 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7298 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7299 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7300 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7301 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7302 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7306 /* Macbook Air 2,1 same control for HP and internal Speaker */
7308 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7309 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7310 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7315 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7316 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7317 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7318 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7319 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7320 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7321 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7322 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7323 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7324 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7325 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7326 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7330 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7331 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7332 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7333 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7334 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7335 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7336 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7337 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7338 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7339 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7340 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7342 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7343 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7344 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7348 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7349 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7350 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7351 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7352 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7353 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7354 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7355 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7356 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7358 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7359 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7363 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7364 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7365 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7366 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7367 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7368 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7369 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7370 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7371 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7372 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7377 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7378 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7379 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7380 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7381 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7385 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7390 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7391 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7392 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7393 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7394 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7395 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7397 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7399 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7400 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7401 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7402 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7403 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7407 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7408 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7410 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7411 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7412 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7413 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7414 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7415 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7416 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7417 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7418 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7419 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7420 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7422 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7423 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7427 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7428 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7429 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7430 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7431 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7432 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7434 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7436 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7437 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7441 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7444 .name = "Channel Mode",
7445 .info = alc_ch_mode_info,
7446 .get = alc_ch_mode_get,
7447 .put = alc_ch_mode_put,
7452 static struct hda_verb alc882_base_init_verbs[] = {
7453 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7458 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7460 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7461 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7463 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7466 /* Front Pin: output 0 (0x0c) */
7467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7468 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7469 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7470 /* Rear Pin: output 1 (0x0d) */
7471 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7472 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7473 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7474 /* CLFE Pin: output 2 (0x0e) */
7475 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7476 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7477 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7478 /* Side Pin: output 3 (0x0f) */
7479 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7480 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7481 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7482 /* Mic (rear) pin: input vref at 80% */
7483 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7484 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7485 /* Front Mic pin: input vref at 80% */
7486 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7487 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7488 /* Line In pin: input */
7489 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7490 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7491 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7492 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7493 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7494 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7495 /* CD pin widget for input */
7496 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7498 /* FIXME: use matrix-type input source selection */
7499 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7501 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7504 /* ADC2: mute amp left and right */
7505 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7506 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7507 /* ADC3: mute amp left and right */
7508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7509 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7514 static struct hda_verb alc882_adc1_init_verbs[] = {
7515 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7520 /* ADC1: mute amp left and right */
7521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7522 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7526 static struct hda_verb alc882_eapd_verbs[] = {
7527 /* change to EAPD mode */
7528 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7529 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7533 static struct hda_verb alc889_eapd_verbs[] = {
7534 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7535 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7539 static struct hda_verb alc_hp15_unsol_verbs[] = {
7540 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7541 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7545 static struct hda_verb alc885_init_verbs[] = {
7546 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7548 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7550 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7551 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7553 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7554 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7556 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7557 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7559 /* Front HP Pin: output 0 (0x0c) */
7560 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7561 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7562 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7563 /* Front Pin: output 0 (0x0c) */
7564 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7565 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7566 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7567 /* Rear Pin: output 1 (0x0d) */
7568 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7569 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7570 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7571 /* CLFE Pin: output 2 (0x0e) */
7572 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7573 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7574 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7575 /* Side Pin: output 3 (0x0f) */
7576 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7577 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7578 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7579 /* Mic (rear) pin: input vref at 80% */
7580 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7581 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7582 /* Front Mic pin: input vref at 80% */
7583 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7584 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7585 /* Line In pin: input */
7586 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7587 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7589 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7591 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7596 /* ADC2: mute amp left and right */
7597 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7598 /* ADC3: mute amp left and right */
7599 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7604 static struct hda_verb alc885_init_input_verbs[] = {
7605 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7606 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7607 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7612 /* Unmute Selector 24h and set the default input to front mic */
7613 static struct hda_verb alc889_init_input_verbs[] = {
7614 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7620 #define alc883_init_verbs alc882_base_init_verbs
7623 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7624 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7625 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7627 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7628 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7629 /* FIXME: this looks suspicious...
7630 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7631 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7636 static struct hda_verb alc882_macpro_init_verbs[] = {
7637 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7638 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7641 /* Front Pin: output 0 (0x0c) */
7642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7644 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7645 /* Front Mic pin: input vref at 80% */
7646 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7647 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7648 /* Speaker: output */
7649 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7650 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7651 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7652 /* Headphone output (output 0 - 0x0c) */
7653 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7654 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7655 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7657 /* FIXME: use matrix-type input source selection */
7658 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7659 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7671 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7674 /* ADC1: mute amp left and right */
7675 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7676 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7677 /* ADC2: mute amp left and right */
7678 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7679 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7680 /* ADC3: mute amp left and right */
7681 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7682 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7688 static struct hda_verb alc885_mb5_init_verbs[] = {
7690 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7691 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7692 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7693 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7698 /* Surround mixer */
7699 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7700 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7703 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7704 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7705 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7707 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7708 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7709 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7710 /* Front Pin (0x0c) */
7711 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7712 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7713 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7714 /* LFE Pin (0x0e) */
7715 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7716 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7717 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7719 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7720 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7721 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7722 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7723 /* Front Mic pin: input vref at 80% */
7724 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7725 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7728 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7730 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7731 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7732 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7733 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7738 static struct hda_verb alc885_macmini3_init_verbs[] = {
7740 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7741 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7742 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7743 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7748 /* Surround mixer */
7749 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7750 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7751 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7754 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7755 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7757 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7759 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7760 /* Front Pin (0x0c) */
7761 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7762 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7763 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7764 /* LFE Pin (0x0e) */
7765 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7767 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7769 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7770 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7771 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7772 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7779 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7780 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7785 static struct hda_verb alc885_mba21_init_verbs[] = {
7786 /*Internal and HP Speaker Mixer*/
7787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7788 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7789 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7790 /*Internal Speaker Pin (0x0c)*/
7791 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7792 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7793 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7794 /* HP Pin: output 0 (0x0e) */
7795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7796 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7797 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7798 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7799 /* Line in (is hp when jack connected)*/
7800 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7807 /* Macbook Pro rev3 */
7808 static struct hda_verb alc885_mbp3_init_verbs[] = {
7809 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7815 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7816 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7818 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7820 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7821 /* Front Pin: output 0 (0x0c) */
7822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7823 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7824 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7825 /* HP Pin: output 0 (0x0e) */
7826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7828 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7829 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7830 /* Mic (rear) pin: input vref at 80% */
7831 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7832 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7833 /* Front Mic pin: input vref at 80% */
7834 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7835 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7836 /* Line In pin: use output 1 when in LineOut mode */
7837 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7838 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7839 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7841 /* FIXME: use matrix-type input source selection */
7842 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7843 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7849 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7850 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7851 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7852 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7854 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7855 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7857 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7858 /* ADC1: mute amp left and right */
7859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7860 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7861 /* ADC2: mute amp left and right */
7862 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7863 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7864 /* ADC3: mute amp left and right */
7865 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7866 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7872 static struct hda_verb alc885_imac91_init_verbs[] = {
7873 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7879 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7880 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7881 /* HP Pin: output 0 (0x0c) */
7882 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7883 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7884 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7885 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7886 /* Internal Speakers: output 0 (0x0d) */
7887 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7889 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7890 /* Mic (rear) pin: input vref at 80% */
7891 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7892 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7893 /* Front Mic pin: input vref at 80% */
7894 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7895 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7896 /* Line In pin: use output 1 when in LineOut mode */
7897 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7898 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7899 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7901 /* FIXME: use matrix-type input source selection */
7902 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7903 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7909 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7910 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7911 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7912 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7916 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7918 /* ADC1: mute amp left and right */
7919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7920 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7921 /* ADC2: mute amp left and right */
7922 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7923 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7924 /* ADC3: mute amp left and right */
7925 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7926 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7931 /* iMac 24 mixer. */
7932 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7933 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7934 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7938 /* iMac 24 init verbs. */
7939 static struct hda_verb alc885_imac24_init_verbs[] = {
7940 /* Internal speakers: output 0 (0x0c) */
7941 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7942 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7943 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7944 /* Internal speakers: output 0 (0x0c) */
7945 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7946 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7947 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7948 /* Headphone: output 0 (0x0c) */
7949 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7950 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7951 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7952 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7953 /* Front Mic: input vref at 80% */
7954 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7955 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7959 /* Toggle speaker-output according to the hp-jack state */
7960 static void alc885_imac24_setup(struct hda_codec *codec)
7962 struct alc_spec *spec = codec->spec;
7964 spec->autocfg.hp_pins[0] = 0x14;
7965 spec->autocfg.speaker_pins[0] = 0x18;
7966 spec->autocfg.speaker_pins[1] = 0x1a;
7969 #define alc885_mb5_setup alc885_imac24_setup
7970 #define alc885_macmini3_setup alc885_imac24_setup
7972 /* Macbook Air 2,1 */
7973 static void alc885_mba21_setup(struct hda_codec *codec)
7975 struct alc_spec *spec = codec->spec;
7977 spec->autocfg.hp_pins[0] = 0x14;
7978 spec->autocfg.speaker_pins[0] = 0x18;
7983 static void alc885_mbp3_setup(struct hda_codec *codec)
7985 struct alc_spec *spec = codec->spec;
7987 spec->autocfg.hp_pins[0] = 0x15;
7988 spec->autocfg.speaker_pins[0] = 0x14;
7991 static void alc885_imac91_setup(struct hda_codec *codec)
7993 struct alc_spec *spec = codec->spec;
7995 spec->autocfg.hp_pins[0] = 0x14;
7996 spec->autocfg.speaker_pins[0] = 0x15;
7997 spec->autocfg.speaker_pins[1] = 0x1a;
8000 static struct hda_verb alc882_targa_verbs[] = {
8001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8004 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8005 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8007 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8008 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8009 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8011 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8015 /* toggle speaker-output according to the hp-jack state */
8016 static void alc882_targa_automute(struct hda_codec *codec)
8018 struct alc_spec *spec = codec->spec;
8019 alc_automute_amp(codec);
8020 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8021 spec->jack_present ? 1 : 3);
8024 static void alc882_targa_setup(struct hda_codec *codec)
8026 struct alc_spec *spec = codec->spec;
8028 spec->autocfg.hp_pins[0] = 0x14;
8029 spec->autocfg.speaker_pins[0] = 0x1b;
8032 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8034 if ((res >> 26) == ALC880_HP_EVENT)
8035 alc882_targa_automute(codec);
8038 static struct hda_verb alc882_asus_a7j_verbs[] = {
8039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8040 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8042 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8043 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8044 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8046 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8047 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8048 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8050 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8051 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8052 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8056 static struct hda_verb alc882_asus_a7m_verbs[] = {
8057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8062 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8064 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8065 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8066 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8068 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8069 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8070 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8074 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8076 unsigned int gpiostate, gpiomask, gpiodir;
8078 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8079 AC_VERB_GET_GPIO_DATA, 0);
8082 gpiostate |= (1 << pin);
8084 gpiostate &= ~(1 << pin);
8086 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8087 AC_VERB_GET_GPIO_MASK, 0);
8088 gpiomask |= (1 << pin);
8090 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8091 AC_VERB_GET_GPIO_DIRECTION, 0);
8092 gpiodir |= (1 << pin);
8095 snd_hda_codec_write(codec, codec->afg, 0,
8096 AC_VERB_SET_GPIO_MASK, gpiomask);
8097 snd_hda_codec_write(codec, codec->afg, 0,
8098 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8102 snd_hda_codec_write(codec, codec->afg, 0,
8103 AC_VERB_SET_GPIO_DATA, gpiostate);
8106 /* set up GPIO at initialization */
8107 static void alc885_macpro_init_hook(struct hda_codec *codec)
8109 alc882_gpio_mute(codec, 0, 0);
8110 alc882_gpio_mute(codec, 1, 0);
8113 /* set up GPIO and update auto-muting at initialization */
8114 static void alc885_imac24_init_hook(struct hda_codec *codec)
8116 alc885_macpro_init_hook(codec);
8117 alc_automute_amp(codec);
8121 * generic initialization of ADC, input mixers and output mixers
8123 static struct hda_verb alc883_auto_init_verbs[] = {
8125 * Unmute ADC0-2 and set the default input to mic-in
8127 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8128 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8129 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8130 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8133 * Set up output mixers (0x0c - 0x0f)
8135 /* set vol=0 to output mixers */
8136 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8137 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8139 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8140 /* set up input amps for analog loopback */
8141 /* Amp Indices: DAC = 0, mixer = 1 */
8142 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8143 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8145 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8147 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8148 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8149 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8150 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8151 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8153 /* FIXME: use matrix-type input source selection */
8154 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8156 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8158 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8162 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8163 static struct hda_verb alc889A_mb31_ch2_init[] = {
8164 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8165 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8166 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8167 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8171 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8172 static struct hda_verb alc889A_mb31_ch4_init[] = {
8173 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8174 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8175 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8176 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8180 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8181 static struct hda_verb alc889A_mb31_ch5_init[] = {
8182 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8183 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8184 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8189 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8190 static struct hda_verb alc889A_mb31_ch6_init[] = {
8191 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8192 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8193 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8198 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8199 { 2, alc889A_mb31_ch2_init },
8200 { 4, alc889A_mb31_ch4_init },
8201 { 5, alc889A_mb31_ch5_init },
8202 { 6, alc889A_mb31_ch6_init },
8205 static struct hda_verb alc883_medion_eapd_verbs[] = {
8206 /* eanable EAPD on medion laptop */
8207 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8208 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8212 #define alc883_base_mixer alc882_base_mixer
8214 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8216 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8217 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8218 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8219 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8220 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8221 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8225 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8226 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8227 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8231 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8232 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8233 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8234 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8235 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8237 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8238 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8239 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8240 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8241 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8245 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8246 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8247 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8248 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8249 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8252 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8253 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8254 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8255 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8259 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8260 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8261 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8262 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8263 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8264 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8265 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8266 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8268 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8269 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8270 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8271 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8272 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8276 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8277 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8278 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8279 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8280 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8281 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8282 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8283 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8284 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8285 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8286 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8287 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8288 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8289 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8291 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8292 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8293 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8294 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8295 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8299 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8300 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8301 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8302 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8303 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8304 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8306 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8307 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8308 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8309 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8310 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8311 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8312 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8313 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8315 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8317 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8318 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8319 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8323 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8324 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8325 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8326 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8327 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8328 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8330 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8331 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8332 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8333 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8334 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8335 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8336 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8337 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8339 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8340 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8341 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8342 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8343 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8347 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8348 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8349 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8350 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8351 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8352 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8353 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8354 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8355 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8356 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8357 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8358 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8359 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8360 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8362 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8364 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8365 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8366 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8370 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8371 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8372 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8374 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8375 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8376 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8377 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8378 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8379 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8380 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8381 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8382 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8383 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8384 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8386 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8387 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8391 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8392 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8393 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8395 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8396 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8397 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8399 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8401 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8402 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8403 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8407 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8408 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8409 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8410 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8411 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8412 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8416 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8417 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8418 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8419 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8420 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8421 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8423 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8428 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8429 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8430 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8432 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8433 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8435 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8436 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8437 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8441 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8442 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8443 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8444 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8445 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8446 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8448 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8449 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8450 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8454 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8455 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8456 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8457 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8458 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8459 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8460 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8461 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8466 static struct snd_kcontrol_new alc888_acer_aspire_6530_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_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8470 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8471 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8472 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8473 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8474 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8476 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8477 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8481 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8482 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8483 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8484 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8485 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8486 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8487 0x0d, 1, 0x0, HDA_OUTPUT),
8488 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8489 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8490 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8491 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8492 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8493 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8494 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8495 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8496 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8498 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8499 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8500 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8501 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8502 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8506 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8508 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8509 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8510 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8511 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8512 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8514 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8515 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8516 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8517 /* Output switches */
8518 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8519 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8520 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8522 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8523 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8525 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8526 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8527 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8528 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8532 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8533 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8534 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8535 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8537 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8542 static struct hda_bind_ctls alc883_bind_cap_vol = {
8543 .ops = &snd_hda_bind_vol,
8545 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8546 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8551 static struct hda_bind_ctls alc883_bind_cap_switch = {
8552 .ops = &snd_hda_bind_sw,
8554 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8555 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8560 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8561 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8562 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8563 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8564 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8565 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8567 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8568 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8572 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8573 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8574 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8576 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8577 /* .name = "Capture Source", */
8578 .name = "Input Source",
8580 .info = alc_mux_enum_info,
8581 .get = alc_mux_enum_get,
8582 .put = alc_mux_enum_put,
8587 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8589 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8590 .name = "Channel Mode",
8591 .info = alc_ch_mode_info,
8592 .get = alc_ch_mode_get,
8593 .put = alc_ch_mode_put,
8598 /* toggle speaker-output according to the hp-jack state */
8599 static void alc883_mitac_setup(struct hda_codec *codec)
8601 struct alc_spec *spec = codec->spec;
8603 spec->autocfg.hp_pins[0] = 0x15;
8604 spec->autocfg.speaker_pins[0] = 0x14;
8605 spec->autocfg.speaker_pins[1] = 0x17;
8608 /* auto-toggle front mic */
8610 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8612 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8614 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8618 static struct hda_verb alc883_mitac_verbs[] = {
8620 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8623 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8624 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8626 /* enable unsolicited event */
8627 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8628 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8633 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8635 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8638 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8640 /* enable unsolicited event */
8642 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8643 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8649 static struct hda_verb alc883_clevo_m720_verbs[] = {
8651 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8654 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8657 /* enable unsolicited event */
8658 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8659 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8664 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8666 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8667 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8669 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8672 /* enable unsolicited event */
8673 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8678 static struct hda_verb alc883_targa_verbs[] = {
8679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8682 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8683 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8685 /* Connect Line-Out side jack (SPDIF) to Side */
8686 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8687 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8688 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8689 /* Connect Mic jack to CLFE */
8690 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8692 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8693 /* Connect Line-in jack to Surround */
8694 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8695 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8696 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8697 /* Connect HP out jack to Front */
8698 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8700 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8702 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8707 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8708 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8709 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8710 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8714 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8715 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8716 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8717 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8718 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8722 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8725 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8726 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8727 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8731 static struct hda_verb alc883_haier_w66_verbs[] = {
8732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8737 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8738 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8739 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8740 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8744 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8749 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8750 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8751 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8752 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8756 static struct hda_verb alc888_6st_dell_verbs[] = {
8757 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8761 static struct hda_verb alc883_vaiott_verbs[] = {
8763 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8766 /* enable unsolicited event */
8767 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8772 static void alc888_3st_hp_setup(struct hda_codec *codec)
8774 struct alc_spec *spec = codec->spec;
8776 spec->autocfg.hp_pins[0] = 0x1b;
8777 spec->autocfg.speaker_pins[0] = 0x14;
8778 spec->autocfg.speaker_pins[1] = 0x16;
8779 spec->autocfg.speaker_pins[2] = 0x18;
8782 static struct hda_verb alc888_3st_hp_verbs[] = {
8783 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8784 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8785 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8786 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8793 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8794 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8795 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8796 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8797 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8804 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8805 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8806 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8807 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8808 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8809 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8816 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8817 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8818 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8819 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8820 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8821 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8822 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8826 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8827 { 2, alc888_3st_hp_2ch_init },
8828 { 4, alc888_3st_hp_4ch_init },
8829 { 6, alc888_3st_hp_6ch_init },
8832 /* toggle front-jack and RCA according to the hp-jack state */
8833 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8835 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8837 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8838 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8839 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8840 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8843 /* toggle RCA according to the front-jack state */
8844 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8846 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8848 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8849 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8852 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8855 if ((res >> 26) == ALC880_HP_EVENT)
8856 alc888_lenovo_ms7195_front_automute(codec);
8857 if ((res >> 26) == ALC880_FRONT_EVENT)
8858 alc888_lenovo_ms7195_rca_automute(codec);
8861 static struct hda_verb alc883_medion_md2_verbs[] = {
8862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8865 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8867 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8871 /* toggle speaker-output according to the hp-jack state */
8872 static void alc883_medion_md2_setup(struct hda_codec *codec)
8874 struct alc_spec *spec = codec->spec;
8876 spec->autocfg.hp_pins[0] = 0x14;
8877 spec->autocfg.speaker_pins[0] = 0x15;
8880 /* toggle speaker-output according to the hp-jack state */
8881 #define alc883_targa_init_hook alc882_targa_init_hook
8882 #define alc883_targa_unsol_event alc882_targa_unsol_event
8884 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8886 unsigned int present;
8888 present = snd_hda_jack_detect(codec, 0x18);
8889 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8890 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8893 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8895 struct alc_spec *spec = codec->spec;
8897 spec->autocfg.hp_pins[0] = 0x15;
8898 spec->autocfg.speaker_pins[0] = 0x14;
8901 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8903 alc_automute_amp(codec);
8904 alc883_clevo_m720_mic_automute(codec);
8907 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8910 switch (res >> 26) {
8911 case ALC880_MIC_EVENT:
8912 alc883_clevo_m720_mic_automute(codec);
8915 alc_automute_amp_unsol_event(codec, res);
8920 /* toggle speaker-output according to the hp-jack state */
8921 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8923 struct alc_spec *spec = codec->spec;
8925 spec->autocfg.hp_pins[0] = 0x14;
8926 spec->autocfg.speaker_pins[0] = 0x15;
8929 static void alc883_haier_w66_setup(struct hda_codec *codec)
8931 struct alc_spec *spec = codec->spec;
8933 spec->autocfg.hp_pins[0] = 0x1b;
8934 spec->autocfg.speaker_pins[0] = 0x14;
8937 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8939 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8941 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8942 HDA_AMP_MUTE, bits);
8945 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8947 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8949 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8950 HDA_AMP_MUTE, bits);
8951 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8952 HDA_AMP_MUTE, bits);
8955 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8958 if ((res >> 26) == ALC880_HP_EVENT)
8959 alc883_lenovo_101e_all_automute(codec);
8960 if ((res >> 26) == ALC880_FRONT_EVENT)
8961 alc883_lenovo_101e_ispeaker_automute(codec);
8964 /* toggle speaker-output according to the hp-jack state */
8965 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8967 struct alc_spec *spec = codec->spec;
8969 spec->autocfg.hp_pins[0] = 0x14;
8970 spec->autocfg.speaker_pins[0] = 0x15;
8971 spec->autocfg.speaker_pins[1] = 0x16;
8974 static struct hda_verb alc883_acer_eapd_verbs[] = {
8975 /* HP Pin: output 0 (0x0c) */
8976 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8977 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8978 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8979 /* Front Pin: output 0 (0x0c) */
8980 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8981 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8982 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8983 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8984 /* eanable EAPD on medion laptop */
8985 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8986 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8987 /* enable unsolicited event */
8988 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8992 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8994 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8995 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8999 static void alc888_6st_dell_setup(struct hda_codec *codec)
9001 struct alc_spec *spec = codec->spec;
9003 spec->autocfg.hp_pins[0] = 0x1b;
9004 spec->autocfg.speaker_pins[0] = 0x14;
9005 spec->autocfg.speaker_pins[1] = 0x15;
9006 spec->autocfg.speaker_pins[2] = 0x16;
9007 spec->autocfg.speaker_pins[3] = 0x17;
9010 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9012 struct alc_spec *spec = codec->spec;
9014 spec->autocfg.hp_pins[0] = 0x1b;
9015 spec->autocfg.speaker_pins[0] = 0x14;
9016 spec->autocfg.speaker_pins[1] = 0x15;
9017 spec->autocfg.speaker_pins[2] = 0x16;
9018 spec->autocfg.speaker_pins[3] = 0x17;
9019 spec->autocfg.speaker_pins[4] = 0x1a;
9022 static void alc883_vaiott_setup(struct hda_codec *codec)
9024 struct alc_spec *spec = codec->spec;
9026 spec->autocfg.hp_pins[0] = 0x15;
9027 spec->autocfg.speaker_pins[0] = 0x14;
9028 spec->autocfg.speaker_pins[1] = 0x17;
9031 static struct hda_verb alc888_asus_m90v_verbs[] = {
9032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9035 /* enable unsolicited event */
9036 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9037 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9041 static void alc883_mode2_setup(struct hda_codec *codec)
9043 struct alc_spec *spec = codec->spec;
9045 spec->autocfg.hp_pins[0] = 0x1b;
9046 spec->autocfg.speaker_pins[0] = 0x14;
9047 spec->autocfg.speaker_pins[1] = 0x15;
9048 spec->autocfg.speaker_pins[2] = 0x16;
9049 spec->ext_mic.pin = 0x18;
9050 spec->int_mic.pin = 0x19;
9051 spec->ext_mic.mux_idx = 0;
9052 spec->int_mic.mux_idx = 1;
9056 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9058 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9059 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9060 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9061 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9062 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9063 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9064 /* enable unsolicited event */
9065 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9069 static void alc883_eee1601_inithook(struct hda_codec *codec)
9071 struct alc_spec *spec = codec->spec;
9073 spec->autocfg.hp_pins[0] = 0x14;
9074 spec->autocfg.speaker_pins[0] = 0x1b;
9075 alc_automute_pin(codec);
9078 static struct hda_verb alc889A_mb31_verbs[] = {
9079 /* Init rear pin (used as headphone output) */
9080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9081 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9082 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9083 /* Init line pin (used as output in 4ch and 6ch mode) */
9084 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9085 /* Init line 2 pin (used as headphone out by default) */
9086 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9087 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9091 /* Mute speakers according to the headphone jack state */
9092 static void alc889A_mb31_automute(struct hda_codec *codec)
9094 unsigned int present;
9096 /* Mute only in 2ch or 4ch mode */
9097 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9099 present = snd_hda_jack_detect(codec, 0x15);
9100 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9101 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9102 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9103 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9107 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9109 if ((res >> 26) == ALC880_HP_EVENT)
9110 alc889A_mb31_automute(codec);
9114 #ifdef CONFIG_SND_HDA_POWER_SAVE
9115 #define alc882_loopbacks alc880_loopbacks
9118 /* pcm configuration: identical with ALC880 */
9119 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9120 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9121 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9122 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9124 static hda_nid_t alc883_slave_dig_outs[] = {
9125 ALC1200_DIGOUT_NID, 0,
9128 static hda_nid_t alc1200_slave_dig_outs[] = {
9129 ALC883_DIGOUT_NID, 0,
9133 * configuration and preset
9135 static const char *alc882_models[ALC882_MODEL_LAST] = {
9136 [ALC882_3ST_DIG] = "3stack-dig",
9137 [ALC882_6ST_DIG] = "6stack-dig",
9138 [ALC882_ARIMA] = "arima",
9139 [ALC882_W2JC] = "w2jc",
9140 [ALC882_TARGA] = "targa",
9141 [ALC882_ASUS_A7J] = "asus-a7j",
9142 [ALC882_ASUS_A7M] = "asus-a7m",
9143 [ALC885_MACPRO] = "macpro",
9144 [ALC885_MB5] = "mb5",
9145 [ALC885_MACMINI3] = "macmini3",
9146 [ALC885_MBA21] = "mba21",
9147 [ALC885_MBP3] = "mbp3",
9148 [ALC885_IMAC24] = "imac24",
9149 [ALC885_IMAC91] = "imac91",
9150 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9151 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9152 [ALC883_3ST_6ch] = "3stack-6ch",
9153 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9154 [ALC883_TARGA_DIG] = "targa-dig",
9155 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9156 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9157 [ALC883_ACER] = "acer",
9158 [ALC883_ACER_ASPIRE] = "acer-aspire",
9159 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9160 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9161 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9162 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9163 [ALC883_MEDION] = "medion",
9164 [ALC883_MEDION_MD2] = "medion-md2",
9165 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9166 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9167 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9168 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9169 [ALC888_LENOVO_SKY] = "lenovo-sky",
9170 [ALC883_HAIER_W66] = "haier-w66",
9171 [ALC888_3ST_HP] = "3stack-hp",
9172 [ALC888_6ST_DELL] = "6stack-dell",
9173 [ALC883_MITAC] = "mitac",
9174 [ALC883_CLEVO_M540R] = "clevo-m540r",
9175 [ALC883_CLEVO_M720] = "clevo-m720",
9176 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9177 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9178 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9179 [ALC889A_INTEL] = "intel-alc889a",
9180 [ALC889_INTEL] = "intel-x58",
9181 [ALC1200_ASUS_P5Q] = "asus-p5q",
9182 [ALC889A_MB31] = "mb31",
9183 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9184 [ALC882_AUTO] = "auto",
9187 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9188 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9190 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9191 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9192 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9193 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9194 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9195 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9196 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9197 ALC888_ACER_ASPIRE_4930G),
9198 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9199 ALC888_ACER_ASPIRE_4930G),
9200 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9201 ALC888_ACER_ASPIRE_8930G),
9202 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9203 ALC888_ACER_ASPIRE_8930G),
9204 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9205 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9206 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9207 ALC888_ACER_ASPIRE_6530G),
9208 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9209 ALC888_ACER_ASPIRE_6530G),
9210 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9211 ALC888_ACER_ASPIRE_7730G),
9212 /* default Acer -- disabled as it causes more problems.
9213 * model=auto should work fine now
9215 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9217 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9219 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9220 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9221 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9222 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9223 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9224 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9226 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9227 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9228 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9229 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9230 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9231 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9232 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9233 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9234 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9235 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9236 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9238 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9239 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9240 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9241 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9242 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9243 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9244 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9245 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9246 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9248 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9249 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9250 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9251 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9252 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9253 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9254 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9255 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9256 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9257 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9258 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9259 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9260 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9261 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9262 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9263 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9264 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9265 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9266 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9267 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9268 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9269 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9270 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9271 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9272 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9273 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9274 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9275 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9276 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9277 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9278 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9280 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9281 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9282 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9283 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9284 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9285 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9286 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9287 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9288 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9289 ALC883_FUJITSU_PI2515),
9290 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9291 ALC888_FUJITSU_XA3530),
9292 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9293 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9294 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9295 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9296 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9297 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9298 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9299 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9300 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9302 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9303 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9304 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9305 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9306 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9307 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9308 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9313 /* codec SSID table for Intel Mac */
9314 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9315 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9316 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9317 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9318 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9319 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9320 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9321 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9322 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9323 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9324 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9325 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9326 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9327 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9328 * so apparently no perfect solution yet
9330 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9331 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9332 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9336 static struct alc_config_preset alc882_presets[] = {
9337 [ALC882_3ST_DIG] = {
9338 .mixers = { alc882_base_mixer },
9339 .init_verbs = { alc882_base_init_verbs,
9340 alc882_adc1_init_verbs },
9341 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9342 .dac_nids = alc882_dac_nids,
9343 .dig_out_nid = ALC882_DIGOUT_NID,
9344 .dig_in_nid = ALC882_DIGIN_NID,
9345 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9346 .channel_mode = alc882_ch_modes,
9348 .input_mux = &alc882_capture_source,
9350 [ALC882_6ST_DIG] = {
9351 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9352 .init_verbs = { alc882_base_init_verbs,
9353 alc882_adc1_init_verbs },
9354 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9355 .dac_nids = alc882_dac_nids,
9356 .dig_out_nid = ALC882_DIGOUT_NID,
9357 .dig_in_nid = ALC882_DIGIN_NID,
9358 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9359 .channel_mode = alc882_sixstack_modes,
9360 .input_mux = &alc882_capture_source,
9363 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9364 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9365 alc882_eapd_verbs },
9366 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9367 .dac_nids = alc882_dac_nids,
9368 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9369 .channel_mode = alc882_sixstack_modes,
9370 .input_mux = &alc882_capture_source,
9373 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9374 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9375 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9376 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9377 .dac_nids = alc882_dac_nids,
9378 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9379 .channel_mode = alc880_threestack_modes,
9381 .input_mux = &alc882_capture_source,
9382 .dig_out_nid = ALC882_DIGOUT_NID,
9385 .mixers = { alc885_mba21_mixer },
9386 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9388 .dac_nids = alc882_dac_nids,
9389 .channel_mode = alc885_mba21_ch_modes,
9390 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9391 .input_mux = &alc882_capture_source,
9392 .unsol_event = alc_automute_amp_unsol_event,
9393 .setup = alc885_mba21_setup,
9394 .init_hook = alc_automute_amp,
9397 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9398 .init_verbs = { alc885_mbp3_init_verbs,
9399 alc880_gpio1_init_verbs },
9401 .dac_nids = alc882_dac_nids,
9403 .channel_mode = alc885_mbp_4ch_modes,
9404 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9405 .input_mux = &alc882_capture_source,
9406 .dig_out_nid = ALC882_DIGOUT_NID,
9407 .dig_in_nid = ALC882_DIGIN_NID,
9408 .unsol_event = alc_automute_amp_unsol_event,
9409 .setup = alc885_mbp3_setup,
9410 .init_hook = alc_automute_amp,
9413 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9414 .init_verbs = { alc885_mb5_init_verbs,
9415 alc880_gpio1_init_verbs },
9416 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9417 .dac_nids = alc882_dac_nids,
9418 .channel_mode = alc885_mb5_6ch_modes,
9419 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9420 .input_mux = &mb5_capture_source,
9421 .dig_out_nid = ALC882_DIGOUT_NID,
9422 .dig_in_nid = ALC882_DIGIN_NID,
9423 .unsol_event = alc_automute_amp_unsol_event,
9424 .setup = alc885_mb5_setup,
9425 .init_hook = alc_automute_amp,
9427 [ALC885_MACMINI3] = {
9428 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9429 .init_verbs = { alc885_macmini3_init_verbs,
9430 alc880_gpio1_init_verbs },
9431 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9432 .dac_nids = alc882_dac_nids,
9433 .channel_mode = alc885_macmini3_6ch_modes,
9434 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9435 .input_mux = &macmini3_capture_source,
9436 .dig_out_nid = ALC882_DIGOUT_NID,
9437 .dig_in_nid = ALC882_DIGIN_NID,
9438 .unsol_event = alc_automute_amp_unsol_event,
9439 .setup = alc885_macmini3_setup,
9440 .init_hook = alc_automute_amp,
9443 .mixers = { alc882_macpro_mixer },
9444 .init_verbs = { alc882_macpro_init_verbs },
9445 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9446 .dac_nids = alc882_dac_nids,
9447 .dig_out_nid = ALC882_DIGOUT_NID,
9448 .dig_in_nid = ALC882_DIGIN_NID,
9449 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9450 .channel_mode = alc882_ch_modes,
9451 .input_mux = &alc882_capture_source,
9452 .init_hook = alc885_macpro_init_hook,
9455 .mixers = { alc885_imac24_mixer },
9456 .init_verbs = { alc885_imac24_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 .unsol_event = alc_automute_amp_unsol_event,
9465 .setup = alc885_imac24_setup,
9466 .init_hook = alc885_imac24_init_hook,
9469 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9470 .init_verbs = { alc885_imac91_init_verbs,
9471 alc880_gpio1_init_verbs },
9472 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9473 .dac_nids = alc882_dac_nids,
9474 .channel_mode = alc885_mbp_4ch_modes,
9475 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9476 .input_mux = &alc882_capture_source,
9477 .dig_out_nid = ALC882_DIGOUT_NID,
9478 .dig_in_nid = ALC882_DIGIN_NID,
9479 .unsol_event = alc_automute_amp_unsol_event,
9480 .setup = alc885_imac91_setup,
9481 .init_hook = alc_automute_amp,
9484 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9485 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9486 alc880_gpio3_init_verbs, alc882_targa_verbs},
9487 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9488 .dac_nids = alc882_dac_nids,
9489 .dig_out_nid = ALC882_DIGOUT_NID,
9490 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9491 .adc_nids = alc882_adc_nids,
9492 .capsrc_nids = alc882_capsrc_nids,
9493 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9494 .channel_mode = alc882_3ST_6ch_modes,
9496 .input_mux = &alc882_capture_source,
9497 .unsol_event = alc882_targa_unsol_event,
9498 .setup = alc882_targa_setup,
9499 .init_hook = alc882_targa_automute,
9501 [ALC882_ASUS_A7J] = {
9502 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9503 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9504 alc882_asus_a7j_verbs},
9505 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9506 .dac_nids = alc882_dac_nids,
9507 .dig_out_nid = ALC882_DIGOUT_NID,
9508 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9509 .adc_nids = alc882_adc_nids,
9510 .capsrc_nids = alc882_capsrc_nids,
9511 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9512 .channel_mode = alc882_3ST_6ch_modes,
9514 .input_mux = &alc882_capture_source,
9516 [ALC882_ASUS_A7M] = {
9517 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9518 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9519 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9520 alc882_asus_a7m_verbs },
9521 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9522 .dac_nids = alc882_dac_nids,
9523 .dig_out_nid = ALC882_DIGOUT_NID,
9524 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9525 .channel_mode = alc880_threestack_modes,
9527 .input_mux = &alc882_capture_source,
9529 [ALC883_3ST_2ch_DIG] = {
9530 .mixers = { alc883_3ST_2ch_mixer },
9531 .init_verbs = { alc883_init_verbs },
9532 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9533 .dac_nids = alc883_dac_nids,
9534 .dig_out_nid = ALC883_DIGOUT_NID,
9535 .dig_in_nid = ALC883_DIGIN_NID,
9536 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9537 .channel_mode = alc883_3ST_2ch_modes,
9538 .input_mux = &alc883_capture_source,
9540 [ALC883_3ST_6ch_DIG] = {
9541 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9542 .init_verbs = { alc883_init_verbs },
9543 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9544 .dac_nids = alc883_dac_nids,
9545 .dig_out_nid = ALC883_DIGOUT_NID,
9546 .dig_in_nid = ALC883_DIGIN_NID,
9547 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9548 .channel_mode = alc883_3ST_6ch_modes,
9550 .input_mux = &alc883_capture_source,
9552 [ALC883_3ST_6ch] = {
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 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9558 .channel_mode = alc883_3ST_6ch_modes,
9560 .input_mux = &alc883_capture_source,
9562 [ALC883_3ST_6ch_INTEL] = {
9563 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9564 .init_verbs = { alc883_init_verbs },
9565 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9566 .dac_nids = alc883_dac_nids,
9567 .dig_out_nid = ALC883_DIGOUT_NID,
9568 .dig_in_nid = ALC883_DIGIN_NID,
9569 .slave_dig_outs = alc883_slave_dig_outs,
9570 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9571 .channel_mode = alc883_3ST_6ch_intel_modes,
9573 .input_mux = &alc883_3stack_6ch_intel,
9576 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9577 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9578 alc_hp15_unsol_verbs },
9579 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9580 .dac_nids = alc883_dac_nids,
9581 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9582 .adc_nids = alc889_adc_nids,
9583 .dig_out_nid = ALC883_DIGOUT_NID,
9584 .dig_in_nid = ALC883_DIGIN_NID,
9585 .slave_dig_outs = alc883_slave_dig_outs,
9586 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9587 .channel_mode = alc889_8ch_intel_modes,
9588 .capsrc_nids = alc889_capsrc_nids,
9589 .input_mux = &alc889_capture_source,
9590 .setup = alc889_automute_setup,
9591 .init_hook = alc_automute_amp,
9592 .unsol_event = alc_automute_amp_unsol_event,
9596 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9597 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9598 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9599 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9600 .dac_nids = alc883_dac_nids,
9601 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9602 .adc_nids = alc889_adc_nids,
9603 .dig_out_nid = ALC883_DIGOUT_NID,
9604 .dig_in_nid = ALC883_DIGIN_NID,
9605 .slave_dig_outs = alc883_slave_dig_outs,
9606 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9607 .channel_mode = alc889_8ch_intel_modes,
9608 .capsrc_nids = alc889_capsrc_nids,
9609 .input_mux = &alc889_capture_source,
9610 .setup = alc889_automute_setup,
9611 .init_hook = alc889_intel_init_hook,
9612 .unsol_event = alc_automute_amp_unsol_event,
9615 [ALC883_6ST_DIG] = {
9616 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9617 .init_verbs = { alc883_init_verbs },
9618 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9619 .dac_nids = alc883_dac_nids,
9620 .dig_out_nid = ALC883_DIGOUT_NID,
9621 .dig_in_nid = ALC883_DIGIN_NID,
9622 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9623 .channel_mode = alc883_sixstack_modes,
9624 .input_mux = &alc883_capture_source,
9626 [ALC883_TARGA_DIG] = {
9627 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9628 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9629 alc883_targa_verbs},
9630 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9631 .dac_nids = alc883_dac_nids,
9632 .dig_out_nid = ALC883_DIGOUT_NID,
9633 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9634 .channel_mode = alc883_3ST_6ch_modes,
9636 .input_mux = &alc883_capture_source,
9637 .unsol_event = alc883_targa_unsol_event,
9638 .setup = alc882_targa_setup,
9639 .init_hook = alc882_targa_automute,
9641 [ALC883_TARGA_2ch_DIG] = {
9642 .mixers = { alc883_targa_2ch_mixer},
9643 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9644 alc883_targa_verbs},
9645 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9646 .dac_nids = alc883_dac_nids,
9647 .adc_nids = alc883_adc_nids_alt,
9648 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9649 .capsrc_nids = alc883_capsrc_nids,
9650 .dig_out_nid = ALC883_DIGOUT_NID,
9651 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9652 .channel_mode = alc883_3ST_2ch_modes,
9653 .input_mux = &alc883_capture_source,
9654 .unsol_event = alc883_targa_unsol_event,
9655 .setup = alc882_targa_setup,
9656 .init_hook = alc882_targa_automute,
9658 [ALC883_TARGA_8ch_DIG] = {
9659 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9660 alc883_chmode_mixer },
9661 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9662 alc883_targa_verbs },
9663 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9664 .dac_nids = alc883_dac_nids,
9665 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9666 .adc_nids = alc883_adc_nids_rev,
9667 .capsrc_nids = alc883_capsrc_nids_rev,
9668 .dig_out_nid = ALC883_DIGOUT_NID,
9669 .dig_in_nid = ALC883_DIGIN_NID,
9670 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9671 .channel_mode = alc883_4ST_8ch_modes,
9673 .input_mux = &alc883_capture_source,
9674 .unsol_event = alc883_targa_unsol_event,
9675 .setup = alc882_targa_setup,
9676 .init_hook = alc882_targa_automute,
9679 .mixers = { alc883_base_mixer },
9680 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9681 * and the headphone jack. Turn this on and rely on the
9682 * standard mute methods whenever the user wants to turn
9683 * these outputs off.
9685 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9686 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9687 .dac_nids = alc883_dac_nids,
9688 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9689 .channel_mode = alc883_3ST_2ch_modes,
9690 .input_mux = &alc883_capture_source,
9692 [ALC883_ACER_ASPIRE] = {
9693 .mixers = { alc883_acer_aspire_mixer },
9694 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9695 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9696 .dac_nids = alc883_dac_nids,
9697 .dig_out_nid = ALC883_DIGOUT_NID,
9698 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9699 .channel_mode = alc883_3ST_2ch_modes,
9700 .input_mux = &alc883_capture_source,
9701 .unsol_event = alc_automute_amp_unsol_event,
9702 .setup = alc883_acer_aspire_setup,
9703 .init_hook = alc_automute_amp,
9705 [ALC888_ACER_ASPIRE_4930G] = {
9706 .mixers = { alc888_base_mixer,
9707 alc883_chmode_mixer },
9708 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9709 alc888_acer_aspire_4930g_verbs },
9710 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9711 .dac_nids = alc883_dac_nids,
9712 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9713 .adc_nids = alc883_adc_nids_rev,
9714 .capsrc_nids = alc883_capsrc_nids_rev,
9715 .dig_out_nid = ALC883_DIGOUT_NID,
9716 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9717 .channel_mode = alc883_3ST_6ch_modes,
9719 .const_channel_count = 6,
9721 ARRAY_SIZE(alc888_2_capture_sources),
9722 .input_mux = alc888_2_capture_sources,
9723 .unsol_event = alc_automute_amp_unsol_event,
9724 .setup = alc888_acer_aspire_4930g_setup,
9725 .init_hook = alc_automute_amp,
9727 [ALC888_ACER_ASPIRE_6530G] = {
9728 .mixers = { alc888_acer_aspire_6530_mixer },
9729 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9730 alc888_acer_aspire_6530g_verbs },
9731 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9732 .dac_nids = alc883_dac_nids,
9733 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9734 .adc_nids = alc883_adc_nids_rev,
9735 .capsrc_nids = alc883_capsrc_nids_rev,
9736 .dig_out_nid = ALC883_DIGOUT_NID,
9737 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9738 .channel_mode = alc883_3ST_2ch_modes,
9740 ARRAY_SIZE(alc888_2_capture_sources),
9741 .input_mux = alc888_acer_aspire_6530_sources,
9742 .unsol_event = alc_automute_amp_unsol_event,
9743 .setup = alc888_acer_aspire_6530g_setup,
9744 .init_hook = alc_automute_amp,
9746 [ALC888_ACER_ASPIRE_8930G] = {
9747 .mixers = { alc889_acer_aspire_8930g_mixer,
9748 alc883_chmode_mixer },
9749 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9750 alc889_acer_aspire_8930g_verbs,
9752 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9753 .dac_nids = alc883_dac_nids,
9754 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9755 .adc_nids = alc889_adc_nids,
9756 .capsrc_nids = alc889_capsrc_nids,
9757 .dig_out_nid = ALC883_DIGOUT_NID,
9758 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9759 .channel_mode = alc883_3ST_6ch_modes,
9761 .const_channel_count = 6,
9763 ARRAY_SIZE(alc889_capture_sources),
9764 .input_mux = alc889_capture_sources,
9765 .unsol_event = alc_automute_amp_unsol_event,
9766 .setup = alc889_acer_aspire_8930g_setup,
9767 .init_hook = alc_automute_amp,
9768 #ifdef CONFIG_SND_HDA_POWER_SAVE
9769 .power_hook = alc_power_eapd,
9772 [ALC888_ACER_ASPIRE_7730G] = {
9773 .mixers = { alc883_3ST_6ch_mixer,
9774 alc883_chmode_mixer },
9775 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9776 alc888_acer_aspire_7730G_verbs },
9777 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9778 .dac_nids = alc883_dac_nids,
9779 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9780 .adc_nids = alc883_adc_nids_rev,
9781 .capsrc_nids = alc883_capsrc_nids_rev,
9782 .dig_out_nid = ALC883_DIGOUT_NID,
9783 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9784 .channel_mode = alc883_3ST_6ch_modes,
9786 .const_channel_count = 6,
9787 .input_mux = &alc883_capture_source,
9788 .unsol_event = alc_automute_amp_unsol_event,
9789 .setup = alc888_acer_aspire_6530g_setup,
9790 .init_hook = alc_automute_amp,
9793 .mixers = { alc883_fivestack_mixer,
9794 alc883_chmode_mixer },
9795 .init_verbs = { alc883_init_verbs,
9796 alc883_medion_eapd_verbs },
9797 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9798 .dac_nids = alc883_dac_nids,
9799 .adc_nids = alc883_adc_nids_alt,
9800 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9801 .capsrc_nids = alc883_capsrc_nids,
9802 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9803 .channel_mode = alc883_sixstack_modes,
9804 .input_mux = &alc883_capture_source,
9806 [ALC883_MEDION_MD2] = {
9807 .mixers = { alc883_medion_md2_mixer},
9808 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9809 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9810 .dac_nids = alc883_dac_nids,
9811 .dig_out_nid = ALC883_DIGOUT_NID,
9812 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9813 .channel_mode = alc883_3ST_2ch_modes,
9814 .input_mux = &alc883_capture_source,
9815 .unsol_event = alc_automute_amp_unsol_event,
9816 .setup = alc883_medion_md2_setup,
9817 .init_hook = alc_automute_amp,
9819 [ALC883_LAPTOP_EAPD] = {
9820 .mixers = { alc883_base_mixer },
9821 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9822 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9823 .dac_nids = alc883_dac_nids,
9824 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9825 .channel_mode = alc883_3ST_2ch_modes,
9826 .input_mux = &alc883_capture_source,
9828 [ALC883_CLEVO_M540R] = {
9829 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9830 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9831 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9832 .dac_nids = alc883_dac_nids,
9833 .dig_out_nid = ALC883_DIGOUT_NID,
9834 .dig_in_nid = ALC883_DIGIN_NID,
9835 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9836 .channel_mode = alc883_3ST_6ch_clevo_modes,
9838 .input_mux = &alc883_capture_source,
9839 /* This machine has the hardware HP auto-muting, thus
9840 * we need no software mute via unsol event
9843 [ALC883_CLEVO_M720] = {
9844 .mixers = { alc883_clevo_m720_mixer },
9845 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9846 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9847 .dac_nids = alc883_dac_nids,
9848 .dig_out_nid = ALC883_DIGOUT_NID,
9849 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9850 .channel_mode = alc883_3ST_2ch_modes,
9851 .input_mux = &alc883_capture_source,
9852 .unsol_event = alc883_clevo_m720_unsol_event,
9853 .setup = alc883_clevo_m720_setup,
9854 .init_hook = alc883_clevo_m720_init_hook,
9856 [ALC883_LENOVO_101E_2ch] = {
9857 .mixers = { alc883_lenovo_101e_2ch_mixer},
9858 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9859 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9860 .dac_nids = alc883_dac_nids,
9861 .adc_nids = alc883_adc_nids_alt,
9862 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9863 .capsrc_nids = alc883_capsrc_nids,
9864 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9865 .channel_mode = alc883_3ST_2ch_modes,
9866 .input_mux = &alc883_lenovo_101e_capture_source,
9867 .unsol_event = alc883_lenovo_101e_unsol_event,
9868 .init_hook = alc883_lenovo_101e_all_automute,
9870 [ALC883_LENOVO_NB0763] = {
9871 .mixers = { alc883_lenovo_nb0763_mixer },
9872 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9873 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9874 .dac_nids = alc883_dac_nids,
9875 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9876 .channel_mode = alc883_3ST_2ch_modes,
9878 .input_mux = &alc883_lenovo_nb0763_capture_source,
9879 .unsol_event = alc_automute_amp_unsol_event,
9880 .setup = alc883_medion_md2_setup,
9881 .init_hook = alc_automute_amp,
9883 [ALC888_LENOVO_MS7195_DIG] = {
9884 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9885 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9886 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9887 .dac_nids = alc883_dac_nids,
9888 .dig_out_nid = ALC883_DIGOUT_NID,
9889 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9890 .channel_mode = alc883_3ST_6ch_modes,
9892 .input_mux = &alc883_capture_source,
9893 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9894 .init_hook = alc888_lenovo_ms7195_front_automute,
9896 [ALC883_HAIER_W66] = {
9897 .mixers = { alc883_targa_2ch_mixer},
9898 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9899 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9900 .dac_nids = alc883_dac_nids,
9901 .dig_out_nid = ALC883_DIGOUT_NID,
9902 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9903 .channel_mode = alc883_3ST_2ch_modes,
9904 .input_mux = &alc883_capture_source,
9905 .unsol_event = alc_automute_amp_unsol_event,
9906 .setup = alc883_haier_w66_setup,
9907 .init_hook = alc_automute_amp,
9910 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9911 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9912 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9913 .dac_nids = alc883_dac_nids,
9914 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9915 .channel_mode = alc888_3st_hp_modes,
9917 .input_mux = &alc883_capture_source,
9918 .unsol_event = alc_automute_amp_unsol_event,
9919 .setup = alc888_3st_hp_setup,
9920 .init_hook = alc_automute_amp,
9922 [ALC888_6ST_DELL] = {
9923 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9924 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9925 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9926 .dac_nids = alc883_dac_nids,
9927 .dig_out_nid = ALC883_DIGOUT_NID,
9928 .dig_in_nid = ALC883_DIGIN_NID,
9929 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9930 .channel_mode = alc883_sixstack_modes,
9931 .input_mux = &alc883_capture_source,
9932 .unsol_event = alc_automute_amp_unsol_event,
9933 .setup = alc888_6st_dell_setup,
9934 .init_hook = alc_automute_amp,
9937 .mixers = { alc883_mitac_mixer },
9938 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9939 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9940 .dac_nids = alc883_dac_nids,
9941 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9942 .channel_mode = alc883_3ST_2ch_modes,
9943 .input_mux = &alc883_capture_source,
9944 .unsol_event = alc_automute_amp_unsol_event,
9945 .setup = alc883_mitac_setup,
9946 .init_hook = alc_automute_amp,
9948 [ALC883_FUJITSU_PI2515] = {
9949 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9950 .init_verbs = { alc883_init_verbs,
9951 alc883_2ch_fujitsu_pi2515_verbs},
9952 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9953 .dac_nids = alc883_dac_nids,
9954 .dig_out_nid = ALC883_DIGOUT_NID,
9955 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9956 .channel_mode = alc883_3ST_2ch_modes,
9957 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9958 .unsol_event = alc_automute_amp_unsol_event,
9959 .setup = alc883_2ch_fujitsu_pi2515_setup,
9960 .init_hook = alc_automute_amp,
9962 [ALC888_FUJITSU_XA3530] = {
9963 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9964 .init_verbs = { alc883_init_verbs,
9965 alc888_fujitsu_xa3530_verbs },
9966 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9967 .dac_nids = alc883_dac_nids,
9968 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9969 .adc_nids = alc883_adc_nids_rev,
9970 .capsrc_nids = alc883_capsrc_nids_rev,
9971 .dig_out_nid = ALC883_DIGOUT_NID,
9972 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9973 .channel_mode = alc888_4ST_8ch_intel_modes,
9975 ARRAY_SIZE(alc888_2_capture_sources),
9976 .input_mux = alc888_2_capture_sources,
9977 .unsol_event = alc_automute_amp_unsol_event,
9978 .setup = alc888_fujitsu_xa3530_setup,
9979 .init_hook = alc_automute_amp,
9981 [ALC888_LENOVO_SKY] = {
9982 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9983 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9984 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9985 .dac_nids = alc883_dac_nids,
9986 .dig_out_nid = ALC883_DIGOUT_NID,
9987 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9988 .channel_mode = alc883_sixstack_modes,
9990 .input_mux = &alc883_lenovo_sky_capture_source,
9991 .unsol_event = alc_automute_amp_unsol_event,
9992 .setup = alc888_lenovo_sky_setup,
9993 .init_hook = alc_automute_amp,
9995 [ALC888_ASUS_M90V] = {
9996 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9997 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9998 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9999 .dac_nids = alc883_dac_nids,
10000 .dig_out_nid = ALC883_DIGOUT_NID,
10001 .dig_in_nid = ALC883_DIGIN_NID,
10002 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10003 .channel_mode = alc883_3ST_6ch_modes,
10005 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10006 .unsol_event = alc_sku_unsol_event,
10007 .setup = alc883_mode2_setup,
10008 .init_hook = alc_inithook,
10010 [ALC888_ASUS_EEE1601] = {
10011 .mixers = { alc883_asus_eee1601_mixer },
10012 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10013 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10014 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10015 .dac_nids = alc883_dac_nids,
10016 .dig_out_nid = ALC883_DIGOUT_NID,
10017 .dig_in_nid = ALC883_DIGIN_NID,
10018 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10019 .channel_mode = alc883_3ST_2ch_modes,
10021 .input_mux = &alc883_asus_eee1601_capture_source,
10022 .unsol_event = alc_sku_unsol_event,
10023 .init_hook = alc883_eee1601_inithook,
10025 [ALC1200_ASUS_P5Q] = {
10026 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10027 .init_verbs = { alc883_init_verbs },
10028 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10029 .dac_nids = alc883_dac_nids,
10030 .dig_out_nid = ALC1200_DIGOUT_NID,
10031 .dig_in_nid = ALC883_DIGIN_NID,
10032 .slave_dig_outs = alc1200_slave_dig_outs,
10033 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10034 .channel_mode = alc883_sixstack_modes,
10035 .input_mux = &alc883_capture_source,
10038 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10039 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10040 alc880_gpio1_init_verbs },
10041 .adc_nids = alc883_adc_nids,
10042 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10043 .capsrc_nids = alc883_capsrc_nids,
10044 .dac_nids = alc883_dac_nids,
10045 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10046 .channel_mode = alc889A_mb31_6ch_modes,
10047 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10048 .input_mux = &alc889A_mb31_capture_source,
10049 .dig_out_nid = ALC883_DIGOUT_NID,
10050 .unsol_event = alc889A_mb31_unsol_event,
10051 .init_hook = alc889A_mb31_automute,
10053 [ALC883_SONY_VAIO_TT] = {
10054 .mixers = { alc883_vaiott_mixer },
10055 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10056 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10057 .dac_nids = alc883_dac_nids,
10058 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10059 .channel_mode = alc883_3ST_2ch_modes,
10060 .input_mux = &alc883_capture_source,
10061 .unsol_event = alc_automute_amp_unsol_event,
10062 .setup = alc883_vaiott_setup,
10063 .init_hook = alc_automute_amp,
10072 PINFIX_ABIT_AW9D_MAX
10075 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10076 { 0x15, 0x01080104 }, /* side */
10077 { 0x16, 0x01011012 }, /* rear */
10078 { 0x17, 0x01016011 }, /* clfe */
10082 static const struct alc_fixup alc882_fixups[] = {
10083 [PINFIX_ABIT_AW9D_MAX] = {
10084 .pins = alc882_abit_aw9d_pinfix
10088 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10089 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10094 * BIOS auto configuration
10096 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10097 const struct auto_pin_cfg *cfg)
10099 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10102 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10103 hda_nid_t nid, int pin_type,
10106 /* set as output */
10107 struct alc_spec *spec = codec->spec;
10110 alc_set_pin_output(codec, nid, pin_type);
10111 if (spec->multiout.dac_nids[dac_idx] == 0x25)
10114 idx = spec->multiout.dac_nids[dac_idx] - 2;
10115 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10119 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10121 struct alc_spec *spec = codec->spec;
10124 for (i = 0; i <= HDA_SIDE; i++) {
10125 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10126 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10128 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10133 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10135 struct alc_spec *spec = codec->spec;
10138 pin = spec->autocfg.hp_pins[0];
10139 if (pin) /* connect to front */
10141 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10142 pin = spec->autocfg.speaker_pins[0];
10144 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10147 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10149 struct alc_spec *spec = codec->spec;
10152 for (i = 0; i < AUTO_PIN_LAST; i++) {
10153 hda_nid_t nid = spec->autocfg.input_pins[i];
10156 alc_set_input_pin(codec, nid, i);
10157 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10158 snd_hda_codec_write(codec, nid, 0,
10159 AC_VERB_SET_AMP_GAIN_MUTE,
10164 static void alc882_auto_init_input_src(struct hda_codec *codec)
10166 struct alc_spec *spec = codec->spec;
10169 for (c = 0; c < spec->num_adc_nids; c++) {
10170 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10171 hda_nid_t nid = spec->capsrc_nids[c];
10172 unsigned int mux_idx;
10173 const struct hda_input_mux *imux;
10174 int conns, mute, idx, item;
10176 conns = snd_hda_get_connections(codec, nid, conn_list,
10177 ARRAY_SIZE(conn_list));
10180 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10181 imux = &spec->input_mux[mux_idx];
10182 if (!imux->num_items && mux_idx > 0)
10183 imux = &spec->input_mux[0];
10184 for (idx = 0; idx < conns; idx++) {
10185 /* if the current connection is the selected one,
10186 * unmute it as default - otherwise mute it
10188 mute = AMP_IN_MUTE(idx);
10189 for (item = 0; item < imux->num_items; item++) {
10190 if (imux->items[item].index == idx) {
10191 if (spec->cur_mux[c] == item)
10192 mute = AMP_IN_UNMUTE(idx);
10196 /* check if we have a selector or mixer
10197 * we could check for the widget type instead, but
10198 * just check for Amp-In presence (in case of mixer
10199 * without amp-in there is something wrong, this
10200 * function shouldn't be used or capsrc nid is wrong)
10202 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10203 snd_hda_codec_write(codec, nid, 0,
10204 AC_VERB_SET_AMP_GAIN_MUTE,
10206 else if (mute != AMP_IN_MUTE(idx))
10207 snd_hda_codec_write(codec, nid, 0,
10208 AC_VERB_SET_CONNECT_SEL,
10214 /* add mic boosts if needed */
10215 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10217 struct alc_spec *spec = codec->spec;
10221 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10222 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10223 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10225 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10229 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10230 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10231 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10233 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10240 /* almost identical with ALC880 parser... */
10241 static int alc882_parse_auto_config(struct hda_codec *codec)
10243 struct alc_spec *spec = codec->spec;
10244 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10247 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10251 if (!spec->autocfg.line_outs)
10252 return 0; /* can't find valid BIOS pin config */
10254 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10257 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10260 err = alc880_auto_create_extra_out(spec,
10261 spec->autocfg.speaker_pins[0],
10265 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10269 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10273 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10275 /* check multiple SPDIF-out (for recent codecs) */
10276 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10278 err = snd_hda_get_connections(codec,
10279 spec->autocfg.dig_out_pins[i],
10284 spec->multiout.dig_out_nid = dig_nid;
10286 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10287 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10289 spec->slave_dig_outs[i - 1] = dig_nid;
10292 if (spec->autocfg.dig_in_pin)
10293 spec->dig_in_nid = ALC880_DIGIN_NID;
10295 if (spec->kctls.list)
10296 add_mixer(spec, spec->kctls.list);
10298 add_verb(spec, alc883_auto_init_verbs);
10299 /* if ADC 0x07 is available, initialize it, too */
10300 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10301 add_verb(spec, alc882_adc1_init_verbs);
10303 spec->num_mux_defs = 1;
10304 spec->input_mux = &spec->private_imux[0];
10306 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10308 err = alc_auto_add_mic_boost(codec);
10312 return 1; /* config found */
10315 /* additional initialization for auto-configuration model */
10316 static void alc882_auto_init(struct hda_codec *codec)
10318 struct alc_spec *spec = codec->spec;
10319 alc882_auto_init_multi_out(codec);
10320 alc882_auto_init_hp_out(codec);
10321 alc882_auto_init_analog_input(codec);
10322 alc882_auto_init_input_src(codec);
10323 if (spec->unsol_event)
10324 alc_inithook(codec);
10327 static int patch_alc882(struct hda_codec *codec)
10329 struct alc_spec *spec;
10330 int err, board_config;
10332 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10336 codec->spec = spec;
10338 alc_auto_parse_customize_define(codec);
10340 switch (codec->vendor_id) {
10345 /* ALC883 and variants */
10346 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10350 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10354 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10355 board_config = snd_hda_check_board_codec_sid_config(codec,
10356 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10358 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10359 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10361 board_config = ALC882_AUTO;
10364 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10366 if (board_config == ALC882_AUTO) {
10367 /* automatic parse from the BIOS config */
10368 err = alc882_parse_auto_config(codec);
10374 "hda_codec: Cannot set up configuration "
10375 "from BIOS. Using base mode...\n");
10376 board_config = ALC882_3ST_DIG;
10380 err = snd_hda_attach_beep_device(codec, 0x1);
10386 if (board_config != ALC882_AUTO)
10387 setup_preset(codec, &alc882_presets[board_config]);
10389 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10390 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10391 /* FIXME: setup DAC5 */
10392 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10393 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10395 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10396 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10398 if (codec->vendor_id == 0x10ec0888)
10399 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10401 if (!spec->adc_nids && spec->input_mux) {
10403 spec->num_adc_nids = 0;
10404 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10405 const struct hda_input_mux *imux = spec->input_mux;
10407 hda_nid_t items[16];
10408 hda_nid_t nid = alc882_adc_nids[i];
10409 unsigned int wcap = get_wcaps(codec, nid);
10411 wcap = get_wcaps_type(wcap);
10412 if (wcap != AC_WID_AUD_IN)
10414 spec->private_adc_nids[spec->num_adc_nids] = nid;
10415 err = snd_hda_get_connections(codec, nid, &cap, 1);
10418 err = snd_hda_get_connections(codec, cap, items,
10419 ARRAY_SIZE(items));
10422 for (j = 0; j < imux->num_items; j++)
10423 if (imux->items[j].index >= err)
10425 if (j < imux->num_items)
10427 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10428 spec->num_adc_nids++;
10430 spec->adc_nids = spec->private_adc_nids;
10431 spec->capsrc_nids = spec->private_capsrc_nids;
10434 set_capture_mixer(codec);
10436 if (spec->cdefine.enable_pcbeep)
10437 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10439 spec->vmaster_nid = 0x0c;
10441 codec->patch_ops = alc_patch_ops;
10442 if (board_config == ALC882_AUTO)
10443 spec->init_hook = alc882_auto_init;
10444 #ifdef CONFIG_SND_HDA_POWER_SAVE
10445 if (!spec->loopback.amplist)
10446 spec->loopback.amplist = alc882_loopbacks;
10457 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10458 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10460 #define alc262_dac_nids alc260_dac_nids
10461 #define alc262_adc_nids alc882_adc_nids
10462 #define alc262_adc_nids_alt alc882_adc_nids_alt
10463 #define alc262_capsrc_nids alc882_capsrc_nids
10464 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10466 #define alc262_modes alc260_modes
10467 #define alc262_capture_source alc882_capture_source
10469 static hda_nid_t alc262_dmic_adc_nids[1] = {
10474 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10476 static struct snd_kcontrol_new alc262_base_mixer[] = {
10477 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10478 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10479 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10480 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10482 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10484 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10485 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10486 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10487 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10488 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10489 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10490 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10491 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10492 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10496 /* update HP, line and mono-out pins according to the master switch */
10497 static void alc262_hp_master_update(struct hda_codec *codec)
10499 struct alc_spec *spec = codec->spec;
10500 int val = spec->master_sw;
10502 /* HP & line-out */
10503 snd_hda_codec_write_cache(codec, 0x1b, 0,
10504 AC_VERB_SET_PIN_WIDGET_CONTROL,
10506 snd_hda_codec_write_cache(codec, 0x15, 0,
10507 AC_VERB_SET_PIN_WIDGET_CONTROL,
10509 /* mono (speaker) depending on the HP jack sense */
10510 val = val && !spec->jack_present;
10511 snd_hda_codec_write_cache(codec, 0x16, 0,
10512 AC_VERB_SET_PIN_WIDGET_CONTROL,
10513 val ? PIN_OUT : 0);
10516 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10518 struct alc_spec *spec = codec->spec;
10520 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10521 alc262_hp_master_update(codec);
10524 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10526 if ((res >> 26) != ALC880_HP_EVENT)
10528 alc262_hp_bpc_automute(codec);
10531 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10533 struct alc_spec *spec = codec->spec;
10535 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10536 alc262_hp_master_update(codec);
10539 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10542 if ((res >> 26) != ALC880_HP_EVENT)
10544 alc262_hp_wildwest_automute(codec);
10547 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10549 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10550 struct snd_ctl_elem_value *ucontrol)
10552 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10553 struct alc_spec *spec = codec->spec;
10554 int val = !!*ucontrol->value.integer.value;
10556 if (val == spec->master_sw)
10558 spec->master_sw = val;
10559 alc262_hp_master_update(codec);
10563 #define ALC262_HP_MASTER_SWITCH \
10565 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10566 .name = "Master Playback Switch", \
10567 .info = snd_ctl_boolean_mono_info, \
10568 .get = alc262_hp_master_sw_get, \
10569 .put = alc262_hp_master_sw_put, \
10572 .iface = NID_MAPPING, \
10573 .name = "Master Playback Switch", \
10574 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10578 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10579 ALC262_HP_MASTER_SWITCH,
10580 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10581 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10582 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10583 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10585 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10589 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10590 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10591 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10592 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10593 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10594 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10595 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10596 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10597 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10598 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10602 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10603 ALC262_HP_MASTER_SWITCH,
10604 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10605 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10606 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10608 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10610 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10612 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10613 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10614 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10615 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10616 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10617 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10618 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10622 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10623 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10624 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10625 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10629 /* mute/unmute internal speaker according to the hp jack and mute state */
10630 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10632 struct alc_spec *spec = codec->spec;
10634 spec->autocfg.hp_pins[0] = 0x15;
10635 spec->autocfg.speaker_pins[0] = 0x14;
10638 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10639 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10640 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10641 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10642 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10643 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10644 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10645 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10649 static struct hda_verb alc262_hp_t5735_verbs[] = {
10650 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10651 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10653 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10657 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10658 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10659 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10660 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10661 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10662 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10663 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10667 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10668 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10669 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10670 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10671 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10672 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10673 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10674 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10676 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10677 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10681 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10688 /* bind hp and internal speaker mute (with plug check) as master switch */
10689 static void alc262_hippo_master_update(struct hda_codec *codec)
10691 struct alc_spec *spec = codec->spec;
10692 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10693 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10694 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10698 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10699 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10700 HDA_AMP_MUTE, mute);
10701 /* mute internal speaker per jack sense */
10702 if (spec->jack_present)
10703 mute = HDA_AMP_MUTE;
10705 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10706 HDA_AMP_MUTE, mute);
10707 if (speaker_nid && speaker_nid != line_nid)
10708 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10709 HDA_AMP_MUTE, mute);
10712 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10714 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10715 struct snd_ctl_elem_value *ucontrol)
10717 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10718 struct alc_spec *spec = codec->spec;
10719 int val = !!*ucontrol->value.integer.value;
10721 if (val == spec->master_sw)
10723 spec->master_sw = val;
10724 alc262_hippo_master_update(codec);
10728 #define ALC262_HIPPO_MASTER_SWITCH \
10730 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10731 .name = "Master Playback Switch", \
10732 .info = snd_ctl_boolean_mono_info, \
10733 .get = alc262_hippo_master_sw_get, \
10734 .put = alc262_hippo_master_sw_put, \
10737 .iface = NID_MAPPING, \
10738 .name = "Master Playback Switch", \
10739 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10740 (SUBDEV_SPEAKER(0) << 16), \
10743 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10744 ALC262_HIPPO_MASTER_SWITCH,
10745 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10746 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10747 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10748 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10749 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10751 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10752 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10753 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10754 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10755 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10756 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10760 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10761 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10762 ALC262_HIPPO_MASTER_SWITCH,
10763 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10764 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10765 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10766 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10769 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10770 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10771 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10772 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10776 /* mute/unmute internal speaker according to the hp jack and mute state */
10777 static void alc262_hippo_automute(struct hda_codec *codec)
10779 struct alc_spec *spec = codec->spec;
10780 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10782 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10783 alc262_hippo_master_update(codec);
10786 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10788 if ((res >> 26) != ALC880_HP_EVENT)
10790 alc262_hippo_automute(codec);
10793 static void alc262_hippo_setup(struct hda_codec *codec)
10795 struct alc_spec *spec = codec->spec;
10797 spec->autocfg.hp_pins[0] = 0x15;
10798 spec->autocfg.speaker_pins[0] = 0x14;
10801 static void alc262_hippo1_setup(struct hda_codec *codec)
10803 struct alc_spec *spec = codec->spec;
10805 spec->autocfg.hp_pins[0] = 0x1b;
10806 spec->autocfg.speaker_pins[0] = 0x14;
10810 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10811 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10812 ALC262_HIPPO_MASTER_SWITCH,
10813 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10814 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10815 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10816 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10820 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10821 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10822 ALC262_HIPPO_MASTER_SWITCH,
10823 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10826 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10827 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10831 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10832 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10833 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10834 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10835 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10836 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10837 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10839 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10840 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10841 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10842 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10843 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10847 static struct hda_verb alc262_tyan_verbs[] = {
10848 /* Headphone automute */
10849 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10850 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10851 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10853 /* P11 AUX_IN, white 4-pin connector */
10854 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10855 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10856 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10857 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10862 /* unsolicited event for HP jack sensing */
10863 static void alc262_tyan_setup(struct hda_codec *codec)
10865 struct alc_spec *spec = codec->spec;
10867 spec->autocfg.hp_pins[0] = 0x1b;
10868 spec->autocfg.speaker_pins[0] = 0x15;
10872 #define alc262_capture_mixer alc882_capture_mixer
10873 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10876 * generic initialization of ADC, input mixers and output mixers
10878 static struct hda_verb alc262_init_verbs[] = {
10880 * Unmute ADC0-2 and set the default input to mic-in
10882 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10883 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10884 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10885 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10886 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10887 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10889 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10891 * Note: PASD motherboards uses the Line In 2 as the input for
10892 * front panel mic (mic 2)
10894 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10895 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10896 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10897 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10898 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10899 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10902 * Set up output mixers (0x0c - 0x0e)
10904 /* set vol=0 to output mixers */
10905 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10906 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10907 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10908 /* set up input amps for analog loopback */
10909 /* Amp Indices: DAC = 0, mixer = 1 */
10910 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10912 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10913 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10914 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10915 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10919 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10920 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10921 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10922 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10924 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10925 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10926 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10927 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10928 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10930 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10931 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10933 /* FIXME: use matrix-type input source selection */
10934 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10935 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10936 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10937 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10938 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10939 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10941 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10942 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10943 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10944 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10946 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10947 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10948 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10949 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10954 static struct hda_verb alc262_eapd_verbs[] = {
10955 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10956 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10960 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10961 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10962 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10963 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10965 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10966 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10970 static struct hda_verb alc262_sony_unsol_verbs[] = {
10971 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10972 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10973 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10975 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10980 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10981 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10982 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10984 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10985 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10989 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10990 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10991 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10992 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10994 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10995 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10996 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10997 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11001 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11003 struct alc_spec *spec = codec->spec;
11005 spec->autocfg.hp_pins[0] = 0x15;
11006 spec->autocfg.speaker_pins[0] = 0x14;
11007 spec->ext_mic.pin = 0x18;
11008 spec->ext_mic.mux_idx = 0;
11009 spec->int_mic.pin = 0x12;
11010 spec->int_mic.mux_idx = 9;
11011 spec->auto_mic = 1;
11017 * 0x16 = internal speaker
11018 * 0x18 = external mic
11021 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11022 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11023 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11029 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11034 static struct hda_verb alc262_nec_verbs[] = {
11035 /* Unmute Speaker */
11036 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11039 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11042 /* External mic to headphone */
11043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11044 /* External mic to speaker */
11045 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11051 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11052 * 0x1b = port replicator headphone out
11055 #define ALC_HP_EVENT 0x37
11057 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11058 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11060 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11065 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11066 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11067 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11071 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11072 /* Front Mic pin: input vref at 50% */
11073 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11074 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11078 static struct hda_input_mux alc262_fujitsu_capture_source = {
11082 { "Int Mic", 0x1 },
11087 static struct hda_input_mux alc262_HP_capture_source = {
11091 { "Front Mic", 0x1 },
11098 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11102 { "Front Mic", 0x2 },
11108 /* mute/unmute internal speaker according to the hp jacks and mute state */
11109 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11111 struct alc_spec *spec = codec->spec;
11114 if (force || !spec->sense_updated) {
11115 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11116 snd_hda_jack_detect(codec, 0x1b);
11117 spec->sense_updated = 1;
11119 /* unmute internal speaker only if both HPs are unplugged and
11120 * master switch is on
11122 if (spec->jack_present)
11123 mute = HDA_AMP_MUTE;
11125 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11126 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11127 HDA_AMP_MUTE, mute);
11130 /* unsolicited event for HP jack sensing */
11131 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11134 if ((res >> 26) != ALC_HP_EVENT)
11136 alc262_fujitsu_automute(codec, 1);
11139 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11141 alc262_fujitsu_automute(codec, 1);
11144 /* bind volumes of both NID 0x0c and 0x0d */
11145 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11146 .ops = &snd_hda_bind_vol,
11148 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11149 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11154 /* mute/unmute internal speaker according to the hp jack and mute state */
11155 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11157 struct alc_spec *spec = codec->spec;
11160 if (force || !spec->sense_updated) {
11161 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11162 spec->sense_updated = 1;
11164 if (spec->jack_present) {
11165 /* mute internal speaker */
11166 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11167 HDA_AMP_MUTE, HDA_AMP_MUTE);
11168 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11169 HDA_AMP_MUTE, HDA_AMP_MUTE);
11171 /* unmute internal speaker if necessary */
11172 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11173 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11174 HDA_AMP_MUTE, mute);
11175 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11176 HDA_AMP_MUTE, mute);
11180 /* unsolicited event for HP jack sensing */
11181 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11184 if ((res >> 26) != ALC_HP_EVENT)
11186 alc262_lenovo_3000_automute(codec, 1);
11189 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11190 int dir, int idx, long *valp)
11194 for (i = 0; i < 2; i++, valp++)
11195 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11197 *valp ? 0 : HDA_AMP_MUTE);
11201 /* bind hp and internal speaker mute (with plug check) */
11202 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11203 struct snd_ctl_elem_value *ucontrol)
11205 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11206 long *valp = ucontrol->value.integer.value;
11209 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11210 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11212 alc262_fujitsu_automute(codec, 0);
11216 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11217 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11220 .name = "Master Playback Switch",
11221 .subdevice = HDA_SUBDEV_AMP_FLAG,
11222 .info = snd_hda_mixer_amp_switch_info,
11223 .get = snd_hda_mixer_amp_switch_get,
11224 .put = alc262_fujitsu_master_sw_put,
11225 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11228 .iface = NID_MAPPING,
11229 .name = "Master Playback Switch",
11230 .private_value = 0x1b,
11232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11234 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11237 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11238 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11239 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11243 /* bind hp and internal speaker mute (with plug check) */
11244 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11245 struct snd_ctl_elem_value *ucontrol)
11247 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11248 long *valp = ucontrol->value.integer.value;
11251 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11253 alc262_lenovo_3000_automute(codec, 0);
11257 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11258 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11260 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11261 .name = "Master Playback Switch",
11262 .subdevice = HDA_SUBDEV_AMP_FLAG,
11263 .info = snd_hda_mixer_amp_switch_info,
11264 .get = snd_hda_mixer_amp_switch_get,
11265 .put = alc262_lenovo_3000_master_sw_put,
11266 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11268 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11269 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11270 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11273 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11274 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11275 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11279 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11280 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11281 ALC262_HIPPO_MASTER_SWITCH,
11282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11284 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11285 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11286 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11287 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11291 /* additional init verbs for Benq laptops */
11292 static struct hda_verb alc262_EAPD_verbs[] = {
11293 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11294 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11298 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11299 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11300 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11302 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11303 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11307 /* Samsung Q1 Ultra Vista model setup */
11308 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11309 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11310 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11312 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11313 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11314 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11318 static struct hda_verb alc262_ultra_verbs[] = {
11320 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11321 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11322 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11325 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11327 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11332 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11333 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11335 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11337 /* ADC, choose mic */
11338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11344 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11351 /* mute/unmute internal speaker according to the hp jack and mute state */
11352 static void alc262_ultra_automute(struct hda_codec *codec)
11354 struct alc_spec *spec = codec->spec;
11358 /* auto-mute only when HP is used as HP */
11359 if (!spec->cur_mux[0]) {
11360 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11361 if (spec->jack_present)
11362 mute = HDA_AMP_MUTE;
11364 /* mute/unmute internal speaker */
11365 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11366 HDA_AMP_MUTE, mute);
11367 /* mute/unmute HP */
11368 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11369 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11372 /* unsolicited event for HP jack sensing */
11373 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11376 if ((res >> 26) != ALC880_HP_EVENT)
11378 alc262_ultra_automute(codec);
11381 static struct hda_input_mux alc262_ultra_capture_source = {
11385 { "Headphone", 0x7 },
11389 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11390 struct snd_ctl_elem_value *ucontrol)
11392 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11393 struct alc_spec *spec = codec->spec;
11396 ret = alc_mux_enum_put(kcontrol, ucontrol);
11399 /* reprogram the HP pin as mic or HP according to the input source */
11400 snd_hda_codec_write_cache(codec, 0x15, 0,
11401 AC_VERB_SET_PIN_WIDGET_CONTROL,
11402 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11403 alc262_ultra_automute(codec); /* mute/unmute HP */
11407 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11408 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11409 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11411 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11412 .name = "Capture Source",
11413 .info = alc_mux_enum_info,
11414 .get = alc_mux_enum_get,
11415 .put = alc262_ultra_mux_enum_put,
11418 .iface = NID_MAPPING,
11419 .name = "Capture Source",
11420 .private_value = 0x15,
11425 /* We use two mixers depending on the output pin; 0x16 is a mono output
11426 * and thus it's bound with a different mixer.
11427 * This function returns which mixer amp should be used.
11429 static int alc262_check_volbit(hda_nid_t nid)
11433 else if (nid == 0x16)
11439 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11440 const char *pfx, int *vbits)
11445 vbit = alc262_check_volbit(nid);
11448 if (*vbits & vbit) /* a volume control for this mixer already there */
11452 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11454 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11455 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11458 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11466 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11468 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11469 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11472 /* add playback controls from the parsed DAC table */
11473 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11474 const struct auto_pin_cfg *cfg)
11480 spec->multiout.num_dacs = 1; /* only use one dac */
11481 spec->multiout.dac_nids = spec->private_dac_nids;
11482 spec->multiout.dac_nids[0] = 2;
11484 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11486 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11490 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11493 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11496 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11500 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11501 alc262_check_volbit(cfg->speaker_pins[0]) |
11502 alc262_check_volbit(cfg->hp_pins[0]);
11503 if (vbits == 1 || vbits == 2)
11504 pfx = "Master"; /* only one mixer is used */
11505 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11510 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11513 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11517 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11524 #define alc262_auto_create_input_ctls \
11525 alc882_auto_create_input_ctls
11528 * generic initialization of ADC, input mixers and output mixers
11530 static struct hda_verb alc262_volume_init_verbs[] = {
11532 * Unmute ADC0-2 and set the default input to mic-in
11534 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11535 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11536 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11538 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11541 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11543 * Note: PASD motherboards uses the Line In 2 as the input for
11544 * front panel mic (mic 2)
11546 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11554 * Set up output mixers (0x0c - 0x0f)
11556 /* set vol=0 to output mixers */
11557 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11558 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11559 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11561 /* set up input amps for analog loopback */
11562 /* Amp Indices: DAC = 0, mixer = 1 */
11563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11567 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11570 /* FIXME: use matrix-type input source selection */
11571 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11572 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11573 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11575 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11578 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11579 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11580 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11581 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11583 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11584 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11585 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11591 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11593 * Unmute ADC0-2 and set the default input to mic-in
11595 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11597 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11598 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11599 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11602 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11604 * Note: PASD motherboards uses the Line In 2 as the input for
11605 * front panel mic (mic 2)
11607 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11617 * Set up output mixers (0x0c - 0x0e)
11619 /* set vol=0 to output mixers */
11620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11621 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11624 /* set up input amps for analog loopback */
11625 /* Amp Indices: DAC = 0, mixer = 1 */
11626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11633 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11635 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11637 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11640 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11644 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11645 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11646 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11647 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11649 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11650 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11651 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11652 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11653 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11654 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11657 /* FIXME: use matrix-type input source selection */
11658 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11659 /* Input mixer1: only unmute Mic */
11660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11667 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11668 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11671 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11672 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11673 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11674 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11675 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11676 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11678 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11685 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11686 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11687 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11688 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11690 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11695 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11697 * Unmute ADC0-2 and set the default input to mic-in
11699 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11701 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11702 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11703 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11704 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11706 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11708 * Note: PASD motherboards uses the Line In 2 as the input for front
11709 * panel mic (mic 2)
11711 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11714 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11716 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11717 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11718 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11719 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11721 * Set up output mixers (0x0c - 0x0e)
11723 /* set vol=0 to output mixers */
11724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11725 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11728 /* set up input amps for analog loopback */
11729 /* Amp Indices: DAC = 0, mixer = 1 */
11730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11738 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11739 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11742 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11743 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11744 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11746 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11747 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11749 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11750 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11752 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11753 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11754 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11756 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11757 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11759 /* FIXME: use matrix-type input source selection */
11760 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11761 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11763 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11765 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11766 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11767 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11771 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11775 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11776 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11783 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11784 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11786 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11791 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11793 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11794 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11795 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11797 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11798 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11800 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11803 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11804 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11809 #ifdef CONFIG_SND_HDA_POWER_SAVE
11810 #define alc262_loopbacks alc880_loopbacks
11813 /* pcm configuration: identical with ALC880 */
11814 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11815 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11816 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11817 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11820 * BIOS auto configuration
11822 static int alc262_parse_auto_config(struct hda_codec *codec)
11824 struct alc_spec *spec = codec->spec;
11826 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11828 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11832 if (!spec->autocfg.line_outs) {
11833 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11834 spec->multiout.max_channels = 2;
11835 spec->no_analog = 1;
11838 return 0; /* can't find valid BIOS pin config */
11840 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11843 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11847 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11850 if (spec->autocfg.dig_outs) {
11851 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11852 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11854 if (spec->autocfg.dig_in_pin)
11855 spec->dig_in_nid = ALC262_DIGIN_NID;
11857 if (spec->kctls.list)
11858 add_mixer(spec, spec->kctls.list);
11860 add_verb(spec, alc262_volume_init_verbs);
11861 spec->num_mux_defs = 1;
11862 spec->input_mux = &spec->private_imux[0];
11864 err = alc_auto_add_mic_boost(codec);
11868 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11873 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11874 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11875 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11876 #define alc262_auto_init_input_src alc882_auto_init_input_src
11879 /* init callback for auto-configuration model -- overriding the default init */
11880 static void alc262_auto_init(struct hda_codec *codec)
11882 struct alc_spec *spec = codec->spec;
11883 alc262_auto_init_multi_out(codec);
11884 alc262_auto_init_hp_out(codec);
11885 alc262_auto_init_analog_input(codec);
11886 alc262_auto_init_input_src(codec);
11887 if (spec->unsol_event)
11888 alc_inithook(codec);
11892 * configuration and preset
11894 static const char *alc262_models[ALC262_MODEL_LAST] = {
11895 [ALC262_BASIC] = "basic",
11896 [ALC262_HIPPO] = "hippo",
11897 [ALC262_HIPPO_1] = "hippo_1",
11898 [ALC262_FUJITSU] = "fujitsu",
11899 [ALC262_HP_BPC] = "hp-bpc",
11900 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11901 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11902 [ALC262_HP_RP5700] = "hp-rp5700",
11903 [ALC262_BENQ_ED8] = "benq",
11904 [ALC262_BENQ_T31] = "benq-t31",
11905 [ALC262_SONY_ASSAMD] = "sony-assamd",
11906 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11907 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11908 [ALC262_ULTRA] = "ultra",
11909 [ALC262_LENOVO_3000] = "lenovo-3000",
11910 [ALC262_NEC] = "nec",
11911 [ALC262_TYAN] = "tyan",
11912 [ALC262_AUTO] = "auto",
11915 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11916 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11917 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11918 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11920 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11922 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11924 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11925 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11926 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11927 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11928 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11929 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11930 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11931 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11932 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11933 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11934 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11935 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11936 ALC262_HP_TC_T5735),
11937 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11938 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11939 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11940 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11941 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11942 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11943 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11944 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11945 #if 0 /* disable the quirk since model=auto works better in recent versions */
11946 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11947 ALC262_SONY_ASSAMD),
11949 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11950 ALC262_TOSHIBA_RX1),
11951 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11952 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11953 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11954 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11955 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11957 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11958 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11959 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11960 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11961 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11965 static struct alc_config_preset alc262_presets[] = {
11967 .mixers = { alc262_base_mixer },
11968 .init_verbs = { alc262_init_verbs },
11969 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11970 .dac_nids = alc262_dac_nids,
11972 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11973 .channel_mode = alc262_modes,
11974 .input_mux = &alc262_capture_source,
11977 .mixers = { alc262_hippo_mixer },
11978 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11979 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11980 .dac_nids = alc262_dac_nids,
11982 .dig_out_nid = ALC262_DIGOUT_NID,
11983 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11984 .channel_mode = alc262_modes,
11985 .input_mux = &alc262_capture_source,
11986 .unsol_event = alc262_hippo_unsol_event,
11987 .setup = alc262_hippo_setup,
11988 .init_hook = alc262_hippo_automute,
11990 [ALC262_HIPPO_1] = {
11991 .mixers = { alc262_hippo1_mixer },
11992 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11993 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11994 .dac_nids = alc262_dac_nids,
11996 .dig_out_nid = ALC262_DIGOUT_NID,
11997 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11998 .channel_mode = alc262_modes,
11999 .input_mux = &alc262_capture_source,
12000 .unsol_event = alc262_hippo_unsol_event,
12001 .setup = alc262_hippo1_setup,
12002 .init_hook = alc262_hippo_automute,
12004 [ALC262_FUJITSU] = {
12005 .mixers = { alc262_fujitsu_mixer },
12006 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12007 alc262_fujitsu_unsol_verbs },
12008 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12009 .dac_nids = alc262_dac_nids,
12011 .dig_out_nid = ALC262_DIGOUT_NID,
12012 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12013 .channel_mode = alc262_modes,
12014 .input_mux = &alc262_fujitsu_capture_source,
12015 .unsol_event = alc262_fujitsu_unsol_event,
12016 .init_hook = alc262_fujitsu_init_hook,
12018 [ALC262_HP_BPC] = {
12019 .mixers = { alc262_HP_BPC_mixer },
12020 .init_verbs = { alc262_HP_BPC_init_verbs },
12021 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12022 .dac_nids = alc262_dac_nids,
12024 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12025 .channel_mode = alc262_modes,
12026 .input_mux = &alc262_HP_capture_source,
12027 .unsol_event = alc262_hp_bpc_unsol_event,
12028 .init_hook = alc262_hp_bpc_automute,
12030 [ALC262_HP_BPC_D7000_WF] = {
12031 .mixers = { alc262_HP_BPC_WildWest_mixer },
12032 .init_verbs = { alc262_HP_BPC_WildWest_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_D7000_capture_source,
12039 .unsol_event = alc262_hp_wildwest_unsol_event,
12040 .init_hook = alc262_hp_wildwest_automute,
12042 [ALC262_HP_BPC_D7000_WL] = {
12043 .mixers = { alc262_HP_BPC_WildWest_mixer,
12044 alc262_HP_BPC_WildWest_option_mixer },
12045 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12046 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12047 .dac_nids = alc262_dac_nids,
12049 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12050 .channel_mode = alc262_modes,
12051 .input_mux = &alc262_HP_D7000_capture_source,
12052 .unsol_event = alc262_hp_wildwest_unsol_event,
12053 .init_hook = alc262_hp_wildwest_automute,
12055 [ALC262_HP_TC_T5735] = {
12056 .mixers = { alc262_hp_t5735_mixer },
12057 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_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_capture_source,
12064 .unsol_event = alc_sku_unsol_event,
12065 .setup = alc262_hp_t5735_setup,
12066 .init_hook = alc_inithook,
12068 [ALC262_HP_RP5700] = {
12069 .mixers = { alc262_hp_rp5700_mixer },
12070 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12071 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12072 .dac_nids = alc262_dac_nids,
12073 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12074 .channel_mode = alc262_modes,
12075 .input_mux = &alc262_hp_rp5700_capture_source,
12077 [ALC262_BENQ_ED8] = {
12078 .mixers = { alc262_base_mixer },
12079 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12080 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12081 .dac_nids = alc262_dac_nids,
12083 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12084 .channel_mode = alc262_modes,
12085 .input_mux = &alc262_capture_source,
12087 [ALC262_SONY_ASSAMD] = {
12088 .mixers = { alc262_sony_mixer },
12089 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12090 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12091 .dac_nids = alc262_dac_nids,
12093 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12094 .channel_mode = alc262_modes,
12095 .input_mux = &alc262_capture_source,
12096 .unsol_event = alc262_hippo_unsol_event,
12097 .setup = alc262_hippo_setup,
12098 .init_hook = alc262_hippo_automute,
12100 [ALC262_BENQ_T31] = {
12101 .mixers = { alc262_benq_t31_mixer },
12102 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12103 alc_hp15_unsol_verbs },
12104 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12105 .dac_nids = alc262_dac_nids,
12107 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12108 .channel_mode = alc262_modes,
12109 .input_mux = &alc262_capture_source,
12110 .unsol_event = alc262_hippo_unsol_event,
12111 .setup = alc262_hippo_setup,
12112 .init_hook = alc262_hippo_automute,
12115 .mixers = { alc262_ultra_mixer },
12116 .cap_mixer = alc262_ultra_capture_mixer,
12117 .init_verbs = { alc262_ultra_verbs },
12118 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12119 .dac_nids = alc262_dac_nids,
12120 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12121 .channel_mode = alc262_modes,
12122 .input_mux = &alc262_ultra_capture_source,
12123 .adc_nids = alc262_adc_nids, /* ADC0 */
12124 .capsrc_nids = alc262_capsrc_nids,
12125 .num_adc_nids = 1, /* single ADC */
12126 .unsol_event = alc262_ultra_unsol_event,
12127 .init_hook = alc262_ultra_automute,
12129 [ALC262_LENOVO_3000] = {
12130 .mixers = { alc262_lenovo_3000_mixer },
12131 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12132 alc262_lenovo_3000_unsol_verbs,
12133 alc262_lenovo_3000_init_verbs },
12134 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12135 .dac_nids = alc262_dac_nids,
12137 .dig_out_nid = ALC262_DIGOUT_NID,
12138 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12139 .channel_mode = alc262_modes,
12140 .input_mux = &alc262_fujitsu_capture_source,
12141 .unsol_event = alc262_lenovo_3000_unsol_event,
12144 .mixers = { alc262_nec_mixer },
12145 .init_verbs = { alc262_nec_verbs },
12146 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12147 .dac_nids = alc262_dac_nids,
12149 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12150 .channel_mode = alc262_modes,
12151 .input_mux = &alc262_capture_source,
12153 [ALC262_TOSHIBA_S06] = {
12154 .mixers = { alc262_toshiba_s06_mixer },
12155 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12156 alc262_eapd_verbs },
12157 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12158 .capsrc_nids = alc262_dmic_capsrc_nids,
12159 .dac_nids = alc262_dac_nids,
12160 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12161 .num_adc_nids = 1, /* single ADC */
12162 .dig_out_nid = ALC262_DIGOUT_NID,
12163 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12164 .channel_mode = alc262_modes,
12165 .unsol_event = alc_sku_unsol_event,
12166 .setup = alc262_toshiba_s06_setup,
12167 .init_hook = alc_inithook,
12169 [ALC262_TOSHIBA_RX1] = {
12170 .mixers = { alc262_toshiba_rx1_mixer },
12171 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12172 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12173 .dac_nids = alc262_dac_nids,
12175 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12176 .channel_mode = alc262_modes,
12177 .input_mux = &alc262_capture_source,
12178 .unsol_event = alc262_hippo_unsol_event,
12179 .setup = alc262_hippo_setup,
12180 .init_hook = alc262_hippo_automute,
12183 .mixers = { alc262_tyan_mixer },
12184 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12185 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12186 .dac_nids = alc262_dac_nids,
12188 .dig_out_nid = ALC262_DIGOUT_NID,
12189 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12190 .channel_mode = alc262_modes,
12191 .input_mux = &alc262_capture_source,
12192 .unsol_event = alc_automute_amp_unsol_event,
12193 .setup = alc262_tyan_setup,
12194 .init_hook = alc_automute_amp,
12198 static int patch_alc262(struct hda_codec *codec)
12200 struct alc_spec *spec;
12204 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12208 codec->spec = spec;
12210 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12215 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12216 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12217 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12218 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12221 alc_auto_parse_customize_define(codec);
12223 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12225 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12229 if (board_config < 0) {
12230 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12232 board_config = ALC262_AUTO;
12235 if (board_config == ALC262_AUTO) {
12236 /* automatic parse from the BIOS config */
12237 err = alc262_parse_auto_config(codec);
12243 "hda_codec: Cannot set up configuration "
12244 "from BIOS. Using base mode...\n");
12245 board_config = ALC262_BASIC;
12249 if (!spec->no_analog) {
12250 err = snd_hda_attach_beep_device(codec, 0x1);
12257 if (board_config != ALC262_AUTO)
12258 setup_preset(codec, &alc262_presets[board_config]);
12260 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12261 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12263 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12264 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12266 if (!spec->adc_nids && spec->input_mux) {
12268 /* check whether the digital-mic has to be supported */
12269 for (i = 0; i < spec->input_mux->num_items; i++) {
12270 if (spec->input_mux->items[i].index >= 9)
12273 if (i < spec->input_mux->num_items) {
12274 /* use only ADC0 */
12275 spec->adc_nids = alc262_dmic_adc_nids;
12276 spec->num_adc_nids = 1;
12277 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12279 /* all analog inputs */
12280 /* check whether NID 0x07 is valid */
12281 unsigned int wcap = get_wcaps(codec, 0x07);
12284 wcap = get_wcaps_type(wcap);
12285 if (wcap != AC_WID_AUD_IN) {
12286 spec->adc_nids = alc262_adc_nids_alt;
12287 spec->num_adc_nids =
12288 ARRAY_SIZE(alc262_adc_nids_alt);
12289 spec->capsrc_nids = alc262_capsrc_nids_alt;
12291 spec->adc_nids = alc262_adc_nids;
12292 spec->num_adc_nids =
12293 ARRAY_SIZE(alc262_adc_nids);
12294 spec->capsrc_nids = alc262_capsrc_nids;
12298 if (!spec->cap_mixer && !spec->no_analog)
12299 set_capture_mixer(codec);
12300 if (!spec->no_analog && spec->cdefine.enable_pcbeep)
12301 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12303 spec->vmaster_nid = 0x0c;
12305 codec->patch_ops = alc_patch_ops;
12306 if (board_config == ALC262_AUTO)
12307 spec->init_hook = alc262_auto_init;
12308 #ifdef CONFIG_SND_HDA_POWER_SAVE
12309 if (!spec->loopback.amplist)
12310 spec->loopback.amplist = alc262_loopbacks;
12317 * ALC268 channel source setting (2 channel)
12319 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12320 #define alc268_modes alc260_modes
12322 static hda_nid_t alc268_dac_nids[2] = {
12327 static hda_nid_t alc268_adc_nids[2] = {
12332 static hda_nid_t alc268_adc_nids_alt[1] = {
12337 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12339 static struct snd_kcontrol_new alc268_base_mixer[] = {
12340 /* output mixer control */
12341 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12342 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12343 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12345 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12346 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12347 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12351 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12352 /* output mixer control */
12353 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12354 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12355 ALC262_HIPPO_MASTER_SWITCH,
12356 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12357 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12358 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12362 /* bind Beep switches of both NID 0x0f and 0x10 */
12363 static struct hda_bind_ctls alc268_bind_beep_sw = {
12364 .ops = &snd_hda_bind_sw,
12366 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12367 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12372 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12373 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12374 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12378 static struct hda_verb alc268_eapd_verbs[] = {
12379 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12380 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12384 /* Toshiba specific */
12385 static struct hda_verb alc268_toshiba_verbs[] = {
12386 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12390 /* Acer specific */
12391 /* bind volumes of both NID 0x02 and 0x03 */
12392 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12393 .ops = &snd_hda_bind_vol,
12395 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12396 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12401 /* mute/unmute internal speaker according to the hp jack and mute state */
12402 static void alc268_acer_automute(struct hda_codec *codec, int force)
12404 struct alc_spec *spec = codec->spec;
12407 if (force || !spec->sense_updated) {
12408 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12409 spec->sense_updated = 1;
12411 if (spec->jack_present)
12412 mute = HDA_AMP_MUTE; /* mute internal speaker */
12413 else /* unmute internal speaker if necessary */
12414 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12415 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12416 HDA_AMP_MUTE, mute);
12420 /* bind hp and internal speaker mute (with plug check) */
12421 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12422 struct snd_ctl_elem_value *ucontrol)
12424 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12425 long *valp = ucontrol->value.integer.value;
12428 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12430 alc268_acer_automute(codec, 0);
12434 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12435 /* output mixer control */
12436 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12439 .name = "Master Playback Switch",
12440 .subdevice = HDA_SUBDEV_AMP_FLAG,
12441 .info = snd_hda_mixer_amp_switch_info,
12442 .get = snd_hda_mixer_amp_switch_get,
12443 .put = alc268_acer_master_sw_put,
12444 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12446 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12450 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12451 /* output mixer control */
12452 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12454 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12455 .name = "Master Playback Switch",
12456 .subdevice = HDA_SUBDEV_AMP_FLAG,
12457 .info = snd_hda_mixer_amp_switch_info,
12458 .get = snd_hda_mixer_amp_switch_get,
12459 .put = alc268_acer_master_sw_put,
12460 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12462 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12463 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12464 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12468 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12469 /* output mixer control */
12470 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12472 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12473 .name = "Master Playback Switch",
12474 .subdevice = HDA_SUBDEV_AMP_FLAG,
12475 .info = snd_hda_mixer_amp_switch_info,
12476 .get = snd_hda_mixer_amp_switch_get,
12477 .put = alc268_acer_master_sw_put,
12478 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12480 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12481 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12485 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12486 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12488 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12489 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12490 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12491 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12495 static struct hda_verb alc268_acer_verbs[] = {
12496 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12497 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12500 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12502 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12506 /* unsolicited event for HP jack sensing */
12507 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12508 #define alc268_toshiba_setup alc262_hippo_setup
12509 #define alc268_toshiba_automute alc262_hippo_automute
12511 static void alc268_acer_unsol_event(struct hda_codec *codec,
12514 if ((res >> 26) != ALC880_HP_EVENT)
12516 alc268_acer_automute(codec, 1);
12519 static void alc268_acer_init_hook(struct hda_codec *codec)
12521 alc268_acer_automute(codec, 1);
12524 /* toggle speaker-output according to the hp-jack state */
12525 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12527 unsigned int present;
12528 unsigned char bits;
12530 present = snd_hda_jack_detect(codec, 0x15);
12531 bits = present ? AMP_IN_MUTE(0) : 0;
12532 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12533 AMP_IN_MUTE(0), bits);
12534 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12535 AMP_IN_MUTE(0), bits);
12538 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12541 switch (res >> 26) {
12542 case ALC880_HP_EVENT:
12543 alc268_aspire_one_speaker_automute(codec);
12545 case ALC880_MIC_EVENT:
12546 alc_mic_automute(codec);
12551 static void alc268_acer_lc_setup(struct hda_codec *codec)
12553 struct alc_spec *spec = codec->spec;
12554 spec->ext_mic.pin = 0x18;
12555 spec->ext_mic.mux_idx = 0;
12556 spec->int_mic.pin = 0x12;
12557 spec->int_mic.mux_idx = 6;
12558 spec->auto_mic = 1;
12561 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12563 alc268_aspire_one_speaker_automute(codec);
12564 alc_mic_automute(codec);
12567 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12568 /* output mixer control */
12569 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12570 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12571 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12572 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12573 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12574 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12578 static struct hda_verb alc268_dell_verbs[] = {
12579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12581 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12582 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12586 /* mute/unmute internal speaker according to the hp jack and mute state */
12587 static void alc268_dell_setup(struct hda_codec *codec)
12589 struct alc_spec *spec = codec->spec;
12591 spec->autocfg.hp_pins[0] = 0x15;
12592 spec->autocfg.speaker_pins[0] = 0x14;
12593 spec->ext_mic.pin = 0x18;
12594 spec->ext_mic.mux_idx = 0;
12595 spec->int_mic.pin = 0x19;
12596 spec->int_mic.mux_idx = 1;
12597 spec->auto_mic = 1;
12600 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12601 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12602 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12603 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12604 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12605 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12606 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12607 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12608 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12612 static struct hda_verb alc267_quanta_il1_verbs[] = {
12613 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12614 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12618 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12620 struct alc_spec *spec = codec->spec;
12621 spec->autocfg.hp_pins[0] = 0x15;
12622 spec->autocfg.speaker_pins[0] = 0x14;
12623 spec->ext_mic.pin = 0x18;
12624 spec->ext_mic.mux_idx = 0;
12625 spec->int_mic.pin = 0x19;
12626 spec->int_mic.mux_idx = 1;
12627 spec->auto_mic = 1;
12631 * generic initialization of ADC, input mixers and output mixers
12633 static struct hda_verb alc268_base_init_verbs[] = {
12634 /* Unmute DAC0-1 and set vol = 0 */
12635 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12636 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12639 * Set up output mixers (0x0c - 0x0e)
12641 /* set vol=0 to output mixers */
12642 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12643 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12645 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12646 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12648 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12650 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12651 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12652 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12653 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12654 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12655 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12658 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12659 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12660 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12661 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12663 /* set PCBEEP vol = 0, mute connections */
12664 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12665 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12666 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12668 /* Unmute Selector 23h,24h and set the default input to mic-in */
12670 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12671 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12672 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12679 * generic initialization of ADC, input mixers and output mixers
12681 static struct hda_verb alc268_volume_init_verbs[] = {
12682 /* set output DAC */
12683 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12684 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12686 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12687 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12688 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12689 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12690 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12692 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12693 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12694 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12696 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12697 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12699 /* set PCBEEP vol = 0, mute connections */
12700 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12701 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12702 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12707 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12708 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12709 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12713 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12714 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12715 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12720 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12721 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12722 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12723 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12724 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12729 static struct hda_input_mux alc268_capture_source = {
12733 { "Front Mic", 0x1 },
12739 static struct hda_input_mux alc268_acer_capture_source = {
12743 { "Internal Mic", 0x1 },
12748 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12752 { "Internal Mic", 0x6 },
12757 #ifdef CONFIG_SND_DEBUG
12758 static struct snd_kcontrol_new alc268_test_mixer[] = {
12759 /* Volume widgets */
12760 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12761 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12762 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12763 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12764 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12765 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12766 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12767 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12768 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12769 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12770 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12771 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12772 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12773 /* The below appears problematic on some hardwares */
12774 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12775 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12776 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12777 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12778 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12780 /* Modes for retasking pin widgets */
12781 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12782 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12783 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12784 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12786 /* Controls for GPIO pins, assuming they are configured as outputs */
12787 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12788 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12789 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12790 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12792 /* Switches to allow the digital SPDIF output pin to be enabled.
12793 * The ALC268 does not have an SPDIF input.
12795 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12797 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12798 * this output to turn on an external amplifier.
12800 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12801 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12807 /* create input playback/capture controls for the given pin */
12808 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12809 const char *ctlname, int idx)
12825 if (spec->multiout.dac_nids[0] != dac &&
12826 spec->multiout.dac_nids[1] != dac) {
12827 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12828 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12832 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12836 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12837 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12839 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12840 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12846 /* add playback controls from the parsed DAC table */
12847 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12848 const struct auto_pin_cfg *cfg)
12853 spec->multiout.dac_nids = spec->private_dac_nids;
12855 nid = cfg->line_out_pins[0];
12858 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12862 err = alc268_new_analog_output(spec, nid, name, 0);
12867 nid = cfg->speaker_pins[0];
12869 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12870 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12874 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12878 nid = cfg->hp_pins[0];
12880 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12885 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12887 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12888 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12895 /* create playback/capture controls for input pins */
12896 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12897 const struct auto_pin_cfg *cfg)
12899 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12902 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12903 hda_nid_t nid, int pin_type)
12907 alc_set_pin_output(codec, nid, pin_type);
12908 if (nid == 0x14 || nid == 0x16)
12912 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12915 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12917 struct alc_spec *spec = codec->spec;
12918 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12920 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12921 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12925 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12927 struct alc_spec *spec = codec->spec;
12930 pin = spec->autocfg.hp_pins[0];
12932 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12933 pin = spec->autocfg.speaker_pins[0];
12935 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12938 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12940 struct alc_spec *spec = codec->spec;
12941 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12942 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12943 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12944 unsigned int dac_vol1, dac_vol2;
12946 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12947 snd_hda_codec_write(codec, speaker_nid, 0,
12948 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12949 /* mute mixer inputs from 0x1d */
12950 snd_hda_codec_write(codec, 0x0f, 0,
12951 AC_VERB_SET_AMP_GAIN_MUTE,
12953 snd_hda_codec_write(codec, 0x10, 0,
12954 AC_VERB_SET_AMP_GAIN_MUTE,
12957 /* unmute mixer inputs from 0x1d */
12958 snd_hda_codec_write(codec, 0x0f, 0,
12959 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12960 snd_hda_codec_write(codec, 0x10, 0,
12961 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12964 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12965 if (line_nid == 0x14)
12966 dac_vol2 = AMP_OUT_ZERO;
12967 else if (line_nid == 0x15)
12968 dac_vol1 = AMP_OUT_ZERO;
12969 if (hp_nid == 0x14)
12970 dac_vol2 = AMP_OUT_ZERO;
12971 else if (hp_nid == 0x15)
12972 dac_vol1 = AMP_OUT_ZERO;
12973 if (line_nid != 0x16 || hp_nid != 0x16 ||
12974 spec->autocfg.line_out_pins[1] != 0x16 ||
12975 spec->autocfg.line_out_pins[2] != 0x16)
12976 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12978 snd_hda_codec_write(codec, 0x02, 0,
12979 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12980 snd_hda_codec_write(codec, 0x03, 0,
12981 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12984 /* pcm configuration: identical with ALC880 */
12985 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12986 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12987 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12988 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12991 * BIOS auto configuration
12993 static int alc268_parse_auto_config(struct hda_codec *codec)
12995 struct alc_spec *spec = codec->spec;
12997 static hda_nid_t alc268_ignore[] = { 0 };
12999 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13003 if (!spec->autocfg.line_outs) {
13004 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13005 spec->multiout.max_channels = 2;
13006 spec->no_analog = 1;
13009 return 0; /* can't find valid BIOS pin config */
13011 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13014 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13018 spec->multiout.max_channels = 2;
13021 /* digital only support output */
13022 if (spec->autocfg.dig_outs) {
13023 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13024 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13026 if (spec->kctls.list)
13027 add_mixer(spec, spec->kctls.list);
13029 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13030 add_mixer(spec, alc268_beep_mixer);
13032 add_verb(spec, alc268_volume_init_verbs);
13033 spec->num_mux_defs = 2;
13034 spec->input_mux = &spec->private_imux[0];
13036 err = alc_auto_add_mic_boost(codec);
13040 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13045 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13047 /* init callback for auto-configuration model -- overriding the default init */
13048 static void alc268_auto_init(struct hda_codec *codec)
13050 struct alc_spec *spec = codec->spec;
13051 alc268_auto_init_multi_out(codec);
13052 alc268_auto_init_hp_out(codec);
13053 alc268_auto_init_mono_speaker_out(codec);
13054 alc268_auto_init_analog_input(codec);
13055 if (spec->unsol_event)
13056 alc_inithook(codec);
13060 * configuration and preset
13062 static const char *alc268_models[ALC268_MODEL_LAST] = {
13063 [ALC267_QUANTA_IL1] = "quanta-il1",
13064 [ALC268_3ST] = "3stack",
13065 [ALC268_TOSHIBA] = "toshiba",
13066 [ALC268_ACER] = "acer",
13067 [ALC268_ACER_DMIC] = "acer-dmic",
13068 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13069 [ALC268_DELL] = "dell",
13070 [ALC268_ZEPTO] = "zepto",
13071 #ifdef CONFIG_SND_DEBUG
13072 [ALC268_TEST] = "test",
13074 [ALC268_AUTO] = "auto",
13077 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13078 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13079 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13080 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13081 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13082 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13083 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13084 ALC268_ACER_ASPIRE_ONE),
13085 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13086 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13087 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13088 /* almost compatible with toshiba but with optional digital outs;
13089 * auto-probing seems working fine
13091 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13093 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13094 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13095 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13096 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13097 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13098 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13102 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13103 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13104 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13105 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13106 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13111 static struct alc_config_preset alc268_presets[] = {
13112 [ALC267_QUANTA_IL1] = {
13113 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13114 alc268_capture_nosrc_mixer },
13115 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13116 alc267_quanta_il1_verbs },
13117 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13118 .dac_nids = alc268_dac_nids,
13119 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13120 .adc_nids = alc268_adc_nids_alt,
13122 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13123 .channel_mode = alc268_modes,
13124 .unsol_event = alc_sku_unsol_event,
13125 .setup = alc267_quanta_il1_setup,
13126 .init_hook = alc_inithook,
13129 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13130 alc268_beep_mixer },
13131 .init_verbs = { alc268_base_init_verbs },
13132 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13133 .dac_nids = alc268_dac_nids,
13134 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13135 .adc_nids = alc268_adc_nids_alt,
13136 .capsrc_nids = alc268_capsrc_nids,
13138 .dig_out_nid = ALC268_DIGOUT_NID,
13139 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13140 .channel_mode = alc268_modes,
13141 .input_mux = &alc268_capture_source,
13143 [ALC268_TOSHIBA] = {
13144 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13145 alc268_beep_mixer },
13146 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13147 alc268_toshiba_verbs },
13148 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13149 .dac_nids = alc268_dac_nids,
13150 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13151 .adc_nids = alc268_adc_nids_alt,
13152 .capsrc_nids = alc268_capsrc_nids,
13154 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13155 .channel_mode = alc268_modes,
13156 .input_mux = &alc268_capture_source,
13157 .unsol_event = alc268_toshiba_unsol_event,
13158 .setup = alc268_toshiba_setup,
13159 .init_hook = alc268_toshiba_automute,
13162 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13163 alc268_beep_mixer },
13164 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13165 alc268_acer_verbs },
13166 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13167 .dac_nids = alc268_dac_nids,
13168 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13169 .adc_nids = alc268_adc_nids_alt,
13170 .capsrc_nids = alc268_capsrc_nids,
13172 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13173 .channel_mode = alc268_modes,
13174 .input_mux = &alc268_acer_capture_source,
13175 .unsol_event = alc268_acer_unsol_event,
13176 .init_hook = alc268_acer_init_hook,
13178 [ALC268_ACER_DMIC] = {
13179 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13180 alc268_beep_mixer },
13181 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13182 alc268_acer_verbs },
13183 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13184 .dac_nids = alc268_dac_nids,
13185 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13186 .adc_nids = alc268_adc_nids_alt,
13187 .capsrc_nids = alc268_capsrc_nids,
13189 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13190 .channel_mode = alc268_modes,
13191 .input_mux = &alc268_acer_dmic_capture_source,
13192 .unsol_event = alc268_acer_unsol_event,
13193 .init_hook = alc268_acer_init_hook,
13195 [ALC268_ACER_ASPIRE_ONE] = {
13196 .mixers = { alc268_acer_aspire_one_mixer,
13198 alc268_capture_nosrc_mixer },
13199 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13200 alc268_acer_aspire_one_verbs },
13201 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13202 .dac_nids = alc268_dac_nids,
13203 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13204 .adc_nids = alc268_adc_nids_alt,
13205 .capsrc_nids = alc268_capsrc_nids,
13207 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13208 .channel_mode = alc268_modes,
13209 .unsol_event = alc268_acer_lc_unsol_event,
13210 .setup = alc268_acer_lc_setup,
13211 .init_hook = alc268_acer_lc_init_hook,
13214 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13215 alc268_capture_nosrc_mixer },
13216 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13217 alc268_dell_verbs },
13218 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13219 .dac_nids = alc268_dac_nids,
13220 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13221 .adc_nids = alc268_adc_nids_alt,
13222 .capsrc_nids = alc268_capsrc_nids,
13224 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13225 .channel_mode = alc268_modes,
13226 .unsol_event = alc_sku_unsol_event,
13227 .setup = alc268_dell_setup,
13228 .init_hook = alc_inithook,
13231 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13232 alc268_beep_mixer },
13233 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13234 alc268_toshiba_verbs },
13235 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13236 .dac_nids = alc268_dac_nids,
13237 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13238 .adc_nids = alc268_adc_nids_alt,
13239 .capsrc_nids = alc268_capsrc_nids,
13241 .dig_out_nid = ALC268_DIGOUT_NID,
13242 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13243 .channel_mode = alc268_modes,
13244 .input_mux = &alc268_capture_source,
13245 .setup = alc268_toshiba_setup,
13246 .init_hook = alc268_toshiba_automute,
13248 #ifdef CONFIG_SND_DEBUG
13250 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13251 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13252 alc268_volume_init_verbs },
13253 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13254 .dac_nids = alc268_dac_nids,
13255 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13256 .adc_nids = alc268_adc_nids_alt,
13257 .capsrc_nids = alc268_capsrc_nids,
13259 .dig_out_nid = ALC268_DIGOUT_NID,
13260 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13261 .channel_mode = alc268_modes,
13262 .input_mux = &alc268_capture_source,
13267 static int patch_alc268(struct hda_codec *codec)
13269 struct alc_spec *spec;
13271 int i, has_beep, err;
13273 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13277 codec->spec = spec;
13279 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13283 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13284 board_config = snd_hda_check_board_codec_sid_config(codec,
13285 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13287 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13288 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13290 board_config = ALC268_AUTO;
13293 if (board_config == ALC268_AUTO) {
13294 /* automatic parse from the BIOS config */
13295 err = alc268_parse_auto_config(codec);
13301 "hda_codec: Cannot set up configuration "
13302 "from BIOS. Using base mode...\n");
13303 board_config = ALC268_3ST;
13307 if (board_config != ALC268_AUTO)
13308 setup_preset(codec, &alc268_presets[board_config]);
13310 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13311 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13312 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13314 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13317 for (i = 0; i < spec->num_mixers; i++) {
13318 if (spec->mixers[i] == alc268_beep_mixer) {
13325 err = snd_hda_attach_beep_device(codec, 0x1);
13330 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13331 /* override the amp caps for beep generator */
13332 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13333 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13334 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13335 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13336 (0 << AC_AMPCAP_MUTE_SHIFT));
13339 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13340 /* check whether NID 0x07 is valid */
13341 unsigned int wcap = get_wcaps(codec, 0x07);
13344 spec->capsrc_nids = alc268_capsrc_nids;
13346 wcap = get_wcaps_type(wcap);
13347 if (spec->auto_mic ||
13348 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13349 spec->adc_nids = alc268_adc_nids_alt;
13350 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13351 if (spec->auto_mic)
13352 fixup_automic_adc(codec);
13353 if (spec->auto_mic || spec->input_mux->num_items == 1)
13354 add_mixer(spec, alc268_capture_nosrc_mixer);
13356 add_mixer(spec, alc268_capture_alt_mixer);
13358 spec->adc_nids = alc268_adc_nids;
13359 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13360 add_mixer(spec, alc268_capture_mixer);
13362 /* set default input source */
13363 for (i = 0; i < spec->num_adc_nids; i++)
13364 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13365 0, AC_VERB_SET_CONNECT_SEL,
13366 i < spec->num_mux_defs ?
13367 spec->input_mux[i].items[0].index :
13368 spec->input_mux->items[0].index);
13371 spec->vmaster_nid = 0x02;
13373 codec->patch_ops = alc_patch_ops;
13374 if (board_config == ALC268_AUTO)
13375 spec->init_hook = alc268_auto_init;
13381 * ALC269 channel source setting (2 channel)
13383 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13385 #define alc269_dac_nids alc260_dac_nids
13387 static hda_nid_t alc269_adc_nids[1] = {
13392 static hda_nid_t alc269_capsrc_nids[1] = {
13396 static hda_nid_t alc269vb_adc_nids[1] = {
13401 static hda_nid_t alc269vb_capsrc_nids[1] = {
13405 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13409 #define alc269_modes alc260_modes
13410 #define alc269_capture_source alc880_lg_lw_capture_source
13412 static struct snd_kcontrol_new alc269_base_mixer[] = {
13413 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13414 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13415 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13416 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13418 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13419 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13420 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13421 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13422 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13424 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13428 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13429 /* output mixer control */
13430 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13432 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13433 .name = "Master Playback Switch",
13434 .subdevice = HDA_SUBDEV_AMP_FLAG,
13435 .info = snd_hda_mixer_amp_switch_info,
13436 .get = snd_hda_mixer_amp_switch_get,
13437 .put = alc268_acer_master_sw_put,
13438 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13442 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13443 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13444 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13445 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13449 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13450 /* output mixer control */
13451 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13453 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13454 .name = "Master Playback Switch",
13455 .subdevice = HDA_SUBDEV_AMP_FLAG,
13456 .info = snd_hda_mixer_amp_switch_info,
13457 .get = snd_hda_mixer_amp_switch_get,
13458 .put = alc268_acer_master_sw_put,
13459 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13463 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13464 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13465 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13466 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13467 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13468 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13469 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13473 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13474 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13475 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13476 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13477 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13481 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13482 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13483 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13484 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13485 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13489 /* capture mixer elements */
13490 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13491 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13492 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13493 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13494 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13498 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13499 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13500 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13501 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13505 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13506 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13507 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13508 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13509 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13513 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13514 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13515 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13516 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13521 #define alc269_fujitsu_mixer alc269_laptop_mixer
13523 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13524 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13525 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13527 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13528 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13529 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13533 static struct hda_verb alc269_lifebook_verbs[] = {
13534 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13535 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13536 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13537 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13538 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13539 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13540 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13541 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13542 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13543 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13547 /* toggle speaker-output according to the hp-jack state */
13548 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13550 unsigned int present;
13551 unsigned char bits;
13553 present = snd_hda_jack_detect(codec, 0x15);
13554 bits = present ? AMP_IN_MUTE(0) : 0;
13555 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13556 AMP_IN_MUTE(0), bits);
13557 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13558 AMP_IN_MUTE(0), bits);
13560 snd_hda_codec_write(codec, 0x20, 0,
13561 AC_VERB_SET_COEF_INDEX, 0x0c);
13562 snd_hda_codec_write(codec, 0x20, 0,
13563 AC_VERB_SET_PROC_COEF, 0x680);
13565 snd_hda_codec_write(codec, 0x20, 0,
13566 AC_VERB_SET_COEF_INDEX, 0x0c);
13567 snd_hda_codec_write(codec, 0x20, 0,
13568 AC_VERB_SET_PROC_COEF, 0x480);
13571 /* toggle speaker-output according to the hp-jacks state */
13572 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13574 unsigned int present;
13575 unsigned char bits;
13577 /* Check laptop headphone socket */
13578 present = snd_hda_jack_detect(codec, 0x15);
13580 /* Check port replicator headphone socket */
13581 present |= snd_hda_jack_detect(codec, 0x1a);
13583 bits = present ? AMP_IN_MUTE(0) : 0;
13584 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13585 AMP_IN_MUTE(0), bits);
13586 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13587 AMP_IN_MUTE(0), bits);
13589 snd_hda_codec_write(codec, 0x20, 0,
13590 AC_VERB_SET_COEF_INDEX, 0x0c);
13591 snd_hda_codec_write(codec, 0x20, 0,
13592 AC_VERB_SET_PROC_COEF, 0x680);
13594 snd_hda_codec_write(codec, 0x20, 0,
13595 AC_VERB_SET_COEF_INDEX, 0x0c);
13596 snd_hda_codec_write(codec, 0x20, 0,
13597 AC_VERB_SET_PROC_COEF, 0x480);
13600 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13602 unsigned int present_laptop;
13603 unsigned int present_dock;
13605 present_laptop = snd_hda_jack_detect(codec, 0x18);
13606 present_dock = snd_hda_jack_detect(codec, 0x1b);
13608 /* Laptop mic port overrides dock mic port, design decision */
13610 snd_hda_codec_write(codec, 0x23, 0,
13611 AC_VERB_SET_CONNECT_SEL, 0x3);
13612 if (present_laptop)
13613 snd_hda_codec_write(codec, 0x23, 0,
13614 AC_VERB_SET_CONNECT_SEL, 0x0);
13615 if (!present_dock && !present_laptop)
13616 snd_hda_codec_write(codec, 0x23, 0,
13617 AC_VERB_SET_CONNECT_SEL, 0x1);
13620 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13623 switch (res >> 26) {
13624 case ALC880_HP_EVENT:
13625 alc269_quanta_fl1_speaker_automute(codec);
13627 case ALC880_MIC_EVENT:
13628 alc_mic_automute(codec);
13633 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13636 if ((res >> 26) == ALC880_HP_EVENT)
13637 alc269_lifebook_speaker_automute(codec);
13638 if ((res >> 26) == ALC880_MIC_EVENT)
13639 alc269_lifebook_mic_autoswitch(codec);
13642 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13644 struct alc_spec *spec = codec->spec;
13645 spec->autocfg.hp_pins[0] = 0x15;
13646 spec->autocfg.speaker_pins[0] = 0x14;
13647 spec->ext_mic.pin = 0x18;
13648 spec->ext_mic.mux_idx = 0;
13649 spec->int_mic.pin = 0x19;
13650 spec->int_mic.mux_idx = 1;
13651 spec->auto_mic = 1;
13654 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13656 alc269_quanta_fl1_speaker_automute(codec);
13657 alc_mic_automute(codec);
13660 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13662 alc269_lifebook_speaker_automute(codec);
13663 alc269_lifebook_mic_autoswitch(codec);
13666 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13668 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13669 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13670 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13671 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13672 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13673 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13677 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13678 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13679 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13680 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13682 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13683 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13687 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13688 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13689 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13690 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13691 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13692 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13693 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13694 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13698 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13699 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13700 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13701 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13703 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13704 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13705 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13709 /* toggle speaker-output according to the hp-jack state */
13710 static void alc269_speaker_automute(struct hda_codec *codec)
13712 struct alc_spec *spec = codec->spec;
13713 unsigned int nid = spec->autocfg.hp_pins[0];
13714 unsigned int present;
13715 unsigned char bits;
13717 present = snd_hda_jack_detect(codec, nid);
13718 bits = present ? AMP_IN_MUTE(0) : 0;
13719 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13720 AMP_IN_MUTE(0), bits);
13721 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13722 AMP_IN_MUTE(0), bits);
13725 /* unsolicited event for HP jack sensing */
13726 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13729 switch (res >> 26) {
13730 case ALC880_HP_EVENT:
13731 alc269_speaker_automute(codec);
13733 case ALC880_MIC_EVENT:
13734 alc_mic_automute(codec);
13739 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13741 struct alc_spec *spec = codec->spec;
13742 spec->autocfg.hp_pins[0] = 0x15;
13743 spec->autocfg.speaker_pins[0] = 0x14;
13744 spec->ext_mic.pin = 0x18;
13745 spec->ext_mic.mux_idx = 0;
13746 spec->int_mic.pin = 0x12;
13747 spec->int_mic.mux_idx = 5;
13748 spec->auto_mic = 1;
13751 static void alc269vb_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 = 6;
13760 spec->auto_mic = 1;
13763 static void alc269_laptop_amic_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 = 0x19;
13771 spec->int_mic.mux_idx = 1;
13772 spec->auto_mic = 1;
13775 static void alc269_laptop_inithook(struct hda_codec *codec)
13777 alc269_speaker_automute(codec);
13778 alc_mic_automute(codec);
13782 * generic initialization of ADC, input mixers and output mixers
13784 static struct hda_verb alc269_init_verbs[] = {
13786 * Unmute ADC0 and set the default input to mic-in
13788 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13791 * Set up output mixers (0x02 - 0x03)
13793 /* set vol=0 to output mixers */
13794 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13795 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13797 /* set up input amps for analog loopback */
13798 /* Amp Indices: DAC = 0, mixer = 1 */
13799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13801 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13803 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13804 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13808 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13809 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13810 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13811 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13812 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13814 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13815 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13817 /* FIXME: use Mux-type input source selection */
13818 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13819 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13820 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13823 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13827 static struct hda_verb alc269vb_init_verbs[] = {
13829 * Unmute ADC0 and set the default input to mic-in
13831 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13834 * Set up output mixers (0x02 - 0x03)
13836 /* set vol=0 to output mixers */
13837 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13838 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13840 /* set up input amps for analog loopback */
13841 /* Amp Indices: DAC = 0, mixer = 1 */
13842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13845 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13846 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13847 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13850 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13851 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13853 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13854 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13855 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13857 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13858 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13860 /* FIXME: use Mux-type input source selection */
13861 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13862 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13863 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13866 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13870 #define alc269_auto_create_multi_out_ctls \
13871 alc268_auto_create_multi_out_ctls
13872 #define alc269_auto_create_input_ctls \
13873 alc268_auto_create_input_ctls
13875 #ifdef CONFIG_SND_HDA_POWER_SAVE
13876 #define alc269_loopbacks alc880_loopbacks
13879 /* pcm configuration: identical with ALC880 */
13880 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13881 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13882 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13883 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13885 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13889 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13890 /* NID is set in alc_build_pcms */
13892 .open = alc880_playback_pcm_open,
13893 .prepare = alc880_playback_pcm_prepare,
13894 .cleanup = alc880_playback_pcm_cleanup
13898 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13902 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13903 /* NID is set in alc_build_pcms */
13907 * BIOS auto configuration
13909 static int alc269_parse_auto_config(struct hda_codec *codec)
13911 struct alc_spec *spec = codec->spec;
13913 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13914 hda_nid_t real_capsrc_nids;
13916 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13921 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13924 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13928 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13930 if (spec->autocfg.dig_outs)
13931 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13933 if (spec->kctls.list)
13934 add_mixer(spec, spec->kctls.list);
13936 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
13937 add_verb(spec, alc269vb_init_verbs);
13938 real_capsrc_nids = alc269vb_capsrc_nids[0];
13939 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
13941 add_verb(spec, alc269_init_verbs);
13942 real_capsrc_nids = alc269_capsrc_nids[0];
13943 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13946 spec->num_mux_defs = 1;
13947 spec->input_mux = &spec->private_imux[0];
13948 /* set default input source */
13949 snd_hda_codec_write_cache(codec, real_capsrc_nids,
13950 0, AC_VERB_SET_CONNECT_SEL,
13951 spec->input_mux->items[0].index);
13953 err = alc_auto_add_mic_boost(codec);
13957 if (!spec->cap_mixer && !spec->no_analog)
13958 set_capture_mixer(codec);
13963 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13964 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13965 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13968 /* init callback for auto-configuration model -- overriding the default init */
13969 static void alc269_auto_init(struct hda_codec *codec)
13971 struct alc_spec *spec = codec->spec;
13972 alc269_auto_init_multi_out(codec);
13973 alc269_auto_init_hp_out(codec);
13974 alc269_auto_init_analog_input(codec);
13975 if (spec->unsol_event)
13976 alc_inithook(codec);
13980 * configuration and preset
13982 static const char *alc269_models[ALC269_MODEL_LAST] = {
13983 [ALC269_BASIC] = "basic",
13984 [ALC269_QUANTA_FL1] = "quanta",
13985 [ALC269_AMIC] = "laptop-amic",
13986 [ALC269_DMIC] = "laptop-dmic",
13987 [ALC269_FUJITSU] = "fujitsu",
13988 [ALC269_LIFEBOOK] = "lifebook",
13989 [ALC269_AUTO] = "auto",
13992 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13993 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13994 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13996 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
13997 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
13998 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
13999 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14000 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14001 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14002 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14003 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14004 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14005 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14006 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14007 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14008 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14009 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14010 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14011 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14012 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14013 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14014 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14015 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14016 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14017 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14018 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14019 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14020 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14021 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14022 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14023 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14024 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14025 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14026 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14027 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14028 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14029 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14030 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14031 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14032 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14034 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14036 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14037 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14038 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
14039 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14040 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14041 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14042 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14043 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14044 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14045 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14049 static struct alc_config_preset alc269_presets[] = {
14051 .mixers = { alc269_base_mixer },
14052 .init_verbs = { alc269_init_verbs },
14053 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14054 .dac_nids = alc269_dac_nids,
14056 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14057 .channel_mode = alc269_modes,
14058 .input_mux = &alc269_capture_source,
14060 [ALC269_QUANTA_FL1] = {
14061 .mixers = { alc269_quanta_fl1_mixer },
14062 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14063 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14064 .dac_nids = alc269_dac_nids,
14066 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14067 .channel_mode = alc269_modes,
14068 .input_mux = &alc269_capture_source,
14069 .unsol_event = alc269_quanta_fl1_unsol_event,
14070 .setup = alc269_quanta_fl1_setup,
14071 .init_hook = alc269_quanta_fl1_init_hook,
14074 .mixers = { alc269_laptop_mixer },
14075 .cap_mixer = alc269_laptop_analog_capture_mixer,
14076 .init_verbs = { alc269_init_verbs,
14077 alc269_laptop_amic_init_verbs },
14078 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14079 .dac_nids = alc269_dac_nids,
14081 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14082 .channel_mode = alc269_modes,
14083 .unsol_event = alc269_laptop_unsol_event,
14084 .setup = alc269_laptop_amic_setup,
14085 .init_hook = alc269_laptop_inithook,
14088 .mixers = { alc269_laptop_mixer },
14089 .cap_mixer = alc269_laptop_digital_capture_mixer,
14090 .init_verbs = { alc269_init_verbs,
14091 alc269_laptop_dmic_init_verbs },
14092 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14093 .dac_nids = alc269_dac_nids,
14095 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14096 .channel_mode = alc269_modes,
14097 .unsol_event = alc269_laptop_unsol_event,
14098 .setup = alc269_laptop_dmic_setup,
14099 .init_hook = alc269_laptop_inithook,
14101 [ALC269VB_AMIC] = {
14102 .mixers = { alc269vb_laptop_mixer },
14103 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14104 .init_verbs = { alc269vb_init_verbs,
14105 alc269vb_laptop_amic_init_verbs },
14106 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14107 .dac_nids = alc269_dac_nids,
14109 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14110 .channel_mode = alc269_modes,
14111 .unsol_event = alc269_laptop_unsol_event,
14112 .setup = alc269_laptop_amic_setup,
14113 .init_hook = alc269_laptop_inithook,
14115 [ALC269VB_DMIC] = {
14116 .mixers = { alc269vb_laptop_mixer },
14117 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14118 .init_verbs = { alc269vb_init_verbs,
14119 alc269vb_laptop_dmic_init_verbs },
14120 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14121 .dac_nids = alc269_dac_nids,
14123 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14124 .channel_mode = alc269_modes,
14125 .unsol_event = alc269_laptop_unsol_event,
14126 .setup = alc269vb_laptop_dmic_setup,
14127 .init_hook = alc269_laptop_inithook,
14129 [ALC269_FUJITSU] = {
14130 .mixers = { alc269_fujitsu_mixer },
14131 .cap_mixer = alc269_laptop_digital_capture_mixer,
14132 .init_verbs = { alc269_init_verbs,
14133 alc269_laptop_dmic_init_verbs },
14134 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14135 .dac_nids = alc269_dac_nids,
14137 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14138 .channel_mode = alc269_modes,
14139 .unsol_event = alc269_laptop_unsol_event,
14140 .setup = alc269_laptop_dmic_setup,
14141 .init_hook = alc269_laptop_inithook,
14143 [ALC269_LIFEBOOK] = {
14144 .mixers = { alc269_lifebook_mixer },
14145 .init_verbs = { alc269_init_verbs, alc269_lifebook_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 .input_mux = &alc269_capture_source,
14152 .unsol_event = alc269_lifebook_unsol_event,
14153 .init_hook = alc269_lifebook_init_hook,
14157 static int patch_alc269(struct hda_codec *codec)
14159 struct alc_spec *spec;
14162 int is_alc269vb = 0;
14164 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14168 codec->spec = spec;
14170 alc_auto_parse_customize_define(codec);
14172 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14174 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14175 kfree(codec->chip_name);
14176 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
14177 if (!codec->chip_name) {
14184 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14188 if (board_config < 0) {
14189 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14191 board_config = ALC269_AUTO;
14194 if (board_config == ALC269_AUTO) {
14195 /* automatic parse from the BIOS config */
14196 err = alc269_parse_auto_config(codec);
14202 "hda_codec: Cannot set up configuration "
14203 "from BIOS. Using base mode...\n");
14204 board_config = ALC269_BASIC;
14208 err = snd_hda_attach_beep_device(codec, 0x1);
14214 if (board_config != ALC269_AUTO)
14215 setup_preset(codec, &alc269_presets[board_config]);
14217 if (board_config == ALC269_QUANTA_FL1) {
14218 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14219 * fix the sample rate of analog I/O to 44.1kHz
14221 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14222 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14224 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14225 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14227 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14228 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14230 if (!is_alc269vb) {
14231 spec->adc_nids = alc269_adc_nids;
14232 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14233 spec->capsrc_nids = alc269_capsrc_nids;
14235 spec->adc_nids = alc269vb_adc_nids;
14236 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14237 spec->capsrc_nids = alc269vb_capsrc_nids;
14240 if (!spec->cap_mixer)
14241 set_capture_mixer(codec);
14242 if (spec->cdefine.enable_pcbeep)
14243 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14245 spec->vmaster_nid = 0x02;
14247 codec->patch_ops = alc_patch_ops;
14248 if (board_config == ALC269_AUTO)
14249 spec->init_hook = alc269_auto_init;
14250 #ifdef CONFIG_SND_HDA_POWER_SAVE
14251 if (!spec->loopback.amplist)
14252 spec->loopback.amplist = alc269_loopbacks;
14259 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14263 * set the path ways for 2 channel output
14264 * need to set the codec line out and mic 1 pin widgets to inputs
14266 static struct hda_verb alc861_threestack_ch2_init[] = {
14267 /* set pin widget 1Ah (line in) for input */
14268 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14269 /* set pin widget 18h (mic1/2) for input, for mic also enable
14272 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14274 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14276 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14277 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14283 * need to set the codec line out and mic 1 pin widgets to outputs
14285 static struct hda_verb alc861_threestack_ch6_init[] = {
14286 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14287 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14288 /* set pin widget 18h (mic1) for output (CLFE)*/
14289 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14291 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14292 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14294 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14296 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14297 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14302 static struct hda_channel_mode alc861_threestack_modes[2] = {
14303 { 2, alc861_threestack_ch2_init },
14304 { 6, alc861_threestack_ch6_init },
14306 /* Set mic1 as input and unmute the mixer */
14307 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14308 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14309 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14312 /* Set mic1 as output and mute mixer */
14313 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14314 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14315 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14319 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14320 { 2, alc861_uniwill_m31_ch2_init },
14321 { 4, alc861_uniwill_m31_ch4_init },
14324 /* Set mic1 and line-in as input and unmute the mixer */
14325 static struct hda_verb alc861_asus_ch2_init[] = {
14326 /* set pin widget 1Ah (line in) for input */
14327 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14328 /* set pin widget 18h (mic1/2) for input, for mic also enable
14331 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14333 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14335 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14336 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14340 /* Set mic1 nad line-in as output and mute mixer */
14341 static struct hda_verb alc861_asus_ch6_init[] = {
14342 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14343 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14344 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14345 /* set pin widget 18h (mic1) for output (CLFE)*/
14346 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14347 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14348 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14349 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14351 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14353 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14354 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14359 static struct hda_channel_mode alc861_asus_modes[2] = {
14360 { 2, alc861_asus_ch2_init },
14361 { 6, alc861_asus_ch6_init },
14366 static struct snd_kcontrol_new alc861_base_mixer[] = {
14367 /* output mixer control */
14368 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14369 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14370 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14371 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14372 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14374 /*Input mixer control */
14375 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14376 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14377 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14378 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14379 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14380 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14382 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14389 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14390 /* output mixer control */
14391 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14392 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14393 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14394 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14395 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14397 /* Input mixer control */
14398 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14399 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14400 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14401 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14402 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14403 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14405 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14406 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14407 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14410 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14411 .name = "Channel Mode",
14412 .info = alc_ch_mode_info,
14413 .get = alc_ch_mode_get,
14414 .put = alc_ch_mode_put,
14415 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14420 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14421 /* output mixer control */
14422 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14424 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14429 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14430 /* output mixer control */
14431 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14432 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14433 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14434 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14435 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14437 /* Input mixer control */
14438 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14439 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14440 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14441 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14442 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14443 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14444 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14445 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14446 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14447 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14450 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14451 .name = "Channel Mode",
14452 .info = alc_ch_mode_info,
14453 .get = alc_ch_mode_get,
14454 .put = alc_ch_mode_put,
14455 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14460 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14461 /* output mixer control */
14462 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14463 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14464 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14465 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14466 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14468 /* Input mixer control */
14469 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14470 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14471 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14472 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14473 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14474 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14476 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14477 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14478 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14481 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14482 .name = "Channel Mode",
14483 .info = alc_ch_mode_info,
14484 .get = alc_ch_mode_get,
14485 .put = alc_ch_mode_put,
14486 .private_value = ARRAY_SIZE(alc861_asus_modes),
14491 /* additional mixer */
14492 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14493 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14494 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14499 * generic initialization of ADC, input mixers and output mixers
14501 static struct hda_verb alc861_base_init_verbs[] = {
14503 * Unmute ADC0 and set the default input to mic-in
14505 /* port-A for surround (rear panel) */
14506 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14507 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14508 /* port-B for mic-in (rear panel) with vref */
14509 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14510 /* port-C for line-in (rear panel) */
14511 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14512 /* port-D for Front */
14513 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14514 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14515 /* port-E for HP out (front panel) */
14516 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14517 /* route front PCM to HP */
14518 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14519 /* port-F for mic-in (front panel) with vref */
14520 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14521 /* port-G for CLFE (rear panel) */
14522 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14523 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14524 /* port-H for side (rear panel) */
14525 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14526 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14528 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14529 /* route front mic to ADC1*/
14530 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14531 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14533 /* Unmute DAC0~3 & spdif out*/
14534 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14535 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14536 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14537 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14538 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14540 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14541 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14542 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14543 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14544 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14546 /* Unmute Stereo Mixer 15 */
14547 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14548 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14550 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14552 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14553 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14554 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14555 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14556 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14557 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14558 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14559 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14560 /* hp used DAC 3 (Front) */
14561 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14562 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14567 static struct hda_verb alc861_threestack_init_verbs[] = {
14569 * Unmute ADC0 and set the default input to mic-in
14571 /* port-A for surround (rear panel) */
14572 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14573 /* port-B for mic-in (rear panel) with vref */
14574 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14575 /* port-C for line-in (rear panel) */
14576 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14577 /* port-D for Front */
14578 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14579 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14580 /* port-E for HP out (front panel) */
14581 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14582 /* route front PCM to HP */
14583 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14584 /* port-F for mic-in (front panel) with vref */
14585 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14586 /* port-G for CLFE (rear panel) */
14587 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14588 /* port-H for side (rear panel) */
14589 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14591 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14592 /* route front mic to ADC1*/
14593 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14595 /* Unmute DAC0~3 & spdif out*/
14596 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14597 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14598 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14599 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14602 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14603 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14604 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14605 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14606 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14608 /* Unmute Stereo Mixer 15 */
14609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14611 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14612 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14614 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14615 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14616 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14617 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14618 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14620 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14621 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14622 /* hp used DAC 3 (Front) */
14623 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14624 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14628 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14630 * Unmute ADC0 and set the default input to mic-in
14632 /* port-A for surround (rear panel) */
14633 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14634 /* port-B for mic-in (rear panel) with vref */
14635 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14636 /* port-C for line-in (rear panel) */
14637 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14638 /* port-D for Front */
14639 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14640 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14641 /* port-E for HP out (front panel) */
14642 /* this has to be set to VREF80 */
14643 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14644 /* route front PCM to HP */
14645 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14646 /* port-F for mic-in (front panel) with vref */
14647 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14648 /* port-G for CLFE (rear panel) */
14649 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14650 /* port-H for side (rear panel) */
14651 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14653 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14654 /* route front mic to ADC1*/
14655 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14656 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14657 /* Unmute DAC0~3 & spdif out*/
14658 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14659 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14660 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14661 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14662 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14664 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14665 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14666 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14667 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14668 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14670 /* Unmute Stereo Mixer 15 */
14671 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14672 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14673 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14674 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14676 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14677 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14678 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14679 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14680 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14681 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14682 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14683 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14684 /* hp used DAC 3 (Front) */
14685 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14686 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14690 static struct hda_verb alc861_asus_init_verbs[] = {
14692 * Unmute ADC0 and set the default input to mic-in
14694 /* port-A for surround (rear panel)
14695 * according to codec#0 this is the HP jack
14697 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14698 /* route front PCM to HP */
14699 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14700 /* port-B for mic-in (rear panel) with vref */
14701 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14702 /* port-C for line-in (rear panel) */
14703 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14704 /* port-D for Front */
14705 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14706 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14707 /* port-E for HP out (front panel) */
14708 /* this has to be set to VREF80 */
14709 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14710 /* route front PCM to HP */
14711 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14712 /* port-F for mic-in (front panel) with vref */
14713 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14714 /* port-G for CLFE (rear panel) */
14715 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14716 /* port-H for side (rear panel) */
14717 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14719 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14720 /* route front mic to ADC1*/
14721 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14722 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14723 /* Unmute DAC0~3 & spdif out*/
14724 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14725 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14726 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14727 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14728 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14729 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14730 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14731 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14732 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14733 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14735 /* Unmute Stereo Mixer 15 */
14736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14737 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14739 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14741 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14742 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14744 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14745 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14746 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14748 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14749 /* hp used DAC 3 (Front) */
14750 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14751 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14755 /* additional init verbs for ASUS laptops */
14756 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14757 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14758 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14763 * generic initialization of ADC, input mixers and output mixers
14765 static struct hda_verb alc861_auto_init_verbs[] = {
14767 * Unmute ADC0 and set the default input to mic-in
14769 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14770 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14772 /* Unmute DAC0~3 & spdif out*/
14773 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14774 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14775 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14776 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14779 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14780 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14781 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14782 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14783 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14785 /* Unmute Stereo Mixer 15 */
14786 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14787 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14791 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14792 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14793 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14794 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14796 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14797 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14798 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14800 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14801 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14802 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14804 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14805 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14806 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14807 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14809 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14814 static struct hda_verb alc861_toshiba_init_verbs[] = {
14815 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14820 /* toggle speaker-output according to the hp-jack state */
14821 static void alc861_toshiba_automute(struct hda_codec *codec)
14823 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14825 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14826 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14827 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14828 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14831 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14834 if ((res >> 26) == ALC880_HP_EVENT)
14835 alc861_toshiba_automute(codec);
14838 /* pcm configuration: identical with ALC880 */
14839 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14840 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14841 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14842 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14845 #define ALC861_DIGOUT_NID 0x07
14847 static struct hda_channel_mode alc861_8ch_modes[1] = {
14851 static hda_nid_t alc861_dac_nids[4] = {
14852 /* front, surround, clfe, side */
14853 0x03, 0x06, 0x05, 0x04
14856 static hda_nid_t alc660_dac_nids[3] = {
14857 /* front, clfe, surround */
14861 static hda_nid_t alc861_adc_nids[1] = {
14866 static struct hda_input_mux alc861_capture_source = {
14870 { "Front Mic", 0x3 },
14877 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14879 struct alc_spec *spec = codec->spec;
14880 hda_nid_t mix, srcs[5];
14883 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14885 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14888 for (i = 0; i < num; i++) {
14890 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14891 if (type != AC_WID_AUD_OUT)
14893 for (j = 0; j < spec->multiout.num_dacs; j++)
14894 if (spec->multiout.dac_nids[j] == srcs[i])
14896 if (j >= spec->multiout.num_dacs)
14902 /* fill in the dac_nids table from the parsed pin configuration */
14903 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14904 const struct auto_pin_cfg *cfg)
14906 struct alc_spec *spec = codec->spec;
14908 hda_nid_t nid, dac;
14910 spec->multiout.dac_nids = spec->private_dac_nids;
14911 for (i = 0; i < cfg->line_outs; i++) {
14912 nid = cfg->line_out_pins[i];
14913 dac = alc861_look_for_dac(codec, nid);
14916 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14921 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14922 hda_nid_t nid, unsigned int chs)
14924 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14925 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14928 /* add playback controls from the parsed DAC table */
14929 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14930 const struct auto_pin_cfg *cfg)
14932 struct alc_spec *spec = codec->spec;
14933 static const char *chname[4] = {
14934 "Front", "Surround", NULL /*CLFE*/, "Side"
14939 if (cfg->line_outs == 1) {
14940 const char *pfx = NULL;
14943 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14946 nid = spec->multiout.dac_nids[0];
14947 return alc861_create_out_sw(codec, pfx, nid, 3);
14951 for (i = 0; i < cfg->line_outs; i++) {
14952 nid = spec->multiout.dac_nids[i];
14957 err = alc861_create_out_sw(codec, "Center", nid, 1);
14960 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14964 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14972 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14974 struct alc_spec *spec = codec->spec;
14981 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14982 nid = alc861_look_for_dac(codec, pin);
14984 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14987 spec->multiout.hp_nid = nid;
14993 /* create playback/capture controls for input pins */
14994 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14995 const struct auto_pin_cfg *cfg)
14997 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15000 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15002 int pin_type, hda_nid_t dac)
15004 hda_nid_t mix, srcs[5];
15007 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15009 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15011 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15013 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15016 for (i = 0; i < num; i++) {
15018 if (srcs[i] == dac || srcs[i] == 0x15)
15019 mute = AMP_IN_UNMUTE(i);
15021 mute = AMP_IN_MUTE(i);
15022 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15027 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15029 struct alc_spec *spec = codec->spec;
15032 for (i = 0; i < spec->autocfg.line_outs; i++) {
15033 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15034 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15036 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15037 spec->multiout.dac_nids[i]);
15041 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15043 struct alc_spec *spec = codec->spec;
15045 if (spec->autocfg.hp_outs)
15046 alc861_auto_set_output_and_unmute(codec,
15047 spec->autocfg.hp_pins[0],
15049 spec->multiout.hp_nid);
15050 if (spec->autocfg.speaker_outs)
15051 alc861_auto_set_output_and_unmute(codec,
15052 spec->autocfg.speaker_pins[0],
15054 spec->multiout.dac_nids[0]);
15057 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15059 struct alc_spec *spec = codec->spec;
15062 for (i = 0; i < AUTO_PIN_LAST; i++) {
15063 hda_nid_t nid = spec->autocfg.input_pins[i];
15064 if (nid >= 0x0c && nid <= 0x11)
15065 alc_set_input_pin(codec, nid, i);
15069 /* parse the BIOS configuration and set up the alc_spec */
15070 /* return 1 if successful, 0 if the proper config is not found,
15071 * or a negative error code
15073 static int alc861_parse_auto_config(struct hda_codec *codec)
15075 struct alc_spec *spec = codec->spec;
15077 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15079 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15083 if (!spec->autocfg.line_outs)
15084 return 0; /* can't find valid BIOS pin config */
15086 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15089 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15092 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15095 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15099 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15101 if (spec->autocfg.dig_outs)
15102 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15104 if (spec->kctls.list)
15105 add_mixer(spec, spec->kctls.list);
15107 add_verb(spec, alc861_auto_init_verbs);
15109 spec->num_mux_defs = 1;
15110 spec->input_mux = &spec->private_imux[0];
15112 spec->adc_nids = alc861_adc_nids;
15113 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15114 set_capture_mixer(codec);
15116 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15121 /* additional initialization for auto-configuration model */
15122 static void alc861_auto_init(struct hda_codec *codec)
15124 struct alc_spec *spec = codec->spec;
15125 alc861_auto_init_multi_out(codec);
15126 alc861_auto_init_hp_out(codec);
15127 alc861_auto_init_analog_input(codec);
15128 if (spec->unsol_event)
15129 alc_inithook(codec);
15132 #ifdef CONFIG_SND_HDA_POWER_SAVE
15133 static struct hda_amp_list alc861_loopbacks[] = {
15134 { 0x15, HDA_INPUT, 0 },
15135 { 0x15, HDA_INPUT, 1 },
15136 { 0x15, HDA_INPUT, 2 },
15137 { 0x15, HDA_INPUT, 3 },
15144 * configuration and preset
15146 static const char *alc861_models[ALC861_MODEL_LAST] = {
15147 [ALC861_3ST] = "3stack",
15148 [ALC660_3ST] = "3stack-660",
15149 [ALC861_3ST_DIG] = "3stack-dig",
15150 [ALC861_6ST_DIG] = "6stack-dig",
15151 [ALC861_UNIWILL_M31] = "uniwill-m31",
15152 [ALC861_TOSHIBA] = "toshiba",
15153 [ALC861_ASUS] = "asus",
15154 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15155 [ALC861_AUTO] = "auto",
15158 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15159 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15160 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15161 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15162 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15163 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15164 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15165 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15166 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15167 * Any other models that need this preset?
15169 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15170 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15171 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15172 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15173 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15174 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15175 /* FIXME: the below seems conflict */
15176 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15177 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15178 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15182 static struct alc_config_preset alc861_presets[] = {
15184 .mixers = { alc861_3ST_mixer },
15185 .init_verbs = { alc861_threestack_init_verbs },
15186 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15187 .dac_nids = alc861_dac_nids,
15188 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15189 .channel_mode = alc861_threestack_modes,
15191 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15192 .adc_nids = alc861_adc_nids,
15193 .input_mux = &alc861_capture_source,
15195 [ALC861_3ST_DIG] = {
15196 .mixers = { alc861_base_mixer },
15197 .init_verbs = { alc861_threestack_init_verbs },
15198 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15199 .dac_nids = alc861_dac_nids,
15200 .dig_out_nid = ALC861_DIGOUT_NID,
15201 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15202 .channel_mode = alc861_threestack_modes,
15204 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15205 .adc_nids = alc861_adc_nids,
15206 .input_mux = &alc861_capture_source,
15208 [ALC861_6ST_DIG] = {
15209 .mixers = { alc861_base_mixer },
15210 .init_verbs = { alc861_base_init_verbs },
15211 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15212 .dac_nids = alc861_dac_nids,
15213 .dig_out_nid = ALC861_DIGOUT_NID,
15214 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15215 .channel_mode = alc861_8ch_modes,
15216 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15217 .adc_nids = alc861_adc_nids,
15218 .input_mux = &alc861_capture_source,
15221 .mixers = { alc861_3ST_mixer },
15222 .init_verbs = { alc861_threestack_init_verbs },
15223 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15224 .dac_nids = alc660_dac_nids,
15225 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15226 .channel_mode = alc861_threestack_modes,
15228 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15229 .adc_nids = alc861_adc_nids,
15230 .input_mux = &alc861_capture_source,
15232 [ALC861_UNIWILL_M31] = {
15233 .mixers = { alc861_uniwill_m31_mixer },
15234 .init_verbs = { alc861_uniwill_m31_init_verbs },
15235 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15236 .dac_nids = alc861_dac_nids,
15237 .dig_out_nid = ALC861_DIGOUT_NID,
15238 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15239 .channel_mode = alc861_uniwill_m31_modes,
15241 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15242 .adc_nids = alc861_adc_nids,
15243 .input_mux = &alc861_capture_source,
15245 [ALC861_TOSHIBA] = {
15246 .mixers = { alc861_toshiba_mixer },
15247 .init_verbs = { alc861_base_init_verbs,
15248 alc861_toshiba_init_verbs },
15249 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15250 .dac_nids = alc861_dac_nids,
15251 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15252 .channel_mode = alc883_3ST_2ch_modes,
15253 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15254 .adc_nids = alc861_adc_nids,
15255 .input_mux = &alc861_capture_source,
15256 .unsol_event = alc861_toshiba_unsol_event,
15257 .init_hook = alc861_toshiba_automute,
15260 .mixers = { alc861_asus_mixer },
15261 .init_verbs = { alc861_asus_init_verbs },
15262 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15263 .dac_nids = alc861_dac_nids,
15264 .dig_out_nid = ALC861_DIGOUT_NID,
15265 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15266 .channel_mode = alc861_asus_modes,
15269 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15270 .adc_nids = alc861_adc_nids,
15271 .input_mux = &alc861_capture_source,
15273 [ALC861_ASUS_LAPTOP] = {
15274 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15275 .init_verbs = { alc861_asus_init_verbs,
15276 alc861_asus_laptop_init_verbs },
15277 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15278 .dac_nids = alc861_dac_nids,
15279 .dig_out_nid = ALC861_DIGOUT_NID,
15280 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15281 .channel_mode = alc883_3ST_2ch_modes,
15283 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15284 .adc_nids = alc861_adc_nids,
15285 .input_mux = &alc861_capture_source,
15289 /* Pin config fixes */
15291 PINFIX_FSC_AMILO_PI1505,
15294 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15295 { 0x0b, 0x0221101f }, /* HP */
15296 { 0x0f, 0x90170310 }, /* speaker */
15300 static const struct alc_fixup alc861_fixups[] = {
15301 [PINFIX_FSC_AMILO_PI1505] = {
15302 .pins = alc861_fsc_amilo_pi1505_pinfix
15306 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15307 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15311 static int patch_alc861(struct hda_codec *codec)
15313 struct alc_spec *spec;
15317 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15321 codec->spec = spec;
15323 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15327 if (board_config < 0) {
15328 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15330 board_config = ALC861_AUTO;
15333 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15335 if (board_config == ALC861_AUTO) {
15336 /* automatic parse from the BIOS config */
15337 err = alc861_parse_auto_config(codec);
15343 "hda_codec: Cannot set up configuration "
15344 "from BIOS. Using base mode...\n");
15345 board_config = ALC861_3ST_DIG;
15349 err = snd_hda_attach_beep_device(codec, 0x23);
15355 if (board_config != ALC861_AUTO)
15356 setup_preset(codec, &alc861_presets[board_config]);
15358 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15359 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15361 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15362 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15364 if (!spec->cap_mixer)
15365 set_capture_mixer(codec);
15366 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15368 spec->vmaster_nid = 0x03;
15370 codec->patch_ops = alc_patch_ops;
15371 if (board_config == ALC861_AUTO) {
15372 spec->init_hook = alc861_auto_init;
15373 #ifdef CONFIG_SND_HDA_POWER_SAVE
15374 spec->power_hook = alc_power_eapd;
15377 #ifdef CONFIG_SND_HDA_POWER_SAVE
15378 if (!spec->loopback.amplist)
15379 spec->loopback.amplist = alc861_loopbacks;
15386 * ALC861-VD support
15390 * In addition, an independent DAC
15392 #define ALC861VD_DIGOUT_NID 0x06
15394 static hda_nid_t alc861vd_dac_nids[4] = {
15395 /* front, surr, clfe, side surr */
15396 0x02, 0x03, 0x04, 0x05
15399 /* dac_nids for ALC660vd are in a different order - according to
15400 * Realtek's driver.
15401 * This should probably result in a different mixer for 6stack models
15402 * of ALC660vd codecs, but for now there is only 3stack mixer
15403 * - and it is the same as in 861vd.
15404 * adc_nids in ALC660vd are (is) the same as in 861vd
15406 static hda_nid_t alc660vd_dac_nids[3] = {
15407 /* front, rear, clfe, rear_surr */
15411 static hda_nid_t alc861vd_adc_nids[1] = {
15416 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15419 /* FIXME: should be a matrix-type input source selection */
15420 static struct hda_input_mux alc861vd_capture_source = {
15424 { "Front Mic", 0x1 },
15430 static struct hda_input_mux alc861vd_dallas_capture_source = {
15433 { "Ext Mic", 0x0 },
15434 { "Int Mic", 0x1 },
15438 static struct hda_input_mux alc861vd_hp_capture_source = {
15441 { "Front Mic", 0x0 },
15442 { "ATAPI Mic", 0x1 },
15449 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15456 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15457 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15458 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15459 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15460 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15467 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15468 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15469 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15470 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15471 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15475 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15476 { 6, alc861vd_6stack_ch6_init },
15477 { 8, alc861vd_6stack_ch8_init },
15480 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15482 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15483 .name = "Channel Mode",
15484 .info = alc_ch_mode_info,
15485 .get = alc_ch_mode_get,
15486 .put = alc_ch_mode_put,
15491 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15492 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15494 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15495 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15496 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15498 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15499 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15501 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15503 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15505 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15506 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15508 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15509 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15511 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15513 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15517 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15518 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15519 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15521 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15522 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15524 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15525 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15530 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15531 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15532 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15536 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15540 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15541 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15542 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15544 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15545 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15547 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15548 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15553 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15554 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15555 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15556 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15560 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15562 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15564 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15565 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15566 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15568 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15569 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15574 /* Pin assignment: Speaker=0x14, HP = 0x15,
15575 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15577 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15578 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15579 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15580 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15581 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15582 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15583 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15584 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15585 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15586 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15587 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15591 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15592 * Front Mic=0x18, ATAPI Mic = 0x19,
15594 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15595 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15596 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15597 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15598 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15599 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15600 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15601 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15602 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15608 * generic initialization of ADC, input mixers and output mixers
15610 static struct hda_verb alc861vd_volume_init_verbs[] = {
15612 * Unmute ADC0 and set the default input to mic-in
15614 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15615 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15617 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15618 * the analog-loopback mixer widget
15620 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15621 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15622 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15627 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15628 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15629 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15630 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15631 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15634 * Set up output mixers (0x02 - 0x05)
15636 /* set vol=0 to output mixers */
15637 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15638 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15639 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15640 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15642 /* set up input amps for analog loopback */
15643 /* Amp Indices: DAC = 0, mixer = 1 */
15644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15649 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15650 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15651 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15657 * 3-stack pin configuration:
15658 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15660 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15662 * Set pin mode and muting
15664 /* set front pin widgets 0x14 for output */
15665 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15666 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15667 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15669 /* Mic (rear) pin: input vref at 80% */
15670 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15671 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15672 /* Front Mic pin: input vref at 80% */
15673 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15674 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15675 /* Line In pin: input */
15676 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15677 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15678 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15679 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15680 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15681 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15682 /* CD pin widget for input */
15683 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15689 * 6-stack pin configuration:
15691 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15693 * Set pin mode and muting
15695 /* set front pin widgets 0x14 for output */
15696 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15697 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15698 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15700 /* Rear Pin: output 1 (0x0d) */
15701 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15702 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15703 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15704 /* CLFE Pin: output 2 (0x0e) */
15705 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15706 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15707 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15708 /* Side Pin: output 3 (0x0f) */
15709 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15710 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15711 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15713 /* Mic (rear) pin: input vref at 80% */
15714 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15715 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15716 /* Front Mic pin: input vref at 80% */
15717 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15718 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15719 /* Line In pin: input */
15720 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15721 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15722 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15723 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15724 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15725 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15726 /* CD pin widget for input */
15727 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15732 static struct hda_verb alc861vd_eapd_verbs[] = {
15733 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15737 static struct hda_verb alc660vd_eapd_verbs[] = {
15738 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15739 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15743 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15746 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15747 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15748 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15752 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15754 unsigned int present;
15755 unsigned char bits;
15757 present = snd_hda_jack_detect(codec, 0x18);
15758 bits = present ? HDA_AMP_MUTE : 0;
15760 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15761 HDA_AMP_MUTE, bits);
15764 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15766 struct alc_spec *spec = codec->spec;
15767 spec->autocfg.hp_pins[0] = 0x1b;
15768 spec->autocfg.speaker_pins[0] = 0x14;
15771 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15773 alc_automute_amp(codec);
15774 alc861vd_lenovo_mic_automute(codec);
15777 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15780 switch (res >> 26) {
15781 case ALC880_MIC_EVENT:
15782 alc861vd_lenovo_mic_automute(codec);
15785 alc_automute_amp_unsol_event(codec, res);
15790 static struct hda_verb alc861vd_dallas_verbs[] = {
15791 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15792 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15793 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15794 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15796 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15798 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15799 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15800 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15801 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15802 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15803 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15809 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15810 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15811 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15812 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15814 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15815 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15816 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15817 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15818 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15819 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15820 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15821 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15823 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15824 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15829 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15830 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15835 /* toggle speaker-output according to the hp-jack state */
15836 static void alc861vd_dallas_setup(struct hda_codec *codec)
15838 struct alc_spec *spec = codec->spec;
15840 spec->autocfg.hp_pins[0] = 0x15;
15841 spec->autocfg.speaker_pins[0] = 0x14;
15844 #ifdef CONFIG_SND_HDA_POWER_SAVE
15845 #define alc861vd_loopbacks alc880_loopbacks
15848 /* pcm configuration: identical with ALC880 */
15849 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15850 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15851 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15852 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15855 * configuration and preset
15857 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15858 [ALC660VD_3ST] = "3stack-660",
15859 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15860 [ALC660VD_ASUS_V1S] = "asus-v1s",
15861 [ALC861VD_3ST] = "3stack",
15862 [ALC861VD_3ST_DIG] = "3stack-digout",
15863 [ALC861VD_6ST_DIG] = "6stack-digout",
15864 [ALC861VD_LENOVO] = "lenovo",
15865 [ALC861VD_DALLAS] = "dallas",
15866 [ALC861VD_HP] = "hp",
15867 [ALC861VD_AUTO] = "auto",
15870 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15871 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15872 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15873 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15874 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15875 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15876 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15877 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15878 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15879 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15880 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15881 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15882 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15883 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15884 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15885 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15889 static struct alc_config_preset alc861vd_presets[] = {
15891 .mixers = { alc861vd_3st_mixer },
15892 .init_verbs = { alc861vd_volume_init_verbs,
15893 alc861vd_3stack_init_verbs },
15894 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15895 .dac_nids = alc660vd_dac_nids,
15896 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15897 .channel_mode = alc861vd_3stack_2ch_modes,
15898 .input_mux = &alc861vd_capture_source,
15900 [ALC660VD_3ST_DIG] = {
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 .dig_out_nid = ALC861VD_DIGOUT_NID,
15907 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15908 .channel_mode = alc861vd_3stack_2ch_modes,
15909 .input_mux = &alc861vd_capture_source,
15912 .mixers = { alc861vd_3st_mixer },
15913 .init_verbs = { alc861vd_volume_init_verbs,
15914 alc861vd_3stack_init_verbs },
15915 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15916 .dac_nids = alc861vd_dac_nids,
15917 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15918 .channel_mode = alc861vd_3stack_2ch_modes,
15919 .input_mux = &alc861vd_capture_source,
15921 [ALC861VD_3ST_DIG] = {
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 .dig_out_nid = ALC861VD_DIGOUT_NID,
15928 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15929 .channel_mode = alc861vd_3stack_2ch_modes,
15930 .input_mux = &alc861vd_capture_source,
15932 [ALC861VD_6ST_DIG] = {
15933 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15934 .init_verbs = { alc861vd_volume_init_verbs,
15935 alc861vd_6stack_init_verbs },
15936 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15937 .dac_nids = alc861vd_dac_nids,
15938 .dig_out_nid = ALC861VD_DIGOUT_NID,
15939 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15940 .channel_mode = alc861vd_6stack_modes,
15941 .input_mux = &alc861vd_capture_source,
15943 [ALC861VD_LENOVO] = {
15944 .mixers = { alc861vd_lenovo_mixer },
15945 .init_verbs = { alc861vd_volume_init_verbs,
15946 alc861vd_3stack_init_verbs,
15947 alc861vd_eapd_verbs,
15948 alc861vd_lenovo_unsol_verbs },
15949 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15950 .dac_nids = alc660vd_dac_nids,
15951 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15952 .channel_mode = alc861vd_3stack_2ch_modes,
15953 .input_mux = &alc861vd_capture_source,
15954 .unsol_event = alc861vd_lenovo_unsol_event,
15955 .setup = alc861vd_lenovo_setup,
15956 .init_hook = alc861vd_lenovo_init_hook,
15958 [ALC861VD_DALLAS] = {
15959 .mixers = { alc861vd_dallas_mixer },
15960 .init_verbs = { alc861vd_dallas_verbs },
15961 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15962 .dac_nids = alc861vd_dac_nids,
15963 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15964 .channel_mode = alc861vd_3stack_2ch_modes,
15965 .input_mux = &alc861vd_dallas_capture_source,
15966 .unsol_event = alc_automute_amp_unsol_event,
15967 .setup = alc861vd_dallas_setup,
15968 .init_hook = alc_automute_amp,
15971 .mixers = { alc861vd_hp_mixer },
15972 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15973 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15974 .dac_nids = alc861vd_dac_nids,
15975 .dig_out_nid = ALC861VD_DIGOUT_NID,
15976 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15977 .channel_mode = alc861vd_3stack_2ch_modes,
15978 .input_mux = &alc861vd_hp_capture_source,
15979 .unsol_event = alc_automute_amp_unsol_event,
15980 .setup = alc861vd_dallas_setup,
15981 .init_hook = alc_automute_amp,
15983 [ALC660VD_ASUS_V1S] = {
15984 .mixers = { alc861vd_lenovo_mixer },
15985 .init_verbs = { alc861vd_volume_init_verbs,
15986 alc861vd_3stack_init_verbs,
15987 alc861vd_eapd_verbs,
15988 alc861vd_lenovo_unsol_verbs },
15989 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15990 .dac_nids = alc660vd_dac_nids,
15991 .dig_out_nid = ALC861VD_DIGOUT_NID,
15992 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15993 .channel_mode = alc861vd_3stack_2ch_modes,
15994 .input_mux = &alc861vd_capture_source,
15995 .unsol_event = alc861vd_lenovo_unsol_event,
15996 .setup = alc861vd_lenovo_setup,
15997 .init_hook = alc861vd_lenovo_init_hook,
16002 * BIOS auto configuration
16004 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16005 const struct auto_pin_cfg *cfg)
16007 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16011 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16012 hda_nid_t nid, int pin_type, int dac_idx)
16014 alc_set_pin_output(codec, nid, pin_type);
16017 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16019 struct alc_spec *spec = codec->spec;
16022 for (i = 0; i <= HDA_SIDE; i++) {
16023 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16024 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16026 alc861vd_auto_set_output_and_unmute(codec, nid,
16032 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16034 struct alc_spec *spec = codec->spec;
16037 pin = spec->autocfg.hp_pins[0];
16038 if (pin) /* connect to front and use dac 0 */
16039 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16040 pin = spec->autocfg.speaker_pins[0];
16042 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16045 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16047 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16049 struct alc_spec *spec = codec->spec;
16052 for (i = 0; i < AUTO_PIN_LAST; i++) {
16053 hda_nid_t nid = spec->autocfg.input_pins[i];
16054 if (alc_is_input_pin(codec, nid)) {
16055 alc_set_input_pin(codec, nid, i);
16056 if (nid != ALC861VD_PIN_CD_NID &&
16057 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16058 snd_hda_codec_write(codec, nid, 0,
16059 AC_VERB_SET_AMP_GAIN_MUTE,
16065 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16067 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16068 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16070 /* add playback controls from the parsed DAC table */
16071 /* Based on ALC880 version. But ALC861VD has separate,
16072 * different NIDs for mute/unmute switch and volume control */
16073 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16074 const struct auto_pin_cfg *cfg)
16076 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16077 hda_nid_t nid_v, nid_s;
16080 for (i = 0; i < cfg->line_outs; i++) {
16081 if (!spec->multiout.dac_nids[i])
16083 nid_v = alc861vd_idx_to_mixer_vol(
16085 spec->multiout.dac_nids[i]));
16086 nid_s = alc861vd_idx_to_mixer_switch(
16088 spec->multiout.dac_nids[i]));
16092 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16094 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16098 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16100 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16104 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16106 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16110 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16112 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16118 if (cfg->line_outs == 1 &&
16119 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16126 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16127 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16131 if (cfg->line_outs == 1 &&
16132 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16134 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16135 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16144 /* add playback controls for speaker and HP outputs */
16145 /* Based on ALC880 version. But ALC861VD has separate,
16146 * different NIDs for mute/unmute switch and volume control */
16147 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16148 hda_nid_t pin, const char *pfx)
16150 hda_nid_t nid_v, nid_s;
16156 if (alc880_is_fixed_pin(pin)) {
16157 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16158 /* specify the DAC as the extra output */
16159 if (!spec->multiout.hp_nid)
16160 spec->multiout.hp_nid = nid_v;
16162 spec->multiout.extra_out_nid[0] = nid_v;
16163 /* control HP volume/switch on the output mixer amp */
16164 nid_v = alc861vd_idx_to_mixer_vol(
16165 alc880_fixed_pin_idx(pin));
16166 nid_s = alc861vd_idx_to_mixer_switch(
16167 alc880_fixed_pin_idx(pin));
16169 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16170 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16173 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16174 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16177 } else if (alc880_is_multi_pin(pin)) {
16178 /* set manual connection */
16179 /* we have only a switch on HP-out PIN */
16180 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16181 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16188 /* parse the BIOS configuration and set up the alc_spec
16189 * return 1 if successful, 0 if the proper config is not found,
16190 * or a negative error code
16191 * Based on ALC880 version - had to change it to override
16192 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16193 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16195 struct alc_spec *spec = codec->spec;
16197 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16199 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16203 if (!spec->autocfg.line_outs)
16204 return 0; /* can't find valid BIOS pin config */
16206 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16209 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16212 err = alc861vd_auto_create_extra_out(spec,
16213 spec->autocfg.speaker_pins[0],
16217 err = alc861vd_auto_create_extra_out(spec,
16218 spec->autocfg.hp_pins[0],
16222 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16226 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16228 if (spec->autocfg.dig_outs)
16229 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16231 if (spec->kctls.list)
16232 add_mixer(spec, spec->kctls.list);
16234 add_verb(spec, alc861vd_volume_init_verbs);
16236 spec->num_mux_defs = 1;
16237 spec->input_mux = &spec->private_imux[0];
16239 err = alc_auto_add_mic_boost(codec);
16243 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16248 /* additional initialization for auto-configuration model */
16249 static void alc861vd_auto_init(struct hda_codec *codec)
16251 struct alc_spec *spec = codec->spec;
16252 alc861vd_auto_init_multi_out(codec);
16253 alc861vd_auto_init_hp_out(codec);
16254 alc861vd_auto_init_analog_input(codec);
16255 alc861vd_auto_init_input_src(codec);
16256 if (spec->unsol_event)
16257 alc_inithook(codec);
16261 ALC660VD_FIX_ASUS_GPIO1
16265 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16266 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16267 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16268 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16272 static const struct alc_fixup alc861vd_fixups[] = {
16273 [ALC660VD_FIX_ASUS_GPIO1] = {
16274 .verbs = alc660vd_fix_asus_gpio1_verbs,
16278 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16279 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16283 static int patch_alc861vd(struct hda_codec *codec)
16285 struct alc_spec *spec;
16286 int err, board_config;
16288 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16292 codec->spec = spec;
16294 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16298 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16299 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16301 board_config = ALC861VD_AUTO;
16304 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16306 if (board_config == ALC861VD_AUTO) {
16307 /* automatic parse from the BIOS config */
16308 err = alc861vd_parse_auto_config(codec);
16314 "hda_codec: Cannot set up configuration "
16315 "from BIOS. Using base mode...\n");
16316 board_config = ALC861VD_3ST;
16320 err = snd_hda_attach_beep_device(codec, 0x23);
16326 if (board_config != ALC861VD_AUTO)
16327 setup_preset(codec, &alc861vd_presets[board_config]);
16329 if (codec->vendor_id == 0x10ec0660) {
16330 /* always turn on EAPD */
16331 add_verb(spec, alc660vd_eapd_verbs);
16334 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16335 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16337 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16338 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16340 if (!spec->adc_nids) {
16341 spec->adc_nids = alc861vd_adc_nids;
16342 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16344 if (!spec->capsrc_nids)
16345 spec->capsrc_nids = alc861vd_capsrc_nids;
16347 set_capture_mixer(codec);
16348 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16350 spec->vmaster_nid = 0x02;
16352 codec->patch_ops = alc_patch_ops;
16354 if (board_config == ALC861VD_AUTO)
16355 spec->init_hook = alc861vd_auto_init;
16356 #ifdef CONFIG_SND_HDA_POWER_SAVE
16357 if (!spec->loopback.amplist)
16358 spec->loopback.amplist = alc861vd_loopbacks;
16367 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16368 * configuration. Each pin widget can choose any input DACs and a mixer.
16369 * Each ADC is connected from a mixer of all inputs. This makes possible
16370 * 6-channel independent captures.
16372 * In addition, an independent DAC for the multi-playback (not used in this
16375 #define ALC662_DIGOUT_NID 0x06
16376 #define ALC662_DIGIN_NID 0x0a
16378 static hda_nid_t alc662_dac_nids[4] = {
16379 /* front, rear, clfe, rear_surr */
16383 static hda_nid_t alc272_dac_nids[2] = {
16387 static hda_nid_t alc662_adc_nids[2] = {
16392 static hda_nid_t alc272_adc_nids[1] = {
16397 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16398 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16402 /* FIXME: should be a matrix-type input source selection */
16403 static struct hda_input_mux alc662_capture_source = {
16407 { "Front Mic", 0x1 },
16413 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16421 static struct hda_input_mux alc663_capture_source = {
16425 { "Front Mic", 0x1 },
16430 #if 0 /* set to 1 for testing other input sources below */
16431 static struct hda_input_mux alc272_nc10_capture_source = {
16434 { "Autoselect Mic", 0x0 },
16435 { "Internal Mic", 0x1 },
16436 { "In-0x02", 0x2 },
16437 { "In-0x03", 0x3 },
16438 { "In-0x04", 0x4 },
16439 { "In-0x05", 0x5 },
16440 { "In-0x06", 0x6 },
16441 { "In-0x07", 0x7 },
16442 { "In-0x08", 0x8 },
16443 { "In-0x09", 0x9 },
16444 { "In-0x0a", 0x0a },
16445 { "In-0x0b", 0x0b },
16446 { "In-0x0c", 0x0c },
16447 { "In-0x0d", 0x0d },
16448 { "In-0x0e", 0x0e },
16449 { "In-0x0f", 0x0f },
16457 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16464 static struct hda_verb alc662_3ST_ch2_init[] = {
16465 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16466 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16467 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16468 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16475 static struct hda_verb alc662_3ST_ch6_init[] = {
16476 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16477 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16478 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16479 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16480 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16481 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16485 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16486 { 2, alc662_3ST_ch2_init },
16487 { 6, alc662_3ST_ch6_init },
16493 static struct hda_verb alc662_sixstack_ch6_init[] = {
16494 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16495 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16496 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16503 static struct hda_verb alc662_sixstack_ch8_init[] = {
16504 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16505 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16506 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16510 static struct hda_channel_mode alc662_5stack_modes[2] = {
16511 { 2, alc662_sixstack_ch6_init },
16512 { 6, alc662_sixstack_ch8_init },
16515 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16516 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16519 static struct snd_kcontrol_new alc662_base_mixer[] = {
16520 /* output mixer control */
16521 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16522 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16523 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16524 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16525 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16526 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16527 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16528 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16529 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16531 /*Input mixer control */
16532 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16533 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16534 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16535 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16536 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16537 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16538 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16539 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16543 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16544 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16545 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16547 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16548 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16549 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16550 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16552 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16553 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16554 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16558 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16559 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16560 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16561 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16562 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16563 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16564 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16565 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16566 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16567 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16568 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16569 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16570 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16571 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16573 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16574 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16575 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16579 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16580 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16581 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16582 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16583 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16584 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16585 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16586 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16592 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16593 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16594 ALC262_HIPPO_MASTER_SWITCH,
16596 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16597 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16598 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16600 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16601 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16602 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16606 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16607 ALC262_HIPPO_MASTER_SWITCH,
16608 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16609 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16610 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16611 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16612 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16613 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16614 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16620 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16621 .ops = &snd_hda_bind_vol,
16623 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16624 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16629 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16630 .ops = &snd_hda_bind_sw,
16632 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16633 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16638 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16639 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16640 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16646 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16647 .ops = &snd_hda_bind_sw,
16649 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16650 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16651 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16656 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16657 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16658 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16661 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16662 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16667 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16668 .ops = &snd_hda_bind_sw,
16670 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16671 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16672 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16677 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16678 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16679 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16682 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16683 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16687 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16688 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16689 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16693 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16694 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16698 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16699 .ops = &snd_hda_bind_vol,
16701 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16702 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16707 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16708 .ops = &snd_hda_bind_sw,
16710 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16711 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16716 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16717 HDA_BIND_VOL("Master Playback Volume",
16718 &alc663_asus_two_bind_master_vol),
16719 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16720 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16721 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16727 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16728 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_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", 0x15, 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_g71v_mixer[] = {
16738 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16739 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16740 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16741 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16745 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16746 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16747 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16751 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16752 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16753 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16754 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16756 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16758 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16759 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16760 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16761 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16765 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16766 .ops = &snd_hda_bind_sw,
16768 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16769 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16770 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16771 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16772 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16777 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16778 .ops = &snd_hda_bind_sw,
16780 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16781 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16786 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16787 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16788 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16789 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16790 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16791 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16792 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16793 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16795 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16799 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16800 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16801 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16802 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16803 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16804 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16805 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16806 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16811 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16813 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16814 .name = "Channel Mode",
16815 .info = alc_ch_mode_info,
16816 .get = alc_ch_mode_get,
16817 .put = alc_ch_mode_put,
16822 static struct hda_verb alc662_init_verbs[] = {
16823 /* ADC: mute amp left and right */
16824 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16825 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16827 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16828 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16829 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16830 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16831 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16832 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16834 /* Front Pin: output 0 (0x0c) */
16835 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16838 /* Rear Pin: output 1 (0x0d) */
16839 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16842 /* CLFE Pin: output 2 (0x0e) */
16843 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16844 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16846 /* Mic (rear) pin: input vref at 80% */
16847 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16848 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16849 /* Front Mic pin: input vref at 80% */
16850 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16851 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16852 /* Line In pin: input */
16853 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16855 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16856 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16857 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16858 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16859 /* CD pin widget for input */
16860 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16862 /* FIXME: use matrix-type input source selection */
16863 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16865 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16868 /* always trun on EAPD */
16869 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16870 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16875 static struct hda_verb alc663_init_verbs[] = {
16876 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16877 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16878 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16879 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16880 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16881 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16885 static struct hda_verb alc272_init_verbs[] = {
16886 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16887 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16888 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16889 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16890 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16891 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16892 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16893 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16897 static struct hda_verb alc662_sue_init_verbs[] = {
16898 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16899 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16903 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16904 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16905 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16909 /* Set Unsolicited Event*/
16910 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16911 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16912 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16916 static struct hda_verb alc663_m51va_init_verbs[] = {
16917 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16918 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16919 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16920 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16921 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16924 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16925 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16929 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16930 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16931 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16932 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16935 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16936 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16940 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16941 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16942 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16943 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16944 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16946 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16947 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16948 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16952 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16955 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16957 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16958 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16959 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16963 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16964 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16965 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16966 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16967 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16968 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16970 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16972 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16973 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16974 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16975 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16979 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16980 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16981 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16982 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16983 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16986 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16989 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16990 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16991 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16995 static struct hda_verb alc663_g71v_init_verbs[] = {
16996 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16997 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16998 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17000 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17001 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17002 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17004 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17005 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17006 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17010 static struct hda_verb alc663_g50v_init_verbs[] = {
17011 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17012 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17013 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17015 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17016 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17020 static struct hda_verb alc662_ecs_init_verbs[] = {
17021 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17023 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17024 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17028 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17029 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17030 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17031 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17032 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17033 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17034 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17035 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17038 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17039 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17043 static struct hda_verb alc272_dell_init_verbs[] = {
17044 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17045 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17047 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17048 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17049 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17050 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17051 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17052 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17053 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17054 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17058 static struct hda_verb alc663_mode7_init_verbs[] = {
17059 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17060 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17061 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17062 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17063 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17064 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17065 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17066 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17067 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17068 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17071 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17072 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17073 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17077 static struct hda_verb alc663_mode8_init_verbs[] = {
17078 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17079 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17080 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17081 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17082 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17083 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17084 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17085 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17086 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17087 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17088 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17091 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17092 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17093 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17097 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17098 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17099 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17103 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17104 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17105 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17109 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17111 unsigned int present;
17112 unsigned char bits;
17114 present = snd_hda_jack_detect(codec, 0x14);
17115 bits = present ? HDA_AMP_MUTE : 0;
17117 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17118 HDA_AMP_MUTE, bits);
17121 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17123 unsigned int present;
17124 unsigned char bits;
17126 present = snd_hda_jack_detect(codec, 0x1b);
17127 bits = present ? HDA_AMP_MUTE : 0;
17129 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17130 HDA_AMP_MUTE, bits);
17131 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17132 HDA_AMP_MUTE, bits);
17135 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17138 if ((res >> 26) == ALC880_HP_EVENT)
17139 alc662_lenovo_101e_all_automute(codec);
17140 if ((res >> 26) == ALC880_FRONT_EVENT)
17141 alc662_lenovo_101e_ispeaker_automute(codec);
17144 /* unsolicited event for HP jack sensing */
17145 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17148 if ((res >> 26) == ALC880_MIC_EVENT)
17149 alc_mic_automute(codec);
17151 alc262_hippo_unsol_event(codec, res);
17154 static void alc662_eeepc_setup(struct hda_codec *codec)
17156 struct alc_spec *spec = codec->spec;
17158 alc262_hippo1_setup(codec);
17159 spec->ext_mic.pin = 0x18;
17160 spec->ext_mic.mux_idx = 0;
17161 spec->int_mic.pin = 0x19;
17162 spec->int_mic.mux_idx = 1;
17163 spec->auto_mic = 1;
17166 static void alc662_eeepc_inithook(struct hda_codec *codec)
17168 alc262_hippo_automute(codec);
17169 alc_mic_automute(codec);
17172 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17174 struct alc_spec *spec = codec->spec;
17176 spec->autocfg.hp_pins[0] = 0x14;
17177 spec->autocfg.speaker_pins[0] = 0x1b;
17180 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17182 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17184 unsigned int present;
17185 unsigned char bits;
17187 present = snd_hda_jack_detect(codec, 0x21);
17188 bits = present ? HDA_AMP_MUTE : 0;
17189 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17190 AMP_IN_MUTE(0), bits);
17191 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17192 AMP_IN_MUTE(0), bits);
17195 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17197 unsigned int present;
17198 unsigned char bits;
17200 present = snd_hda_jack_detect(codec, 0x21);
17201 bits = present ? HDA_AMP_MUTE : 0;
17202 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17203 AMP_IN_MUTE(0), bits);
17204 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17205 AMP_IN_MUTE(0), bits);
17206 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17207 AMP_IN_MUTE(0), bits);
17208 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17209 AMP_IN_MUTE(0), bits);
17212 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17214 unsigned int present;
17215 unsigned char bits;
17217 present = snd_hda_jack_detect(codec, 0x15);
17218 bits = present ? HDA_AMP_MUTE : 0;
17219 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17220 AMP_IN_MUTE(0), bits);
17221 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17222 AMP_IN_MUTE(0), bits);
17223 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17224 AMP_IN_MUTE(0), bits);
17225 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17226 AMP_IN_MUTE(0), bits);
17229 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17231 unsigned int present;
17232 unsigned char bits;
17234 present = snd_hda_jack_detect(codec, 0x1b);
17235 bits = present ? 0 : PIN_OUT;
17236 snd_hda_codec_write(codec, 0x14, 0,
17237 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17240 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17242 unsigned int present1, present2;
17244 present1 = snd_hda_jack_detect(codec, 0x21);
17245 present2 = snd_hda_jack_detect(codec, 0x15);
17247 if (present1 || present2) {
17248 snd_hda_codec_write_cache(codec, 0x14, 0,
17249 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17251 snd_hda_codec_write_cache(codec, 0x14, 0,
17252 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17256 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17258 unsigned int present1, present2;
17260 present1 = snd_hda_jack_detect(codec, 0x1b);
17261 present2 = snd_hda_jack_detect(codec, 0x15);
17263 if (present1 || present2) {
17264 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17265 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17266 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17267 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17269 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17270 AMP_IN_MUTE(0), 0);
17271 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17272 AMP_IN_MUTE(0), 0);
17276 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17278 unsigned int present1, present2;
17280 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17281 AC_VERB_GET_PIN_SENSE, 0)
17282 & AC_PINSENSE_PRESENCE;
17283 present2 = snd_hda_codec_read(codec, 0x21, 0,
17284 AC_VERB_GET_PIN_SENSE, 0)
17285 & AC_PINSENSE_PRESENCE;
17287 if (present1 || present2) {
17288 snd_hda_codec_write_cache(codec, 0x14, 0,
17289 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17290 snd_hda_codec_write_cache(codec, 0x17, 0,
17291 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17293 snd_hda_codec_write_cache(codec, 0x14, 0,
17294 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17295 snd_hda_codec_write_cache(codec, 0x17, 0,
17296 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17300 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17302 unsigned int present1, present2;
17304 present1 = snd_hda_codec_read(codec, 0x21, 0,
17305 AC_VERB_GET_PIN_SENSE, 0)
17306 & AC_PINSENSE_PRESENCE;
17307 present2 = snd_hda_codec_read(codec, 0x15, 0,
17308 AC_VERB_GET_PIN_SENSE, 0)
17309 & AC_PINSENSE_PRESENCE;
17311 if (present1 || present2) {
17312 snd_hda_codec_write_cache(codec, 0x14, 0,
17313 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17314 snd_hda_codec_write_cache(codec, 0x17, 0,
17315 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17317 snd_hda_codec_write_cache(codec, 0x14, 0,
17318 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17319 snd_hda_codec_write_cache(codec, 0x17, 0,
17320 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17324 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17327 switch (res >> 26) {
17328 case ALC880_HP_EVENT:
17329 alc663_m51va_speaker_automute(codec);
17331 case ALC880_MIC_EVENT:
17332 alc_mic_automute(codec);
17337 static void alc663_m51va_setup(struct hda_codec *codec)
17339 struct alc_spec *spec = codec->spec;
17340 spec->ext_mic.pin = 0x18;
17341 spec->ext_mic.mux_idx = 0;
17342 spec->int_mic.pin = 0x12;
17343 spec->int_mic.mux_idx = 9;
17344 spec->auto_mic = 1;
17347 static void alc663_m51va_inithook(struct hda_codec *codec)
17349 alc663_m51va_speaker_automute(codec);
17350 alc_mic_automute(codec);
17353 /* ***************** Mode1 ******************************/
17354 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17356 static void alc663_mode1_setup(struct hda_codec *codec)
17358 struct alc_spec *spec = codec->spec;
17359 spec->ext_mic.pin = 0x18;
17360 spec->ext_mic.mux_idx = 0;
17361 spec->int_mic.pin = 0x19;
17362 spec->int_mic.mux_idx = 1;
17363 spec->auto_mic = 1;
17366 #define alc663_mode1_inithook alc663_m51va_inithook
17368 /* ***************** Mode2 ******************************/
17369 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17372 switch (res >> 26) {
17373 case ALC880_HP_EVENT:
17374 alc662_f5z_speaker_automute(codec);
17376 case ALC880_MIC_EVENT:
17377 alc_mic_automute(codec);
17382 #define alc662_mode2_setup alc663_mode1_setup
17384 static void alc662_mode2_inithook(struct hda_codec *codec)
17386 alc662_f5z_speaker_automute(codec);
17387 alc_mic_automute(codec);
17389 /* ***************** Mode3 ******************************/
17390 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17393 switch (res >> 26) {
17394 case ALC880_HP_EVENT:
17395 alc663_two_hp_m1_speaker_automute(codec);
17397 case ALC880_MIC_EVENT:
17398 alc_mic_automute(codec);
17403 #define alc663_mode3_setup alc663_mode1_setup
17405 static void alc663_mode3_inithook(struct hda_codec *codec)
17407 alc663_two_hp_m1_speaker_automute(codec);
17408 alc_mic_automute(codec);
17410 /* ***************** Mode4 ******************************/
17411 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17414 switch (res >> 26) {
17415 case ALC880_HP_EVENT:
17416 alc663_21jd_two_speaker_automute(codec);
17418 case ALC880_MIC_EVENT:
17419 alc_mic_automute(codec);
17424 #define alc663_mode4_setup alc663_mode1_setup
17426 static void alc663_mode4_inithook(struct hda_codec *codec)
17428 alc663_21jd_two_speaker_automute(codec);
17429 alc_mic_automute(codec);
17431 /* ***************** Mode5 ******************************/
17432 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17435 switch (res >> 26) {
17436 case ALC880_HP_EVENT:
17437 alc663_15jd_two_speaker_automute(codec);
17439 case ALC880_MIC_EVENT:
17440 alc_mic_automute(codec);
17445 #define alc663_mode5_setup alc663_mode1_setup
17447 static void alc663_mode5_inithook(struct hda_codec *codec)
17449 alc663_15jd_two_speaker_automute(codec);
17450 alc_mic_automute(codec);
17452 /* ***************** Mode6 ******************************/
17453 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17456 switch (res >> 26) {
17457 case ALC880_HP_EVENT:
17458 alc663_two_hp_m2_speaker_automute(codec);
17460 case ALC880_MIC_EVENT:
17461 alc_mic_automute(codec);
17466 #define alc663_mode6_setup alc663_mode1_setup
17468 static void alc663_mode6_inithook(struct hda_codec *codec)
17470 alc663_two_hp_m2_speaker_automute(codec);
17471 alc_mic_automute(codec);
17474 /* ***************** Mode7 ******************************/
17475 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17478 switch (res >> 26) {
17479 case ALC880_HP_EVENT:
17480 alc663_two_hp_m7_speaker_automute(codec);
17482 case ALC880_MIC_EVENT:
17483 alc_mic_automute(codec);
17488 #define alc663_mode7_setup alc663_mode1_setup
17490 static void alc663_mode7_inithook(struct hda_codec *codec)
17492 alc663_two_hp_m7_speaker_automute(codec);
17493 alc_mic_automute(codec);
17496 /* ***************** Mode8 ******************************/
17497 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17500 switch (res >> 26) {
17501 case ALC880_HP_EVENT:
17502 alc663_two_hp_m8_speaker_automute(codec);
17504 case ALC880_MIC_EVENT:
17505 alc_mic_automute(codec);
17510 #define alc663_mode8_setup alc663_m51va_setup
17512 static void alc663_mode8_inithook(struct hda_codec *codec)
17514 alc663_two_hp_m8_speaker_automute(codec);
17515 alc_mic_automute(codec);
17518 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17520 unsigned int present;
17521 unsigned char bits;
17523 present = snd_hda_jack_detect(codec, 0x21);
17524 bits = present ? HDA_AMP_MUTE : 0;
17525 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17526 HDA_AMP_MUTE, bits);
17527 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17528 HDA_AMP_MUTE, bits);
17531 static void alc663_g71v_front_automute(struct hda_codec *codec)
17533 unsigned int present;
17534 unsigned char bits;
17536 present = snd_hda_jack_detect(codec, 0x15);
17537 bits = present ? HDA_AMP_MUTE : 0;
17538 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17539 HDA_AMP_MUTE, bits);
17542 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17545 switch (res >> 26) {
17546 case ALC880_HP_EVENT:
17547 alc663_g71v_hp_automute(codec);
17549 case ALC880_FRONT_EVENT:
17550 alc663_g71v_front_automute(codec);
17552 case ALC880_MIC_EVENT:
17553 alc_mic_automute(codec);
17558 #define alc663_g71v_setup alc663_m51va_setup
17560 static void alc663_g71v_inithook(struct hda_codec *codec)
17562 alc663_g71v_front_automute(codec);
17563 alc663_g71v_hp_automute(codec);
17564 alc_mic_automute(codec);
17567 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17570 switch (res >> 26) {
17571 case ALC880_HP_EVENT:
17572 alc663_m51va_speaker_automute(codec);
17574 case ALC880_MIC_EVENT:
17575 alc_mic_automute(codec);
17580 #define alc663_g50v_setup alc663_m51va_setup
17582 static void alc663_g50v_inithook(struct hda_codec *codec)
17584 alc663_m51va_speaker_automute(codec);
17585 alc_mic_automute(codec);
17588 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17589 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17590 ALC262_HIPPO_MASTER_SWITCH,
17592 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17593 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17594 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17596 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17597 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17598 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17602 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17603 /* Master Playback automatically created from Speaker and Headphone */
17604 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17605 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17606 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17609 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17610 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17611 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17613 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17614 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17615 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17619 #ifdef CONFIG_SND_HDA_POWER_SAVE
17620 #define alc662_loopbacks alc880_loopbacks
17624 /* pcm configuration: identical with ALC880 */
17625 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17626 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17627 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17628 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17631 * configuration and preset
17633 static const char *alc662_models[ALC662_MODEL_LAST] = {
17634 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17635 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17636 [ALC662_3ST_6ch] = "3stack-6ch",
17637 [ALC662_5ST_DIG] = "6stack-dig",
17638 [ALC662_LENOVO_101E] = "lenovo-101e",
17639 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17640 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17641 [ALC662_ECS] = "ecs",
17642 [ALC663_ASUS_M51VA] = "m51va",
17643 [ALC663_ASUS_G71V] = "g71v",
17644 [ALC663_ASUS_H13] = "h13",
17645 [ALC663_ASUS_G50V] = "g50v",
17646 [ALC663_ASUS_MODE1] = "asus-mode1",
17647 [ALC662_ASUS_MODE2] = "asus-mode2",
17648 [ALC663_ASUS_MODE3] = "asus-mode3",
17649 [ALC663_ASUS_MODE4] = "asus-mode4",
17650 [ALC663_ASUS_MODE5] = "asus-mode5",
17651 [ALC663_ASUS_MODE6] = "asus-mode6",
17652 [ALC663_ASUS_MODE7] = "asus-mode7",
17653 [ALC663_ASUS_MODE8] = "asus-mode8",
17654 [ALC272_DELL] = "dell",
17655 [ALC272_DELL_ZM1] = "dell-zm1",
17656 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17657 [ALC662_AUTO] = "auto",
17660 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17661 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17662 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17663 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17664 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17665 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17666 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17667 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17668 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17669 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17670 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17671 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17672 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17673 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17674 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17675 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17676 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17677 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17678 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17679 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17680 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17681 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17682 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17683 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17684 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17685 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17686 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17687 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17688 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17689 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17690 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17691 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17692 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17693 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17694 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17695 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17696 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17697 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17698 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17699 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17700 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17701 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17702 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17703 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17704 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17705 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17706 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17707 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17708 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17709 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17710 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17711 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17712 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17713 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17714 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17715 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17716 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17717 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17718 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17719 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17720 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17721 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17722 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17723 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17724 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17725 ALC662_3ST_6ch_DIG),
17726 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17727 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17728 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17729 ALC662_3ST_6ch_DIG),
17730 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17731 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17732 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17733 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17734 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17735 ALC662_3ST_6ch_DIG),
17736 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17738 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17742 static struct alc_config_preset alc662_presets[] = {
17743 [ALC662_3ST_2ch_DIG] = {
17744 .mixers = { alc662_3ST_2ch_mixer },
17745 .init_verbs = { alc662_init_verbs },
17746 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17747 .dac_nids = alc662_dac_nids,
17748 .dig_out_nid = ALC662_DIGOUT_NID,
17749 .dig_in_nid = ALC662_DIGIN_NID,
17750 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17751 .channel_mode = alc662_3ST_2ch_modes,
17752 .input_mux = &alc662_capture_source,
17754 [ALC662_3ST_6ch_DIG] = {
17755 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17756 .init_verbs = { alc662_init_verbs },
17757 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17758 .dac_nids = alc662_dac_nids,
17759 .dig_out_nid = ALC662_DIGOUT_NID,
17760 .dig_in_nid = ALC662_DIGIN_NID,
17761 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17762 .channel_mode = alc662_3ST_6ch_modes,
17764 .input_mux = &alc662_capture_source,
17766 [ALC662_3ST_6ch] = {
17767 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17768 .init_verbs = { alc662_init_verbs },
17769 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17770 .dac_nids = alc662_dac_nids,
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_5ST_DIG] = {
17777 .mixers = { alc662_base_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 .dig_out_nid = ALC662_DIGOUT_NID,
17782 .dig_in_nid = ALC662_DIGIN_NID,
17783 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17784 .channel_mode = alc662_5stack_modes,
17785 .input_mux = &alc662_capture_source,
17787 [ALC662_LENOVO_101E] = {
17788 .mixers = { alc662_lenovo_101e_mixer },
17789 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17790 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17791 .dac_nids = alc662_dac_nids,
17792 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17793 .channel_mode = alc662_3ST_2ch_modes,
17794 .input_mux = &alc662_lenovo_101e_capture_source,
17795 .unsol_event = alc662_lenovo_101e_unsol_event,
17796 .init_hook = alc662_lenovo_101e_all_automute,
17798 [ALC662_ASUS_EEEPC_P701] = {
17799 .mixers = { alc662_eeepc_p701_mixer },
17800 .init_verbs = { alc662_init_verbs,
17801 alc662_eeepc_sue_init_verbs },
17802 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17803 .dac_nids = alc662_dac_nids,
17804 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17805 .channel_mode = alc662_3ST_2ch_modes,
17806 .unsol_event = alc662_eeepc_unsol_event,
17807 .setup = alc662_eeepc_setup,
17808 .init_hook = alc662_eeepc_inithook,
17810 [ALC662_ASUS_EEEPC_EP20] = {
17811 .mixers = { alc662_eeepc_ep20_mixer,
17812 alc662_chmode_mixer },
17813 .init_verbs = { alc662_init_verbs,
17814 alc662_eeepc_ep20_sue_init_verbs },
17815 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17816 .dac_nids = alc662_dac_nids,
17817 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17818 .channel_mode = alc662_3ST_6ch_modes,
17819 .input_mux = &alc662_lenovo_101e_capture_source,
17820 .unsol_event = alc662_eeepc_unsol_event,
17821 .setup = alc662_eeepc_ep20_setup,
17822 .init_hook = alc662_eeepc_ep20_inithook,
17825 .mixers = { alc662_ecs_mixer },
17826 .init_verbs = { alc662_init_verbs,
17827 alc662_ecs_init_verbs },
17828 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17829 .dac_nids = alc662_dac_nids,
17830 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17831 .channel_mode = alc662_3ST_2ch_modes,
17832 .unsol_event = alc662_eeepc_unsol_event,
17833 .setup = alc662_eeepc_setup,
17834 .init_hook = alc662_eeepc_inithook,
17836 [ALC663_ASUS_M51VA] = {
17837 .mixers = { alc663_m51va_mixer },
17838 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17839 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17840 .dac_nids = alc662_dac_nids,
17841 .dig_out_nid = ALC662_DIGOUT_NID,
17842 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17843 .channel_mode = alc662_3ST_2ch_modes,
17844 .unsol_event = alc663_m51va_unsol_event,
17845 .setup = alc663_m51va_setup,
17846 .init_hook = alc663_m51va_inithook,
17848 [ALC663_ASUS_G71V] = {
17849 .mixers = { alc663_g71v_mixer },
17850 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17851 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17852 .dac_nids = alc662_dac_nids,
17853 .dig_out_nid = ALC662_DIGOUT_NID,
17854 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17855 .channel_mode = alc662_3ST_2ch_modes,
17856 .unsol_event = alc663_g71v_unsol_event,
17857 .setup = alc663_g71v_setup,
17858 .init_hook = alc663_g71v_inithook,
17860 [ALC663_ASUS_H13] = {
17861 .mixers = { alc663_m51va_mixer },
17862 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17863 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17864 .dac_nids = alc662_dac_nids,
17865 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17866 .channel_mode = alc662_3ST_2ch_modes,
17867 .unsol_event = alc663_m51va_unsol_event,
17868 .init_hook = alc663_m51va_inithook,
17870 [ALC663_ASUS_G50V] = {
17871 .mixers = { alc663_g50v_mixer },
17872 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17873 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17874 .dac_nids = alc662_dac_nids,
17875 .dig_out_nid = ALC662_DIGOUT_NID,
17876 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17877 .channel_mode = alc662_3ST_6ch_modes,
17878 .input_mux = &alc663_capture_source,
17879 .unsol_event = alc663_g50v_unsol_event,
17880 .setup = alc663_g50v_setup,
17881 .init_hook = alc663_g50v_inithook,
17883 [ALC663_ASUS_MODE1] = {
17884 .mixers = { alc663_m51va_mixer },
17885 .cap_mixer = alc662_auto_capture_mixer,
17886 .init_verbs = { alc662_init_verbs,
17887 alc663_21jd_amic_init_verbs },
17888 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17890 .dac_nids = alc662_dac_nids,
17891 .dig_out_nid = ALC662_DIGOUT_NID,
17892 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17893 .channel_mode = alc662_3ST_2ch_modes,
17894 .unsol_event = alc663_mode1_unsol_event,
17895 .setup = alc663_mode1_setup,
17896 .init_hook = alc663_mode1_inithook,
17898 [ALC662_ASUS_MODE2] = {
17899 .mixers = { alc662_1bjd_mixer },
17900 .cap_mixer = alc662_auto_capture_mixer,
17901 .init_verbs = { alc662_init_verbs,
17902 alc662_1bjd_amic_init_verbs },
17903 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17904 .dac_nids = alc662_dac_nids,
17905 .dig_out_nid = ALC662_DIGOUT_NID,
17906 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17907 .channel_mode = alc662_3ST_2ch_modes,
17908 .unsol_event = alc662_mode2_unsol_event,
17909 .setup = alc662_mode2_setup,
17910 .init_hook = alc662_mode2_inithook,
17912 [ALC663_ASUS_MODE3] = {
17913 .mixers = { alc663_two_hp_m1_mixer },
17914 .cap_mixer = alc662_auto_capture_mixer,
17915 .init_verbs = { alc662_init_verbs,
17916 alc663_two_hp_amic_m1_init_verbs },
17917 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17919 .dac_nids = alc662_dac_nids,
17920 .dig_out_nid = ALC662_DIGOUT_NID,
17921 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17922 .channel_mode = alc662_3ST_2ch_modes,
17923 .unsol_event = alc663_mode3_unsol_event,
17924 .setup = alc663_mode3_setup,
17925 .init_hook = alc663_mode3_inithook,
17927 [ALC663_ASUS_MODE4] = {
17928 .mixers = { alc663_asus_21jd_clfe_mixer },
17929 .cap_mixer = alc662_auto_capture_mixer,
17930 .init_verbs = { alc662_init_verbs,
17931 alc663_21jd_amic_init_verbs},
17932 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17934 .dac_nids = alc662_dac_nids,
17935 .dig_out_nid = ALC662_DIGOUT_NID,
17936 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17937 .channel_mode = alc662_3ST_2ch_modes,
17938 .unsol_event = alc663_mode4_unsol_event,
17939 .setup = alc663_mode4_setup,
17940 .init_hook = alc663_mode4_inithook,
17942 [ALC663_ASUS_MODE5] = {
17943 .mixers = { alc663_asus_15jd_clfe_mixer },
17944 .cap_mixer = alc662_auto_capture_mixer,
17945 .init_verbs = { alc662_init_verbs,
17946 alc663_15jd_amic_init_verbs },
17947 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17949 .dac_nids = alc662_dac_nids,
17950 .dig_out_nid = ALC662_DIGOUT_NID,
17951 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17952 .channel_mode = alc662_3ST_2ch_modes,
17953 .unsol_event = alc663_mode5_unsol_event,
17954 .setup = alc663_mode5_setup,
17955 .init_hook = alc663_mode5_inithook,
17957 [ALC663_ASUS_MODE6] = {
17958 .mixers = { alc663_two_hp_m2_mixer },
17959 .cap_mixer = alc662_auto_capture_mixer,
17960 .init_verbs = { alc662_init_verbs,
17961 alc663_two_hp_amic_m2_init_verbs },
17962 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17964 .dac_nids = alc662_dac_nids,
17965 .dig_out_nid = ALC662_DIGOUT_NID,
17966 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17967 .channel_mode = alc662_3ST_2ch_modes,
17968 .unsol_event = alc663_mode6_unsol_event,
17969 .setup = alc663_mode6_setup,
17970 .init_hook = alc663_mode6_inithook,
17972 [ALC663_ASUS_MODE7] = {
17973 .mixers = { alc663_mode7_mixer },
17974 .cap_mixer = alc662_auto_capture_mixer,
17975 .init_verbs = { alc662_init_verbs,
17976 alc663_mode7_init_verbs },
17977 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17979 .dac_nids = alc662_dac_nids,
17980 .dig_out_nid = ALC662_DIGOUT_NID,
17981 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17982 .channel_mode = alc662_3ST_2ch_modes,
17983 .unsol_event = alc663_mode7_unsol_event,
17984 .setup = alc663_mode7_setup,
17985 .init_hook = alc663_mode7_inithook,
17987 [ALC663_ASUS_MODE8] = {
17988 .mixers = { alc663_mode8_mixer },
17989 .cap_mixer = alc662_auto_capture_mixer,
17990 .init_verbs = { alc662_init_verbs,
17991 alc663_mode8_init_verbs },
17992 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17994 .dac_nids = alc662_dac_nids,
17995 .dig_out_nid = ALC662_DIGOUT_NID,
17996 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17997 .channel_mode = alc662_3ST_2ch_modes,
17998 .unsol_event = alc663_mode8_unsol_event,
17999 .setup = alc663_mode8_setup,
18000 .init_hook = alc663_mode8_inithook,
18003 .mixers = { alc663_m51va_mixer },
18004 .cap_mixer = alc272_auto_capture_mixer,
18005 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18006 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18007 .dac_nids = alc662_dac_nids,
18008 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18009 .adc_nids = alc272_adc_nids,
18010 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18011 .capsrc_nids = alc272_capsrc_nids,
18012 .channel_mode = alc662_3ST_2ch_modes,
18013 .unsol_event = alc663_m51va_unsol_event,
18014 .setup = alc663_m51va_setup,
18015 .init_hook = alc663_m51va_inithook,
18017 [ALC272_DELL_ZM1] = {
18018 .mixers = { alc663_m51va_mixer },
18019 .cap_mixer = alc662_auto_capture_mixer,
18020 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18021 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18022 .dac_nids = alc662_dac_nids,
18023 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18024 .adc_nids = alc662_adc_nids,
18026 .capsrc_nids = alc662_capsrc_nids,
18027 .channel_mode = alc662_3ST_2ch_modes,
18028 .unsol_event = alc663_m51va_unsol_event,
18029 .setup = alc663_m51va_setup,
18030 .init_hook = alc663_m51va_inithook,
18032 [ALC272_SAMSUNG_NC10] = {
18033 .mixers = { alc272_nc10_mixer },
18034 .init_verbs = { alc662_init_verbs,
18035 alc663_21jd_amic_init_verbs },
18036 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18037 .dac_nids = alc272_dac_nids,
18038 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18039 .channel_mode = alc662_3ST_2ch_modes,
18040 /*.input_mux = &alc272_nc10_capture_source,*/
18041 .unsol_event = alc663_mode4_unsol_event,
18042 .setup = alc663_mode4_setup,
18043 .init_hook = alc663_mode4_inithook,
18049 * BIOS auto configuration
18052 /* convert from MIX nid to DAC */
18053 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18057 else if (nid >= 0x0c && nid <= 0x0e)
18058 return nid - 0x0c + 0x02;
18063 /* get MIX nid connected to the given pin targeted to DAC */
18064 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18070 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18071 for (i = 0; i < num; i++) {
18072 if (alc662_mix_to_dac(mix[i]) == dac)
18078 /* look for an empty DAC slot */
18079 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18081 struct alc_spec *spec = codec->spec;
18085 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18088 for (i = 0; i < num; i++) {
18089 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18092 for (j = 0; j < spec->multiout.num_dacs; j++)
18093 if (spec->multiout.dac_nids[j] == nid)
18095 if (j >= spec->multiout.num_dacs)
18101 /* fill in the dac_nids table from the parsed pin configuration */
18102 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18103 const struct auto_pin_cfg *cfg)
18105 struct alc_spec *spec = codec->spec;
18109 spec->multiout.dac_nids = spec->private_dac_nids;
18110 for (i = 0; i < cfg->line_outs; i++) {
18111 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18114 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18119 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18120 hda_nid_t nid, unsigned int chs)
18122 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18123 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18126 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18127 hda_nid_t nid, unsigned int chs)
18129 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18130 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18133 #define alc662_add_stereo_vol(spec, pfx, nid) \
18134 alc662_add_vol_ctl(spec, pfx, nid, 3)
18135 #define alc662_add_stereo_sw(spec, pfx, nid) \
18136 alc662_add_sw_ctl(spec, pfx, nid, 3)
18138 /* add playback controls from the parsed DAC table */
18139 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18140 const struct auto_pin_cfg *cfg)
18142 struct alc_spec *spec = codec->spec;
18143 static const char *chname[4] = {
18144 "Front", "Surround", NULL /*CLFE*/, "Side"
18146 hda_nid_t nid, mix;
18149 for (i = 0; i < cfg->line_outs; i++) {
18150 nid = spec->multiout.dac_nids[i];
18153 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18158 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18161 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18164 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18167 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18172 if (cfg->line_outs == 1 &&
18173 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18180 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18183 if (cfg->line_outs == 1 &&
18184 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18186 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18194 /* add playback controls for speaker and HP outputs */
18195 /* return DAC nid if any new DAC is assigned */
18196 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18199 struct alc_spec *spec = codec->spec;
18200 hda_nid_t nid, mix;
18205 nid = alc662_look_for_dac(codec, pin);
18207 /* the corresponding DAC is already occupied */
18208 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18209 return 0; /* no way */
18210 /* create a switch only */
18211 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18212 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18215 mix = alc662_dac_to_mix(codec, pin, nid);
18218 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18221 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18227 /* create playback/capture controls for input pins */
18228 #define alc662_auto_create_input_ctls \
18229 alc882_auto_create_input_ctls
18231 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18232 hda_nid_t nid, int pin_type,
18238 alc_set_pin_output(codec, nid, pin_type);
18239 /* need the manual connection? */
18240 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18243 for (i = 0; i < num; i++) {
18244 if (alc662_mix_to_dac(srcs[i]) != dac)
18246 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18251 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18253 struct alc_spec *spec = codec->spec;
18254 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18257 for (i = 0; i <= HDA_SIDE; i++) {
18258 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18260 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18261 spec->multiout.dac_nids[i]);
18265 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18267 struct alc_spec *spec = codec->spec;
18270 pin = spec->autocfg.hp_pins[0];
18272 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18273 spec->multiout.hp_nid);
18274 pin = spec->autocfg.speaker_pins[0];
18276 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18277 spec->multiout.extra_out_nid[0]);
18280 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18282 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18284 struct alc_spec *spec = codec->spec;
18287 for (i = 0; i < AUTO_PIN_LAST; i++) {
18288 hda_nid_t nid = spec->autocfg.input_pins[i];
18289 if (alc_is_input_pin(codec, nid)) {
18290 alc_set_input_pin(codec, nid, i);
18291 if (nid != ALC662_PIN_CD_NID &&
18292 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18293 snd_hda_codec_write(codec, nid, 0,
18294 AC_VERB_SET_AMP_GAIN_MUTE,
18300 #define alc662_auto_init_input_src alc882_auto_init_input_src
18302 static int alc662_parse_auto_config(struct hda_codec *codec)
18304 struct alc_spec *spec = codec->spec;
18306 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18308 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18312 if (!spec->autocfg.line_outs)
18313 return 0; /* can't find valid BIOS pin config */
18315 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18318 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18321 err = alc662_auto_create_extra_out(codec,
18322 spec->autocfg.speaker_pins[0],
18327 spec->multiout.extra_out_nid[0] = err;
18328 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18333 spec->multiout.hp_nid = err;
18334 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18338 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18340 if (spec->autocfg.dig_outs)
18341 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18343 if (spec->kctls.list)
18344 add_mixer(spec, spec->kctls.list);
18346 spec->num_mux_defs = 1;
18347 spec->input_mux = &spec->private_imux[0];
18349 add_verb(spec, alc662_init_verbs);
18350 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18351 codec->vendor_id == 0x10ec0665)
18352 add_verb(spec, alc663_init_verbs);
18354 if (codec->vendor_id == 0x10ec0272)
18355 add_verb(spec, alc272_init_verbs);
18357 err = alc_auto_add_mic_boost(codec);
18361 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18362 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18363 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18365 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18370 /* additional initialization for auto-configuration model */
18371 static void alc662_auto_init(struct hda_codec *codec)
18373 struct alc_spec *spec = codec->spec;
18374 alc662_auto_init_multi_out(codec);
18375 alc662_auto_init_hp_out(codec);
18376 alc662_auto_init_analog_input(codec);
18377 alc662_auto_init_input_src(codec);
18378 if (spec->unsol_event)
18379 alc_inithook(codec);
18382 static int patch_alc662(struct hda_codec *codec)
18384 struct alc_spec *spec;
18385 int err, board_config;
18387 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18391 codec->spec = spec;
18393 alc_auto_parse_customize_define(codec);
18395 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18397 if (alc_read_coef_idx(codec, 0)==0x8020){
18398 kfree(codec->chip_name);
18399 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18400 if (!codec->chip_name) {
18406 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18409 if (board_config < 0) {
18410 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18412 board_config = ALC662_AUTO;
18415 if (board_config == ALC662_AUTO) {
18416 /* automatic parse from the BIOS config */
18417 err = alc662_parse_auto_config(codec);
18423 "hda_codec: Cannot set up configuration "
18424 "from BIOS. Using base mode...\n");
18425 board_config = ALC662_3ST_2ch_DIG;
18429 err = snd_hda_attach_beep_device(codec, 0x1);
18435 if (board_config != ALC662_AUTO)
18436 setup_preset(codec, &alc662_presets[board_config]);
18438 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18439 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18441 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18442 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18444 if (!spec->adc_nids) {
18445 spec->adc_nids = alc662_adc_nids;
18446 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18448 if (!spec->capsrc_nids)
18449 spec->capsrc_nids = alc662_capsrc_nids;
18451 if (!spec->cap_mixer)
18452 set_capture_mixer(codec);
18454 if (spec->cdefine.enable_pcbeep) {
18455 switch (codec->vendor_id) {
18457 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18462 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18465 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18469 spec->vmaster_nid = 0x02;
18471 codec->patch_ops = alc_patch_ops;
18472 if (board_config == ALC662_AUTO)
18473 spec->init_hook = alc662_auto_init;
18474 #ifdef CONFIG_SND_HDA_POWER_SAVE
18475 if (!spec->loopback.amplist)
18476 spec->loopback.amplist = alc662_loopbacks;
18482 static int patch_alc888(struct hda_codec *codec)
18484 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18485 kfree(codec->chip_name);
18486 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18487 if (!codec->chip_name) {
18491 return patch_alc662(codec);
18493 return patch_alc882(codec);
18499 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18500 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18501 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18502 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18503 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18504 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18505 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18506 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18507 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18508 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18509 .patch = patch_alc861 },
18510 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18511 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18512 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18513 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18514 .patch = patch_alc882 },
18515 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18516 .patch = patch_alc662 },
18517 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18518 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18519 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18520 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18521 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18522 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18523 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18524 .patch = patch_alc882 },
18525 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18526 .patch = patch_alc882 },
18527 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18528 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18529 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18530 .patch = patch_alc882 },
18531 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18532 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18533 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18534 {} /* terminator */
18537 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18539 MODULE_LICENSE("GPL");
18540 MODULE_DESCRIPTION("Realtek HD-audio codec");
18542 static struct hda_codec_preset_list realtek_list = {
18543 .preset = snd_hda_preset_realtek,
18544 .owner = THIS_MODULE,
18547 static int __init patch_realtek_init(void)
18549 return snd_hda_add_codec_preset(&realtek_list);
18552 static void __exit patch_realtek_exit(void)
18554 snd_hda_delete_codec_preset(&realtek_list);
18557 module_init(patch_realtek_init)
18558 module_exit(patch_realtek_exit)