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 /* Route to built-in subwoofer as well as speakers */
1694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1696 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1697 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1698 /* Bias voltage on for external mic port */
1699 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1700 /* Front Mic: set to PIN_IN (empty by default) */
1701 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1702 /* Unselect Front Mic by default in input mixer 3 */
1703 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1704 /* Enable unsolicited event for HP jack */
1705 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1706 /* Enable speaker output */
1707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1708 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1709 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1710 /* Enable headphone output */
1711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1713 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1714 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1719 * ALC889 Acer Aspire 8930G model
1722 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1723 /* Front Mic: set to PIN_IN (empty by default) */
1724 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1725 /* Unselect Front Mic by default in input mixer 3 */
1726 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1727 /* Enable unsolicited event for HP jack */
1728 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1729 /* Connect Internal Front to Front */
1730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1731 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1732 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1733 /* Connect Internal Rear to Rear */
1734 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1735 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1736 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1737 /* Connect Internal CLFE to CLFE */
1738 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1739 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1740 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1741 /* Connect HP out to Front */
1742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1744 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1745 /* Enable all DACs */
1746 /* DAC DISABLE/MUTE 1? */
1747 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1748 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1749 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1750 /* DAC DISABLE/MUTE 2? */
1751 /* some bit here disables the other DACs. Init=0x4900 */
1752 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1753 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1755 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1756 * which makes the stereo useless. However, either the mic or the ALC889
1757 * makes the signal become a difference/sum signal instead of standard
1758 * stereo, which is annoying. So instead we flip this bit which makes the
1759 * codec replicate the sum signal to both channels, turning it into a
1762 /* DMIC_CONTROL? Init value = 0x0001 */
1763 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1764 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1768 static struct hda_input_mux alc888_2_capture_sources[2] = {
1769 /* Front mic only available on one ADC */
1776 { "Front Mic", 0xb },
1789 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1790 /* Interal mic only available on one ADC */
1797 { "Input Mix", 0xa },
1807 { "Input Mix", 0xa },
1812 static struct hda_input_mux alc889_capture_sources[3] = {
1813 /* Digital mic only available on first "ADC" */
1820 { "Front Mic", 0xb },
1821 { "Input Mix", 0xa },
1830 { "Input Mix", 0xa },
1839 { "Input Mix", 0xa },
1844 static struct snd_kcontrol_new alc888_base_mixer[] = {
1845 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1846 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1847 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1848 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1849 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1851 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1852 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1853 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1854 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1855 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1856 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1857 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1858 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1859 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1861 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1866 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1867 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1868 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1869 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1870 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1871 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1873 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1874 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1875 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1879 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1885 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1887 struct alc_spec *spec = codec->spec;
1889 spec->autocfg.hp_pins[0] = 0x15;
1890 spec->autocfg.speaker_pins[0] = 0x14;
1891 spec->autocfg.speaker_pins[1] = 0x16;
1892 spec->autocfg.speaker_pins[2] = 0x17;
1895 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1897 struct alc_spec *spec = codec->spec;
1899 spec->autocfg.hp_pins[0] = 0x15;
1900 spec->autocfg.speaker_pins[0] = 0x14;
1901 spec->autocfg.speaker_pins[1] = 0x16;
1902 spec->autocfg.speaker_pins[2] = 0x17;
1905 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1907 struct alc_spec *spec = codec->spec;
1909 spec->autocfg.hp_pins[0] = 0x15;
1910 spec->autocfg.speaker_pins[0] = 0x14;
1911 spec->autocfg.speaker_pins[1] = 0x16;
1912 spec->autocfg.speaker_pins[2] = 0x1b;
1916 * ALC880 3-stack model
1918 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1919 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1920 * F-Mic = 0x1b, HP = 0x19
1923 static hda_nid_t alc880_dac_nids[4] = {
1924 /* front, rear, clfe, rear_surr */
1925 0x02, 0x05, 0x04, 0x03
1928 static hda_nid_t alc880_adc_nids[3] = {
1933 /* The datasheet says the node 0x07 is connected from inputs,
1934 * but it shows zero connection in the real implementation on some devices.
1935 * Note: this is a 915GAV bug, fixed on 915GLV
1937 static hda_nid_t alc880_adc_nids_alt[2] = {
1942 #define ALC880_DIGOUT_NID 0x06
1943 #define ALC880_DIGIN_NID 0x0a
1945 static struct hda_input_mux alc880_capture_source = {
1949 { "Front Mic", 0x3 },
1955 /* channel source setting (2/6 channel selection for 3-stack) */
1957 static struct hda_verb alc880_threestack_ch2_init[] = {
1958 /* set line-in to input, mute it */
1959 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1960 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1961 /* set mic-in to input vref 80%, mute it */
1962 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1963 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1968 static struct hda_verb alc880_threestack_ch6_init[] = {
1969 /* set line-in to output, unmute it */
1970 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1971 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1972 /* set mic-in to output, unmute it */
1973 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1974 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1978 static struct hda_channel_mode alc880_threestack_modes[2] = {
1979 { 2, alc880_threestack_ch2_init },
1980 { 6, alc880_threestack_ch6_init },
1983 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1984 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1985 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1986 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1987 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1988 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1989 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1990 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1991 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1992 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1993 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1994 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1995 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1998 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1999 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2002 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2003 .name = "Channel Mode",
2004 .info = alc_ch_mode_info,
2005 .get = alc_ch_mode_get,
2006 .put = alc_ch_mode_put,
2011 /* capture mixer elements */
2012 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2013 struct snd_ctl_elem_info *uinfo)
2015 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2016 struct alc_spec *spec = codec->spec;
2019 mutex_lock(&codec->control_mutex);
2020 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2022 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2023 mutex_unlock(&codec->control_mutex);
2027 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2028 unsigned int size, unsigned int __user *tlv)
2030 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2031 struct alc_spec *spec = codec->spec;
2034 mutex_lock(&codec->control_mutex);
2035 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2037 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2038 mutex_unlock(&codec->control_mutex);
2042 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2043 struct snd_ctl_elem_value *ucontrol);
2045 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2046 struct snd_ctl_elem_value *ucontrol,
2049 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2050 struct alc_spec *spec = codec->spec;
2051 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2054 mutex_lock(&codec->control_mutex);
2055 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2057 err = func(kcontrol, ucontrol);
2058 mutex_unlock(&codec->control_mutex);
2062 static int alc_cap_vol_get(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_get);
2069 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2070 struct snd_ctl_elem_value *ucontrol)
2072 return alc_cap_getput_caller(kcontrol, ucontrol,
2073 snd_hda_mixer_amp_volume_put);
2076 /* capture mixer elements */
2077 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2079 static int alc_cap_sw_get(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_get);
2086 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2087 struct snd_ctl_elem_value *ucontrol)
2089 return alc_cap_getput_caller(kcontrol, ucontrol,
2090 snd_hda_mixer_amp_switch_put);
2093 #define _DEFINE_CAPMIX(num) \
2095 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2096 .name = "Capture Switch", \
2097 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2099 .info = alc_cap_sw_info, \
2100 .get = alc_cap_sw_get, \
2101 .put = alc_cap_sw_put, \
2104 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2105 .name = "Capture Volume", \
2106 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2107 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2108 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2110 .info = alc_cap_vol_info, \
2111 .get = alc_cap_vol_get, \
2112 .put = alc_cap_vol_put, \
2113 .tlv = { .c = alc_cap_vol_tlv }, \
2116 #define _DEFINE_CAPSRC(num) \
2118 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2119 /* .name = "Capture Source", */ \
2120 .name = "Input Source", \
2122 .info = alc_mux_enum_info, \
2123 .get = alc_mux_enum_get, \
2124 .put = alc_mux_enum_put, \
2127 #define DEFINE_CAPMIX(num) \
2128 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2129 _DEFINE_CAPMIX(num), \
2130 _DEFINE_CAPSRC(num), \
2134 #define DEFINE_CAPMIX_NOSRC(num) \
2135 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2136 _DEFINE_CAPMIX(num), \
2140 /* up to three ADCs */
2144 DEFINE_CAPMIX_NOSRC(1);
2145 DEFINE_CAPMIX_NOSRC(2);
2146 DEFINE_CAPMIX_NOSRC(3);
2149 * ALC880 5-stack model
2151 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2153 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2154 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2157 /* additional mixers to alc880_three_stack_mixer */
2158 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2159 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2160 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2164 /* channel source setting (6/8 channel selection for 5-stack) */
2166 static struct hda_verb alc880_fivestack_ch6_init[] = {
2167 /* set line-in to input, mute it */
2168 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2169 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2174 static struct hda_verb alc880_fivestack_ch8_init[] = {
2175 /* set line-in to output, unmute it */
2176 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2177 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2181 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2182 { 6, alc880_fivestack_ch6_init },
2183 { 8, alc880_fivestack_ch8_init },
2188 * ALC880 6-stack model
2190 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2191 * Side = 0x05 (0x0f)
2192 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2193 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2196 static hda_nid_t alc880_6st_dac_nids[4] = {
2197 /* front, rear, clfe, rear_surr */
2198 0x02, 0x03, 0x04, 0x05
2201 static struct hda_input_mux alc880_6stack_capture_source = {
2205 { "Front Mic", 0x1 },
2211 /* fixed 8-channels */
2212 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2216 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2217 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2220 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2221 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2222 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2223 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2224 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2225 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2226 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2227 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2228 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2229 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2230 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2233 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2234 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2236 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2237 .name = "Channel Mode",
2238 .info = alc_ch_mode_info,
2239 .get = alc_ch_mode_get,
2240 .put = alc_ch_mode_put,
2249 * W810 has rear IO for:
2252 * Center/LFE (DAC 04)
2255 * The system also has a pair of internal speakers, and a headphone jack.
2256 * These are both connected to Line2 on the codec, hence to DAC 02.
2258 * There is a variable resistor to control the speaker or headphone
2259 * volume. This is a hardware-only device without a software API.
2261 * Plugging headphones in will disable the internal speakers. This is
2262 * implemented in hardware, not via the driver using jack sense. In
2263 * a similar fashion, plugging into the rear socket marked "front" will
2264 * disable both the speakers and headphones.
2266 * For input, there's a microphone jack, and an "audio in" jack.
2267 * These may not do anything useful with this driver yet, because I
2268 * haven't setup any initialization verbs for these yet...
2271 static hda_nid_t alc880_w810_dac_nids[3] = {
2272 /* front, rear/surround, clfe */
2276 /* fixed 6 channels */
2277 static struct hda_channel_mode alc880_w810_modes[1] = {
2281 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2282 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2283 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2284 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2285 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2286 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2287 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2288 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2289 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2290 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2291 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2299 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2300 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2304 static hda_nid_t alc880_z71v_dac_nids[1] = {
2307 #define ALC880_Z71V_HP_DAC 0x03
2309 /* fixed 2 channels */
2310 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2314 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2315 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2316 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2317 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2318 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2319 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2320 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2328 * ALC880 F1734 model
2330 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2331 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2334 static hda_nid_t alc880_f1734_dac_nids[1] = {
2337 #define ALC880_F1734_HP_DAC 0x02
2339 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2340 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2341 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2342 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2343 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2344 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2345 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2351 static struct hda_input_mux alc880_f1734_capture_source = {
2363 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2364 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2365 * Mic = 0x18, Line = 0x1a
2368 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2369 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2371 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2372 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2373 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2374 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2375 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2376 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2377 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2378 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2379 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2380 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2381 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2385 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2388 .name = "Channel Mode",
2389 .info = alc_ch_mode_info,
2390 .get = alc_ch_mode_get,
2391 .put = alc_ch_mode_put,
2397 * ALC880 ASUS W1V model
2399 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2400 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2401 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2404 /* additional mixers to alc880_asus_mixer */
2405 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2406 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2407 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2412 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2413 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2414 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2415 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2416 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2417 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2420 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2421 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2426 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2427 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2428 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2429 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2430 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2431 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2432 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2433 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2434 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2435 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2436 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2437 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2438 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2441 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2442 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2444 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2445 .name = "Channel Mode",
2446 .info = alc_ch_mode_info,
2447 .get = alc_ch_mode_get,
2448 .put = alc_ch_mode_put,
2453 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2454 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2455 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2456 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2457 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2458 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2459 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2460 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2461 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2462 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2463 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2467 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2468 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2469 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2470 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2471 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2473 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2478 * virtual master controls
2482 * slave controls for virtual master
2484 static const char *alc_slave_vols[] = {
2485 "Front Playback Volume",
2486 "Surround Playback Volume",
2487 "Center Playback Volume",
2488 "LFE Playback Volume",
2489 "Side Playback Volume",
2490 "Headphone Playback Volume",
2491 "Speaker Playback Volume",
2492 "Mono Playback Volume",
2493 "Line-Out Playback Volume",
2494 "PCM Playback Volume",
2498 static const char *alc_slave_sws[] = {
2499 "Front Playback Switch",
2500 "Surround Playback Switch",
2501 "Center Playback Switch",
2502 "LFE Playback Switch",
2503 "Side Playback Switch",
2504 "Headphone Playback Switch",
2505 "Speaker Playback Switch",
2506 "Mono Playback Switch",
2507 "IEC958 Playback Switch",
2508 "Line-Out Playback Switch",
2509 "PCM Playback Switch",
2514 * build control elements
2517 #define NID_MAPPING (-1)
2519 #define SUBDEV_SPEAKER_ (0 << 6)
2520 #define SUBDEV_HP_ (1 << 6)
2521 #define SUBDEV_LINE_ (2 << 6)
2522 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2523 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2524 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2526 static void alc_free_kctls(struct hda_codec *codec);
2528 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2529 /* additional beep mixers; the actual parameters are overwritten at build */
2530 static struct snd_kcontrol_new alc_beep_mixer[] = {
2531 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2532 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2537 static int alc_build_controls(struct hda_codec *codec)
2539 struct alc_spec *spec = codec->spec;
2540 struct snd_kcontrol *kctl;
2541 struct snd_kcontrol_new *knew;
2546 for (i = 0; i < spec->num_mixers; i++) {
2547 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2551 if (spec->cap_mixer) {
2552 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2556 if (spec->multiout.dig_out_nid) {
2557 err = snd_hda_create_spdif_out_ctls(codec,
2558 spec->multiout.dig_out_nid);
2561 if (!spec->no_analog) {
2562 err = snd_hda_create_spdif_share_sw(codec,
2566 spec->multiout.share_spdif = 1;
2569 if (spec->dig_in_nid) {
2570 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2575 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2576 /* create beep controls if needed */
2577 if (spec->beep_amp) {
2578 struct snd_kcontrol_new *knew;
2579 for (knew = alc_beep_mixer; knew->name; knew++) {
2580 struct snd_kcontrol *kctl;
2581 kctl = snd_ctl_new1(knew, codec);
2584 kctl->private_value = spec->beep_amp;
2585 err = snd_hda_ctl_add(codec, 0, kctl);
2592 /* if we have no master control, let's create it */
2593 if (!spec->no_analog &&
2594 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2595 unsigned int vmaster_tlv[4];
2596 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2597 HDA_OUTPUT, vmaster_tlv);
2598 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2599 vmaster_tlv, alc_slave_vols);
2603 if (!spec->no_analog &&
2604 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2605 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2606 NULL, alc_slave_sws);
2611 /* assign Capture Source enums to NID */
2612 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2614 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2615 for (i = 0; kctl && i < kctl->count; i++) {
2616 hda_nid_t *nids = spec->capsrc_nids;
2618 nids = spec->adc_nids;
2619 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2623 if (spec->cap_mixer) {
2624 const char *kname = kctl ? kctl->id.name : NULL;
2625 for (knew = spec->cap_mixer; knew->name; knew++) {
2626 if (kname && strcmp(knew->name, kname) == 0)
2628 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2629 for (i = 0; kctl && i < kctl->count; i++) {
2630 err = snd_hda_add_nid(codec, kctl, i,
2638 /* other nid->control mapping */
2639 for (i = 0; i < spec->num_mixers; i++) {
2640 for (knew = spec->mixers[i]; knew->name; knew++) {
2641 if (knew->iface != NID_MAPPING)
2643 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2646 u = knew->subdevice;
2647 for (j = 0; j < 4; j++, u >>= 8) {
2652 case SUBDEV_SPEAKER_:
2653 nid = spec->autocfg.speaker_pins[nid];
2656 nid = spec->autocfg.line_out_pins[nid];
2659 nid = spec->autocfg.hp_pins[nid];
2664 err = snd_hda_add_nid(codec, kctl, 0, nid);
2668 u = knew->private_value;
2669 for (j = 0; j < 4; j++, u >>= 8) {
2673 err = snd_hda_add_nid(codec, kctl, 0, nid);
2680 alc_free_kctls(codec); /* no longer needed */
2687 * initialize the codec volumes, etc
2691 * generic initialization of ADC, input mixers and output mixers
2693 static struct hda_verb alc880_volume_init_verbs[] = {
2695 * Unmute ADC0-2 and set the default input to mic-in
2697 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2699 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2700 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2701 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2704 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2706 * Note: PASD motherboards uses the Line In 2 as the input for front
2709 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2714 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2716 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2719 * Set up output mixers (0x0c - 0x0f)
2721 /* set vol=0 to output mixers */
2722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2724 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2725 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2726 /* set up input amps for analog loopback */
2727 /* Amp Indices: DAC = 0, mixer = 1 */
2728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2730 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2731 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2732 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2733 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2734 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2735 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2741 * 3-stack pin configuration:
2742 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2744 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2746 * preset connection lists of input pins
2747 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2749 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2750 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2751 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2754 * Set pin mode and muting
2756 /* set front pin widgets 0x14 for output */
2757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2759 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2760 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2761 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2762 /* Mic2 (as headphone out) for HP output */
2763 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2764 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2765 /* Line In pin widget for input */
2766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2767 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2768 /* Line2 (as front mic) pin widget for input and vref at 80% */
2769 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2770 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2771 /* CD pin widget for input */
2772 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2778 * 5-stack pin configuration:
2779 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2780 * line-in/side = 0x1a, f-mic = 0x1b
2782 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2784 * preset connection lists of input pins
2785 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2787 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2788 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2791 * Set pin mode and muting
2793 /* set pin widgets 0x14-0x17 for output */
2794 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2795 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2796 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2797 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2798 /* unmute pins for output (no gain on this amp) */
2799 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2801 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2802 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2804 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2805 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2806 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2807 /* Mic2 (as headphone out) for HP output */
2808 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2809 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 /* Line In pin widget for input */
2811 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2812 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2813 /* Line2 (as front mic) pin widget for input and vref at 80% */
2814 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2815 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2816 /* CD pin widget for input */
2817 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2823 * W810 pin configuration:
2824 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2826 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2827 /* hphone/speaker input selector: front DAC */
2828 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2830 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2831 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2833 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2834 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2835 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2837 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2838 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2844 * Z71V pin configuration:
2845 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2847 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2848 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2849 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2850 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2853 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2854 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2855 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2856 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2862 * 6-stack pin configuration:
2863 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2864 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2866 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2867 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2870 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2871 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2873 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2874 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2875 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2876 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2878 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2879 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2880 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2881 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2882 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2884 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2885 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2886 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2892 * Uniwill pin configuration:
2893 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2896 static struct hda_verb alc880_uniwill_init_verbs[] = {
2897 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2899 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2900 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2902 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2903 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2904 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2905 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2906 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2914 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2915 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2916 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2917 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2918 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2919 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2920 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2921 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2922 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2924 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2925 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2932 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2934 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2935 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2939 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2941 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2942 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2945 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2947 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2948 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2950 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2951 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2952 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2953 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2954 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2955 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2957 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2958 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2963 static struct hda_verb alc880_beep_init_verbs[] = {
2964 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2968 /* auto-toggle front mic */
2969 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2971 unsigned int present;
2974 present = snd_hda_jack_detect(codec, 0x18);
2975 bits = present ? HDA_AMP_MUTE : 0;
2976 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2979 static void alc880_uniwill_setup(struct hda_codec *codec)
2981 struct alc_spec *spec = codec->spec;
2983 spec->autocfg.hp_pins[0] = 0x14;
2984 spec->autocfg.speaker_pins[0] = 0x15;
2985 spec->autocfg.speaker_pins[0] = 0x16;
2988 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2990 alc_automute_amp(codec);
2991 alc880_uniwill_mic_automute(codec);
2994 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2997 /* Looks like the unsol event is incompatible with the standard
2998 * definition. 4bit tag is placed at 28 bit!
3000 switch (res >> 28) {
3001 case ALC880_MIC_EVENT:
3002 alc880_uniwill_mic_automute(codec);
3005 alc_automute_amp_unsol_event(codec, res);
3010 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3012 struct alc_spec *spec = codec->spec;
3014 spec->autocfg.hp_pins[0] = 0x14;
3015 spec->autocfg.speaker_pins[0] = 0x15;
3018 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3020 unsigned int present;
3022 present = snd_hda_codec_read(codec, 0x21, 0,
3023 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3024 present &= HDA_AMP_VOLMASK;
3025 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3026 HDA_AMP_VOLMASK, present);
3027 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3028 HDA_AMP_VOLMASK, present);
3031 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3034 /* Looks like the unsol event is incompatible with the standard
3035 * definition. 4bit tag is placed at 28 bit!
3037 if ((res >> 28) == ALC880_DCVOL_EVENT)
3038 alc880_uniwill_p53_dcvol_automute(codec);
3040 alc_automute_amp_unsol_event(codec, res);
3044 * F1734 pin configuration:
3045 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3047 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3048 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3049 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3050 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3051 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3052 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3054 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3055 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3059 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3060 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3061 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3062 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3063 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3064 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3065 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3066 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3067 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3069 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3070 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3076 * ASUS pin configuration:
3077 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3079 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3080 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3081 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3082 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3083 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3085 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3086 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3088 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3089 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3090 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3091 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3092 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3094 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3095 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3096 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3097 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3098 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3099 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3100 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3101 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3102 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3107 /* Enable GPIO mask and set output */
3108 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3109 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3110 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3112 /* Clevo m520g init */
3113 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3114 /* headphone output */
3115 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3117 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3118 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3120 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3121 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3123 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3124 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3125 /* Mic1 (rear panel) */
3126 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3127 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3128 /* Mic2 (front panel) */
3129 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3130 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3132 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3133 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3134 /* change to EAPD mode */
3135 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3136 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3141 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3142 /* change to EAPD mode */
3143 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3144 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3146 /* Headphone output */
3147 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3149 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3150 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3152 /* Line In pin widget for input */
3153 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3154 /* CD pin widget for input */
3155 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3156 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3157 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3159 /* change to EAPD mode */
3160 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3161 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3167 * LG m1 express dual
3170 * Rear Line-In/Out (blue): 0x14
3171 * Build-in Mic-In: 0x15
3173 * HP-Out (green): 0x1b
3174 * Mic-In/Out (red): 0x19
3178 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3179 static hda_nid_t alc880_lg_dac_nids[3] = {
3183 /* seems analog CD is not working */
3184 static struct hda_input_mux alc880_lg_capture_source = {
3189 { "Internal Mic", 0x6 },
3193 /* 2,4,6 channel modes */
3194 static struct hda_verb alc880_lg_ch2_init[] = {
3195 /* set line-in and mic-in to input */
3196 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3197 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3201 static struct hda_verb alc880_lg_ch4_init[] = {
3202 /* set line-in to out and mic-in to input */
3203 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3204 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3208 static struct hda_verb alc880_lg_ch6_init[] = {
3209 /* set line-in and mic-in to output */
3210 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3211 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3215 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3216 { 2, alc880_lg_ch2_init },
3217 { 4, alc880_lg_ch4_init },
3218 { 6, alc880_lg_ch6_init },
3221 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3223 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3225 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3226 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3228 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3229 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3232 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3233 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3234 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3235 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3237 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3238 .name = "Channel Mode",
3239 .info = alc_ch_mode_info,
3240 .get = alc_ch_mode_get,
3241 .put = alc_ch_mode_put,
3246 static struct hda_verb alc880_lg_init_verbs[] = {
3247 /* set capture source to mic-in */
3248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3250 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3251 /* mute all amp mixer inputs */
3252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3255 /* line-in to input */
3256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3257 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3263 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3264 /* mic-in to input */
3265 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3266 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3269 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3270 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3271 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3273 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3277 /* toggle speaker-output according to the hp-jack state */
3278 static void alc880_lg_setup(struct hda_codec *codec)
3280 struct alc_spec *spec = codec->spec;
3282 spec->autocfg.hp_pins[0] = 0x1b;
3283 spec->autocfg.speaker_pins[0] = 0x17;
3292 * Built-in Mic-In: 0x19
3298 static struct hda_input_mux alc880_lg_lw_capture_source = {
3302 { "Internal Mic", 0x1 },
3307 #define alc880_lg_lw_modes alc880_threestack_modes
3309 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3310 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3311 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3312 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3313 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3314 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3315 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3316 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3317 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3319 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3322 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3323 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3325 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3326 .name = "Channel Mode",
3327 .info = alc_ch_mode_info,
3328 .get = alc_ch_mode_get,
3329 .put = alc_ch_mode_put,
3334 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3335 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3336 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3337 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3339 /* set capture source to mic-in */
3340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3343 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3345 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3346 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3348 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3349 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3350 /* mic-in to input */
3351 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3354 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3355 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3357 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3361 /* toggle speaker-output according to the hp-jack state */
3362 static void alc880_lg_lw_setup(struct hda_codec *codec)
3364 struct alc_spec *spec = codec->spec;
3366 spec->autocfg.hp_pins[0] = 0x1b;
3367 spec->autocfg.speaker_pins[0] = 0x14;
3370 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3371 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3372 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3374 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3375 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3376 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3380 static struct hda_input_mux alc880_medion_rim_capture_source = {
3384 { "Internal Mic", 0x1 },
3388 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3389 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3391 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3392 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3394 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3395 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3396 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3397 /* Mic2 (as headphone out) for HP output */
3398 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3399 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3400 /* Internal Speaker */
3401 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3402 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3404 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3405 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3407 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3411 /* toggle speaker-output according to the hp-jack state */
3412 static void alc880_medion_rim_automute(struct hda_codec *codec)
3414 struct alc_spec *spec = codec->spec;
3415 alc_automute_amp(codec);
3417 if (spec->jack_present)
3418 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3420 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3423 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3426 /* Looks like the unsol event is incompatible with the standard
3427 * definition. 4bit tag is placed at 28 bit!
3429 if ((res >> 28) == ALC880_HP_EVENT)
3430 alc880_medion_rim_automute(codec);
3433 static void alc880_medion_rim_setup(struct hda_codec *codec)
3435 struct alc_spec *spec = codec->spec;
3437 spec->autocfg.hp_pins[0] = 0x14;
3438 spec->autocfg.speaker_pins[0] = 0x1b;
3441 #ifdef CONFIG_SND_HDA_POWER_SAVE
3442 static struct hda_amp_list alc880_loopbacks[] = {
3443 { 0x0b, HDA_INPUT, 0 },
3444 { 0x0b, HDA_INPUT, 1 },
3445 { 0x0b, HDA_INPUT, 2 },
3446 { 0x0b, HDA_INPUT, 3 },
3447 { 0x0b, HDA_INPUT, 4 },
3451 static struct hda_amp_list alc880_lg_loopbacks[] = {
3452 { 0x0b, HDA_INPUT, 1 },
3453 { 0x0b, HDA_INPUT, 6 },
3454 { 0x0b, HDA_INPUT, 7 },
3463 static int alc_init(struct hda_codec *codec)
3465 struct alc_spec *spec = codec->spec;
3469 alc_auto_init_amp(codec, spec->init_amp);
3471 for (i = 0; i < spec->num_init_verbs; i++)
3472 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3474 if (spec->init_hook)
3475 spec->init_hook(codec);
3477 #ifdef CONFIG_SND_HDA_POWER_SAVE
3478 if (codec->patch_ops.check_power_status)
3479 codec->patch_ops.check_power_status(codec, 0x01);
3484 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3486 struct alc_spec *spec = codec->spec;
3488 if (spec->unsol_event)
3489 spec->unsol_event(codec, res);
3492 #ifdef CONFIG_SND_HDA_POWER_SAVE
3493 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3495 struct alc_spec *spec = codec->spec;
3496 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3501 * Analog playback callbacks
3503 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3504 struct hda_codec *codec,
3505 struct snd_pcm_substream *substream)
3507 struct alc_spec *spec = codec->spec;
3508 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3512 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3513 struct hda_codec *codec,
3514 unsigned int stream_tag,
3515 unsigned int format,
3516 struct snd_pcm_substream *substream)
3518 struct alc_spec *spec = codec->spec;
3519 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3520 stream_tag, format, substream);
3523 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3524 struct hda_codec *codec,
3525 struct snd_pcm_substream *substream)
3527 struct alc_spec *spec = codec->spec;
3528 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3534 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3535 struct hda_codec *codec,
3536 struct snd_pcm_substream *substream)
3538 struct alc_spec *spec = codec->spec;
3539 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3542 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3543 struct hda_codec *codec,
3544 unsigned int stream_tag,
3545 unsigned int format,
3546 struct snd_pcm_substream *substream)
3548 struct alc_spec *spec = codec->spec;
3549 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3550 stream_tag, format, substream);
3553 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3554 struct hda_codec *codec,
3555 struct snd_pcm_substream *substream)
3557 struct alc_spec *spec = codec->spec;
3558 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3561 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3562 struct hda_codec *codec,
3563 struct snd_pcm_substream *substream)
3565 struct alc_spec *spec = codec->spec;
3566 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3572 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3573 struct hda_codec *codec,
3574 unsigned int stream_tag,
3575 unsigned int format,
3576 struct snd_pcm_substream *substream)
3578 struct alc_spec *spec = codec->spec;
3580 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3581 stream_tag, 0, format);
3585 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3586 struct hda_codec *codec,
3587 struct snd_pcm_substream *substream)
3589 struct alc_spec *spec = codec->spec;
3591 snd_hda_codec_cleanup_stream(codec,
3592 spec->adc_nids[substream->number + 1]);
3599 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3603 /* NID is set in alc_build_pcms */
3605 .open = alc880_playback_pcm_open,
3606 .prepare = alc880_playback_pcm_prepare,
3607 .cleanup = alc880_playback_pcm_cleanup
3611 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3615 /* NID is set in alc_build_pcms */
3618 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3622 /* NID is set in alc_build_pcms */
3625 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3626 .substreams = 2, /* can be overridden */
3629 /* NID is set in alc_build_pcms */
3631 .prepare = alc880_alt_capture_pcm_prepare,
3632 .cleanup = alc880_alt_capture_pcm_cleanup
3636 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3640 /* NID is set in alc_build_pcms */
3642 .open = alc880_dig_playback_pcm_open,
3643 .close = alc880_dig_playback_pcm_close,
3644 .prepare = alc880_dig_playback_pcm_prepare,
3645 .cleanup = alc880_dig_playback_pcm_cleanup
3649 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3653 /* NID is set in alc_build_pcms */
3656 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3657 static struct hda_pcm_stream alc_pcm_null_stream = {
3663 static int alc_build_pcms(struct hda_codec *codec)
3665 struct alc_spec *spec = codec->spec;
3666 struct hda_pcm *info = spec->pcm_rec;
3669 codec->num_pcms = 1;
3670 codec->pcm_info = info;
3672 if (spec->no_analog)
3675 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3676 "%s Analog", codec->chip_name);
3677 info->name = spec->stream_name_analog;
3679 if (spec->stream_analog_playback) {
3680 if (snd_BUG_ON(!spec->multiout.dac_nids))
3682 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3683 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3685 if (spec->stream_analog_capture) {
3686 if (snd_BUG_ON(!spec->adc_nids))
3688 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3689 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3692 if (spec->channel_mode) {
3693 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3694 for (i = 0; i < spec->num_channel_mode; i++) {
3695 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3696 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3702 /* SPDIF for stream index #1 */
3703 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3704 snprintf(spec->stream_name_digital,
3705 sizeof(spec->stream_name_digital),
3706 "%s Digital", codec->chip_name);
3707 codec->num_pcms = 2;
3708 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3709 info = spec->pcm_rec + 1;
3710 info->name = spec->stream_name_digital;
3711 if (spec->dig_out_type)
3712 info->pcm_type = spec->dig_out_type;
3714 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3715 if (spec->multiout.dig_out_nid &&
3716 spec->stream_digital_playback) {
3717 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3718 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3720 if (spec->dig_in_nid &&
3721 spec->stream_digital_capture) {
3722 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3723 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3725 /* FIXME: do we need this for all Realtek codec models? */
3726 codec->spdif_status_reset = 1;
3729 if (spec->no_analog)
3732 /* If the use of more than one ADC is requested for the current
3733 * model, configure a second analog capture-only PCM.
3735 /* Additional Analaog capture for index #2 */
3736 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3737 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3738 codec->num_pcms = 3;
3739 info = spec->pcm_rec + 2;
3740 info->name = spec->stream_name_analog;
3741 if (spec->alt_dac_nid) {
3742 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3743 *spec->stream_analog_alt_playback;
3744 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3747 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3748 alc_pcm_null_stream;
3749 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3751 if (spec->num_adc_nids > 1) {
3752 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3753 *spec->stream_analog_alt_capture;
3754 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3756 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3757 spec->num_adc_nids - 1;
3759 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3760 alc_pcm_null_stream;
3761 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3768 static inline void alc_shutup(struct hda_codec *codec)
3770 snd_hda_shutup_pins(codec);
3773 static void alc_free_kctls(struct hda_codec *codec)
3775 struct alc_spec *spec = codec->spec;
3777 if (spec->kctls.list) {
3778 struct snd_kcontrol_new *kctl = spec->kctls.list;
3780 for (i = 0; i < spec->kctls.used; i++)
3781 kfree(kctl[i].name);
3783 snd_array_free(&spec->kctls);
3786 static void alc_free(struct hda_codec *codec)
3788 struct alc_spec *spec = codec->spec;
3794 alc_free_kctls(codec);
3796 snd_hda_detach_beep_device(codec);
3799 #ifdef CONFIG_SND_HDA_POWER_SAVE
3800 static void alc_power_eapd(struct hda_codec *codec)
3802 /* We currently only handle front, HP */
3803 switch (codec->vendor_id) {
3805 set_eapd(codec, 0x0f, 0);
3806 set_eapd(codec, 0x10, 0);
3819 set_eapd(codec, 0x14, 0);
3820 set_eapd(codec, 0x15, 0);
3825 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3827 struct alc_spec *spec = codec->spec;
3829 if (spec && spec->power_hook)
3830 spec->power_hook(codec);
3835 #ifdef SND_HDA_NEEDS_RESUME
3836 static int alc_resume(struct hda_codec *codec)
3838 codec->patch_ops.init(codec);
3839 snd_hda_codec_resume_amp(codec);
3840 snd_hda_codec_resume_cache(codec);
3841 #ifdef CONFIG_SND_HDA_POWER_SAVE
3842 if (codec->patch_ops.check_power_status)
3843 codec->patch_ops.check_power_status(codec, 0x01);
3851 static struct hda_codec_ops alc_patch_ops = {
3852 .build_controls = alc_build_controls,
3853 .build_pcms = alc_build_pcms,
3856 .unsol_event = alc_unsol_event,
3857 #ifdef SND_HDA_NEEDS_RESUME
3858 .resume = alc_resume,
3860 #ifdef CONFIG_SND_HDA_POWER_SAVE
3861 .suspend = alc_suspend,
3862 .check_power_status = alc_check_power_status,
3864 .reboot_notify = alc_shutup,
3867 /* replace the codec chip_name with the given string */
3868 static int alc_codec_rename(struct hda_codec *codec, const char *name)
3870 kfree(codec->chip_name);
3871 codec->chip_name = kstrdup(name, GFP_KERNEL);
3872 if (!codec->chip_name) {
3880 * Test configuration for debugging
3882 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3885 #ifdef CONFIG_SND_DEBUG
3886 static hda_nid_t alc880_test_dac_nids[4] = {
3887 0x02, 0x03, 0x04, 0x05
3890 static struct hda_input_mux alc880_test_capture_source = {
3899 { "Surround", 0x6 },
3903 static struct hda_channel_mode alc880_test_modes[4] = {
3910 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3911 struct snd_ctl_elem_info *uinfo)
3913 static char *texts[] = {
3914 "N/A", "Line Out", "HP Out",
3915 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3917 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3919 uinfo->value.enumerated.items = 8;
3920 if (uinfo->value.enumerated.item >= 8)
3921 uinfo->value.enumerated.item = 7;
3922 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3926 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3927 struct snd_ctl_elem_value *ucontrol)
3929 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3930 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3931 unsigned int pin_ctl, item = 0;
3933 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3934 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3935 if (pin_ctl & AC_PINCTL_OUT_EN) {
3936 if (pin_ctl & AC_PINCTL_HP_EN)
3940 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3941 switch (pin_ctl & AC_PINCTL_VREFEN) {
3942 case AC_PINCTL_VREF_HIZ: item = 3; break;
3943 case AC_PINCTL_VREF_50: item = 4; break;
3944 case AC_PINCTL_VREF_GRD: item = 5; break;
3945 case AC_PINCTL_VREF_80: item = 6; break;
3946 case AC_PINCTL_VREF_100: item = 7; break;
3949 ucontrol->value.enumerated.item[0] = item;
3953 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3954 struct snd_ctl_elem_value *ucontrol)
3956 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3957 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3958 static unsigned int ctls[] = {
3959 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3960 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3961 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3962 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3963 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3964 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3966 unsigned int old_ctl, new_ctl;
3968 old_ctl = snd_hda_codec_read(codec, nid, 0,
3969 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3970 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3971 if (old_ctl != new_ctl) {
3973 snd_hda_codec_write_cache(codec, nid, 0,
3974 AC_VERB_SET_PIN_WIDGET_CONTROL,
3976 val = ucontrol->value.enumerated.item[0] >= 3 ?
3978 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3985 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3986 struct snd_ctl_elem_info *uinfo)
3988 static char *texts[] = {
3989 "Front", "Surround", "CLFE", "Side"
3991 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3993 uinfo->value.enumerated.items = 4;
3994 if (uinfo->value.enumerated.item >= 4)
3995 uinfo->value.enumerated.item = 3;
3996 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4000 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4001 struct snd_ctl_elem_value *ucontrol)
4003 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4004 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4007 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4008 ucontrol->value.enumerated.item[0] = sel & 3;
4012 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4013 struct snd_ctl_elem_value *ucontrol)
4015 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4016 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4019 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4020 if (ucontrol->value.enumerated.item[0] != sel) {
4021 sel = ucontrol->value.enumerated.item[0] & 3;
4022 snd_hda_codec_write_cache(codec, nid, 0,
4023 AC_VERB_SET_CONNECT_SEL, sel);
4029 #define PIN_CTL_TEST(xname,nid) { \
4030 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4032 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4033 .info = alc_test_pin_ctl_info, \
4034 .get = alc_test_pin_ctl_get, \
4035 .put = alc_test_pin_ctl_put, \
4036 .private_value = nid \
4039 #define PIN_SRC_TEST(xname,nid) { \
4040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4042 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4043 .info = alc_test_pin_src_info, \
4044 .get = alc_test_pin_src_get, \
4045 .put = alc_test_pin_src_put, \
4046 .private_value = nid \
4049 static struct snd_kcontrol_new alc880_test_mixer[] = {
4050 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4051 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4052 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4053 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4054 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4055 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4056 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4057 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4058 PIN_CTL_TEST("Front Pin Mode", 0x14),
4059 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4060 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4061 PIN_CTL_TEST("Side Pin Mode", 0x17),
4062 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4063 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4064 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4065 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4066 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4067 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4068 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4069 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4070 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4071 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4072 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4073 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4074 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4075 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4076 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4077 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4078 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4079 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4081 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4082 .name = "Channel Mode",
4083 .info = alc_ch_mode_info,
4084 .get = alc_ch_mode_get,
4085 .put = alc_ch_mode_put,
4090 static struct hda_verb alc880_test_init_verbs[] = {
4091 /* Unmute inputs of 0x0c - 0x0f */
4092 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4094 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4095 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4096 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4097 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4098 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4099 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4100 /* Vol output for 0x0c-0x0f */
4101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4102 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4104 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4105 /* Set output pins 0x14-0x17 */
4106 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4107 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4108 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4109 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4110 /* Unmute output pins 0x14-0x17 */
4111 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4112 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4113 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4114 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4115 /* Set input pins 0x18-0x1c */
4116 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4117 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4118 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4119 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4120 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4121 /* Mute input pins 0x18-0x1b */
4122 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4123 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4124 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4125 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4127 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4128 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4130 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4132 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4133 /* Analog input/passthru */
4134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4146 static const char *alc880_models[ALC880_MODEL_LAST] = {
4147 [ALC880_3ST] = "3stack",
4148 [ALC880_TCL_S700] = "tcl",
4149 [ALC880_3ST_DIG] = "3stack-digout",
4150 [ALC880_CLEVO] = "clevo",
4151 [ALC880_5ST] = "5stack",
4152 [ALC880_5ST_DIG] = "5stack-digout",
4153 [ALC880_W810] = "w810",
4154 [ALC880_Z71V] = "z71v",
4155 [ALC880_6ST] = "6stack",
4156 [ALC880_6ST_DIG] = "6stack-digout",
4157 [ALC880_ASUS] = "asus",
4158 [ALC880_ASUS_W1V] = "asus-w1v",
4159 [ALC880_ASUS_DIG] = "asus-dig",
4160 [ALC880_ASUS_DIG2] = "asus-dig2",
4161 [ALC880_UNIWILL_DIG] = "uniwill",
4162 [ALC880_UNIWILL_P53] = "uniwill-p53",
4163 [ALC880_FUJITSU] = "fujitsu",
4164 [ALC880_F1734] = "F1734",
4166 [ALC880_LG_LW] = "lg-lw",
4167 [ALC880_MEDION_RIM] = "medion",
4168 #ifdef CONFIG_SND_DEBUG
4169 [ALC880_TEST] = "test",
4171 [ALC880_AUTO] = "auto",
4174 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4175 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4176 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4177 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4178 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4179 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4180 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4181 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4182 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4183 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4184 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4185 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4186 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4187 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4188 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4189 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4190 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4191 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4192 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4193 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4194 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4195 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4196 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4197 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4198 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4199 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4200 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4201 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4202 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4203 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4204 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4205 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4206 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4207 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4208 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4209 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4210 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4211 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4212 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4213 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4214 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4215 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4216 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4217 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4218 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4219 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4220 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4221 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4222 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4223 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4224 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4225 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4226 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4227 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4228 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4229 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4230 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4231 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4232 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4233 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4234 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4235 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4236 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4237 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4238 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4239 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4240 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4241 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4242 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4244 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4245 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4246 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4251 * ALC880 codec presets
4253 static struct alc_config_preset alc880_presets[] = {
4255 .mixers = { alc880_three_stack_mixer },
4256 .init_verbs = { alc880_volume_init_verbs,
4257 alc880_pin_3stack_init_verbs },
4258 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4259 .dac_nids = alc880_dac_nids,
4260 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4261 .channel_mode = alc880_threestack_modes,
4263 .input_mux = &alc880_capture_source,
4265 [ALC880_3ST_DIG] = {
4266 .mixers = { alc880_three_stack_mixer },
4267 .init_verbs = { alc880_volume_init_verbs,
4268 alc880_pin_3stack_init_verbs },
4269 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4270 .dac_nids = alc880_dac_nids,
4271 .dig_out_nid = ALC880_DIGOUT_NID,
4272 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4273 .channel_mode = alc880_threestack_modes,
4275 .input_mux = &alc880_capture_source,
4277 [ALC880_TCL_S700] = {
4278 .mixers = { alc880_tcl_s700_mixer },
4279 .init_verbs = { alc880_volume_init_verbs,
4280 alc880_pin_tcl_S700_init_verbs,
4281 alc880_gpio2_init_verbs },
4282 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4283 .dac_nids = alc880_dac_nids,
4284 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4285 .num_adc_nids = 1, /* single ADC */
4287 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4288 .channel_mode = alc880_2_jack_modes,
4289 .input_mux = &alc880_capture_source,
4292 .mixers = { alc880_three_stack_mixer,
4293 alc880_five_stack_mixer},
4294 .init_verbs = { alc880_volume_init_verbs,
4295 alc880_pin_5stack_init_verbs },
4296 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4297 .dac_nids = alc880_dac_nids,
4298 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4299 .channel_mode = alc880_fivestack_modes,
4300 .input_mux = &alc880_capture_source,
4302 [ALC880_5ST_DIG] = {
4303 .mixers = { alc880_three_stack_mixer,
4304 alc880_five_stack_mixer },
4305 .init_verbs = { alc880_volume_init_verbs,
4306 alc880_pin_5stack_init_verbs },
4307 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4308 .dac_nids = alc880_dac_nids,
4309 .dig_out_nid = ALC880_DIGOUT_NID,
4310 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4311 .channel_mode = alc880_fivestack_modes,
4312 .input_mux = &alc880_capture_source,
4315 .mixers = { alc880_six_stack_mixer },
4316 .init_verbs = { alc880_volume_init_verbs,
4317 alc880_pin_6stack_init_verbs },
4318 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4319 .dac_nids = alc880_6st_dac_nids,
4320 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4321 .channel_mode = alc880_sixstack_modes,
4322 .input_mux = &alc880_6stack_capture_source,
4324 [ALC880_6ST_DIG] = {
4325 .mixers = { alc880_six_stack_mixer },
4326 .init_verbs = { alc880_volume_init_verbs,
4327 alc880_pin_6stack_init_verbs },
4328 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4329 .dac_nids = alc880_6st_dac_nids,
4330 .dig_out_nid = ALC880_DIGOUT_NID,
4331 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4332 .channel_mode = alc880_sixstack_modes,
4333 .input_mux = &alc880_6stack_capture_source,
4336 .mixers = { alc880_w810_base_mixer },
4337 .init_verbs = { alc880_volume_init_verbs,
4338 alc880_pin_w810_init_verbs,
4339 alc880_gpio2_init_verbs },
4340 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4341 .dac_nids = alc880_w810_dac_nids,
4342 .dig_out_nid = ALC880_DIGOUT_NID,
4343 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4344 .channel_mode = alc880_w810_modes,
4345 .input_mux = &alc880_capture_source,
4348 .mixers = { alc880_z71v_mixer },
4349 .init_verbs = { alc880_volume_init_verbs,
4350 alc880_pin_z71v_init_verbs },
4351 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4352 .dac_nids = alc880_z71v_dac_nids,
4353 .dig_out_nid = ALC880_DIGOUT_NID,
4355 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4356 .channel_mode = alc880_2_jack_modes,
4357 .input_mux = &alc880_capture_source,
4360 .mixers = { alc880_f1734_mixer },
4361 .init_verbs = { alc880_volume_init_verbs,
4362 alc880_pin_f1734_init_verbs },
4363 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4364 .dac_nids = alc880_f1734_dac_nids,
4366 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4367 .channel_mode = alc880_2_jack_modes,
4368 .input_mux = &alc880_f1734_capture_source,
4369 .unsol_event = alc880_uniwill_p53_unsol_event,
4370 .setup = alc880_uniwill_p53_setup,
4371 .init_hook = alc_automute_amp,
4374 .mixers = { alc880_asus_mixer },
4375 .init_verbs = { alc880_volume_init_verbs,
4376 alc880_pin_asus_init_verbs,
4377 alc880_gpio1_init_verbs },
4378 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4379 .dac_nids = alc880_asus_dac_nids,
4380 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4381 .channel_mode = alc880_asus_modes,
4383 .input_mux = &alc880_capture_source,
4385 [ALC880_ASUS_DIG] = {
4386 .mixers = { alc880_asus_mixer },
4387 .init_verbs = { alc880_volume_init_verbs,
4388 alc880_pin_asus_init_verbs,
4389 alc880_gpio1_init_verbs },
4390 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4391 .dac_nids = alc880_asus_dac_nids,
4392 .dig_out_nid = ALC880_DIGOUT_NID,
4393 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4394 .channel_mode = alc880_asus_modes,
4396 .input_mux = &alc880_capture_source,
4398 [ALC880_ASUS_DIG2] = {
4399 .mixers = { alc880_asus_mixer },
4400 .init_verbs = { alc880_volume_init_verbs,
4401 alc880_pin_asus_init_verbs,
4402 alc880_gpio2_init_verbs }, /* use GPIO2 */
4403 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4404 .dac_nids = alc880_asus_dac_nids,
4405 .dig_out_nid = ALC880_DIGOUT_NID,
4406 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4407 .channel_mode = alc880_asus_modes,
4409 .input_mux = &alc880_capture_source,
4411 [ALC880_ASUS_W1V] = {
4412 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4413 .init_verbs = { alc880_volume_init_verbs,
4414 alc880_pin_asus_init_verbs,
4415 alc880_gpio1_init_verbs },
4416 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4417 .dac_nids = alc880_asus_dac_nids,
4418 .dig_out_nid = ALC880_DIGOUT_NID,
4419 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4420 .channel_mode = alc880_asus_modes,
4422 .input_mux = &alc880_capture_source,
4424 [ALC880_UNIWILL_DIG] = {
4425 .mixers = { alc880_asus_mixer },
4426 .init_verbs = { alc880_volume_init_verbs,
4427 alc880_pin_asus_init_verbs },
4428 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4429 .dac_nids = alc880_asus_dac_nids,
4430 .dig_out_nid = ALC880_DIGOUT_NID,
4431 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4432 .channel_mode = alc880_asus_modes,
4434 .input_mux = &alc880_capture_source,
4436 [ALC880_UNIWILL] = {
4437 .mixers = { alc880_uniwill_mixer },
4438 .init_verbs = { alc880_volume_init_verbs,
4439 alc880_uniwill_init_verbs },
4440 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4441 .dac_nids = alc880_asus_dac_nids,
4442 .dig_out_nid = ALC880_DIGOUT_NID,
4443 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4444 .channel_mode = alc880_threestack_modes,
4446 .input_mux = &alc880_capture_source,
4447 .unsol_event = alc880_uniwill_unsol_event,
4448 .setup = alc880_uniwill_setup,
4449 .init_hook = alc880_uniwill_init_hook,
4451 [ALC880_UNIWILL_P53] = {
4452 .mixers = { alc880_uniwill_p53_mixer },
4453 .init_verbs = { alc880_volume_init_verbs,
4454 alc880_uniwill_p53_init_verbs },
4455 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4456 .dac_nids = alc880_asus_dac_nids,
4457 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4458 .channel_mode = alc880_threestack_modes,
4459 .input_mux = &alc880_capture_source,
4460 .unsol_event = alc880_uniwill_p53_unsol_event,
4461 .setup = alc880_uniwill_p53_setup,
4462 .init_hook = alc_automute_amp,
4464 [ALC880_FUJITSU] = {
4465 .mixers = { alc880_fujitsu_mixer },
4466 .init_verbs = { alc880_volume_init_verbs,
4467 alc880_uniwill_p53_init_verbs,
4468 alc880_beep_init_verbs },
4469 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4470 .dac_nids = alc880_dac_nids,
4471 .dig_out_nid = ALC880_DIGOUT_NID,
4472 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4473 .channel_mode = alc880_2_jack_modes,
4474 .input_mux = &alc880_capture_source,
4475 .unsol_event = alc880_uniwill_p53_unsol_event,
4476 .setup = alc880_uniwill_p53_setup,
4477 .init_hook = alc_automute_amp,
4480 .mixers = { alc880_three_stack_mixer },
4481 .init_verbs = { alc880_volume_init_verbs,
4482 alc880_pin_clevo_init_verbs },
4483 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4484 .dac_nids = alc880_dac_nids,
4486 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4487 .channel_mode = alc880_threestack_modes,
4489 .input_mux = &alc880_capture_source,
4492 .mixers = { alc880_lg_mixer },
4493 .init_verbs = { alc880_volume_init_verbs,
4494 alc880_lg_init_verbs },
4495 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4496 .dac_nids = alc880_lg_dac_nids,
4497 .dig_out_nid = ALC880_DIGOUT_NID,
4498 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4499 .channel_mode = alc880_lg_ch_modes,
4501 .input_mux = &alc880_lg_capture_source,
4502 .unsol_event = alc_automute_amp_unsol_event,
4503 .setup = alc880_lg_setup,
4504 .init_hook = alc_automute_amp,
4505 #ifdef CONFIG_SND_HDA_POWER_SAVE
4506 .loopbacks = alc880_lg_loopbacks,
4510 .mixers = { alc880_lg_lw_mixer },
4511 .init_verbs = { alc880_volume_init_verbs,
4512 alc880_lg_lw_init_verbs },
4513 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4514 .dac_nids = alc880_dac_nids,
4515 .dig_out_nid = ALC880_DIGOUT_NID,
4516 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4517 .channel_mode = alc880_lg_lw_modes,
4518 .input_mux = &alc880_lg_lw_capture_source,
4519 .unsol_event = alc_automute_amp_unsol_event,
4520 .setup = alc880_lg_lw_setup,
4521 .init_hook = alc_automute_amp,
4523 [ALC880_MEDION_RIM] = {
4524 .mixers = { alc880_medion_rim_mixer },
4525 .init_verbs = { alc880_volume_init_verbs,
4526 alc880_medion_rim_init_verbs,
4527 alc_gpio2_init_verbs },
4528 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4529 .dac_nids = alc880_dac_nids,
4530 .dig_out_nid = ALC880_DIGOUT_NID,
4531 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4532 .channel_mode = alc880_2_jack_modes,
4533 .input_mux = &alc880_medion_rim_capture_source,
4534 .unsol_event = alc880_medion_rim_unsol_event,
4535 .setup = alc880_medion_rim_setup,
4536 .init_hook = alc880_medion_rim_automute,
4538 #ifdef CONFIG_SND_DEBUG
4540 .mixers = { alc880_test_mixer },
4541 .init_verbs = { alc880_test_init_verbs },
4542 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4543 .dac_nids = alc880_test_dac_nids,
4544 .dig_out_nid = ALC880_DIGOUT_NID,
4545 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4546 .channel_mode = alc880_test_modes,
4547 .input_mux = &alc880_test_capture_source,
4553 * Automatic parse of I/O pins from the BIOS configuration
4558 ALC_CTL_WIDGET_MUTE,
4561 static struct snd_kcontrol_new alc880_control_templates[] = {
4562 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4563 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4564 HDA_BIND_MUTE(NULL, 0, 0, 0),
4567 /* add dynamic controls */
4568 static int add_control(struct alc_spec *spec, int type, const char *name,
4571 struct snd_kcontrol_new *knew;
4573 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4574 knew = snd_array_new(&spec->kctls);
4577 *knew = alc880_control_templates[type];
4578 knew->name = kstrdup(name, GFP_KERNEL);
4581 if (get_amp_nid_(val))
4582 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4583 knew->private_value = val;
4587 static int add_control_with_pfx(struct alc_spec *spec, int type,
4588 const char *pfx, const char *dir,
4589 const char *sfx, unsigned long val)
4592 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4593 return add_control(spec, type, name, val);
4596 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4597 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4598 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4599 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4601 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4602 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4603 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4604 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4605 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4606 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4607 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4608 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4609 #define ALC880_PIN_CD_NID 0x1c
4611 /* fill in the dac_nids table from the parsed pin configuration */
4612 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4613 const struct auto_pin_cfg *cfg)
4619 memset(assigned, 0, sizeof(assigned));
4620 spec->multiout.dac_nids = spec->private_dac_nids;
4622 /* check the pins hardwired to audio widget */
4623 for (i = 0; i < cfg->line_outs; i++) {
4624 nid = cfg->line_out_pins[i];
4625 if (alc880_is_fixed_pin(nid)) {
4626 int idx = alc880_fixed_pin_idx(nid);
4627 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4631 /* left pins can be connect to any audio widget */
4632 for (i = 0; i < cfg->line_outs; i++) {
4633 nid = cfg->line_out_pins[i];
4634 if (alc880_is_fixed_pin(nid))
4636 /* search for an empty channel */
4637 for (j = 0; j < cfg->line_outs; j++) {
4639 spec->multiout.dac_nids[i] =
4640 alc880_idx_to_dac(j);
4646 spec->multiout.num_dacs = cfg->line_outs;
4650 /* add playback controls from the parsed DAC table */
4651 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4652 const struct auto_pin_cfg *cfg)
4654 static const char *chname[4] = {
4655 "Front", "Surround", NULL /*CLFE*/, "Side"
4660 for (i = 0; i < cfg->line_outs; i++) {
4661 if (!spec->multiout.dac_nids[i])
4663 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4666 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4668 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4672 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4674 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4678 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4680 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4684 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4686 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4692 if (cfg->line_outs == 1 &&
4693 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4697 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4698 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4702 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4703 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4712 /* add playback controls for speaker and HP outputs */
4713 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4722 if (alc880_is_fixed_pin(pin)) {
4723 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4724 /* specify the DAC as the extra output */
4725 if (!spec->multiout.hp_nid)
4726 spec->multiout.hp_nid = nid;
4728 spec->multiout.extra_out_nid[0] = nid;
4729 /* control HP volume/switch on the output mixer amp */
4730 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4731 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4732 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4735 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4736 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4739 } else if (alc880_is_multi_pin(pin)) {
4740 /* set manual connection */
4741 /* we have only a switch on HP-out PIN */
4742 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4743 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4750 /* create input playback/capture controls for the given pin */
4751 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4752 const char *ctlname,
4753 int idx, hda_nid_t mix_nid)
4757 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4758 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4761 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4762 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4768 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4770 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4771 return (pincap & AC_PINCAP_IN) != 0;
4774 /* create playback/capture controls for input pins */
4775 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4776 const struct auto_pin_cfg *cfg,
4778 hda_nid_t cap1, hda_nid_t cap2)
4780 struct alc_spec *spec = codec->spec;
4781 struct hda_input_mux *imux = &spec->private_imux[0];
4784 for (i = 0; i < AUTO_PIN_LAST; i++) {
4787 pin = cfg->input_pins[i];
4788 if (!alc_is_input_pin(codec, pin))
4792 idx = get_connection_index(codec, mixer, pin);
4794 err = new_analog_input(spec, pin,
4795 auto_pin_cfg_labels[i],
4804 idx = get_connection_index(codec, cap1, pin);
4805 if (idx < 0 && cap2)
4806 idx = get_connection_index(codec, cap2, pin);
4808 imux->items[imux->num_items].label =
4809 auto_pin_cfg_labels[i];
4810 imux->items[imux->num_items].index = idx;
4817 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4818 const struct auto_pin_cfg *cfg)
4820 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4823 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4824 unsigned int pin_type)
4826 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4829 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4833 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4834 hda_nid_t nid, int pin_type,
4837 alc_set_pin_output(codec, nid, pin_type);
4838 /* need the manual connection? */
4839 if (alc880_is_multi_pin(nid)) {
4840 struct alc_spec *spec = codec->spec;
4841 int idx = alc880_multi_pin_idx(nid);
4842 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4843 AC_VERB_SET_CONNECT_SEL,
4844 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4848 static int get_pin_type(int line_out_type)
4850 if (line_out_type == AUTO_PIN_HP_OUT)
4856 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4858 struct alc_spec *spec = codec->spec;
4861 for (i = 0; i < spec->autocfg.line_outs; i++) {
4862 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4863 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4864 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4868 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4870 struct alc_spec *spec = codec->spec;
4873 pin = spec->autocfg.speaker_pins[0];
4874 if (pin) /* connect to front */
4875 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4876 pin = spec->autocfg.hp_pins[0];
4877 if (pin) /* connect to front */
4878 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4881 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4883 struct alc_spec *spec = codec->spec;
4886 for (i = 0; i < AUTO_PIN_LAST; i++) {
4887 hda_nid_t nid = spec->autocfg.input_pins[i];
4888 if (alc_is_input_pin(codec, nid)) {
4889 alc_set_input_pin(codec, nid, i);
4890 if (nid != ALC880_PIN_CD_NID &&
4891 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4892 snd_hda_codec_write(codec, nid, 0,
4893 AC_VERB_SET_AMP_GAIN_MUTE,
4899 /* parse the BIOS configuration and set up the alc_spec */
4900 /* return 1 if successful, 0 if the proper config is not found,
4901 * or a negative error code
4903 static int alc880_parse_auto_config(struct hda_codec *codec)
4905 struct alc_spec *spec = codec->spec;
4907 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4909 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4913 if (!spec->autocfg.line_outs)
4914 return 0; /* can't find valid BIOS pin config */
4916 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4919 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4922 err = alc880_auto_create_extra_out(spec,
4923 spec->autocfg.speaker_pins[0],
4927 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4931 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4935 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4937 /* check multiple SPDIF-out (for recent codecs) */
4938 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4940 err = snd_hda_get_connections(codec,
4941 spec->autocfg.dig_out_pins[i],
4946 spec->multiout.dig_out_nid = dig_nid;
4948 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4949 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4951 spec->slave_dig_outs[i - 1] = dig_nid;
4954 if (spec->autocfg.dig_in_pin)
4955 spec->dig_in_nid = ALC880_DIGIN_NID;
4957 if (spec->kctls.list)
4958 add_mixer(spec, spec->kctls.list);
4960 add_verb(spec, alc880_volume_init_verbs);
4962 spec->num_mux_defs = 1;
4963 spec->input_mux = &spec->private_imux[0];
4965 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4970 /* additional initialization for auto-configuration model */
4971 static void alc880_auto_init(struct hda_codec *codec)
4973 struct alc_spec *spec = codec->spec;
4974 alc880_auto_init_multi_out(codec);
4975 alc880_auto_init_extra_out(codec);
4976 alc880_auto_init_analog_input(codec);
4977 if (spec->unsol_event)
4978 alc_inithook(codec);
4981 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4982 * one of two digital mic pins, e.g. on ALC272
4984 static void fixup_automic_adc(struct hda_codec *codec)
4986 struct alc_spec *spec = codec->spec;
4989 for (i = 0; i < spec->num_adc_nids; i++) {
4990 hda_nid_t cap = spec->capsrc_nids ?
4991 spec->capsrc_nids[i] : spec->adc_nids[i];
4994 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4997 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5000 spec->int_mic.mux_idx = iidx;
5001 spec->ext_mic.mux_idx = eidx;
5002 if (spec->capsrc_nids)
5003 spec->capsrc_nids += i;
5004 spec->adc_nids += i;
5005 spec->num_adc_nids = 1;
5008 snd_printd(KERN_INFO "hda_codec: %s: "
5009 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5010 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5011 spec->auto_mic = 0; /* disable auto-mic to be sure */
5014 /* choose the ADC/MUX containing the input pin and initialize the setup */
5015 static void fixup_single_adc(struct hda_codec *codec)
5017 struct alc_spec *spec = codec->spec;
5021 /* search for the input pin; there must be only one */
5022 for (i = 0; i < AUTO_PIN_LAST; i++) {
5023 if (spec->autocfg.input_pins[i]) {
5024 pin = spec->autocfg.input_pins[i];
5031 /* set the default connection to that pin */
5032 for (i = 0; i < spec->num_adc_nids; i++) {
5033 hda_nid_t cap = spec->capsrc_nids ?
5034 spec->capsrc_nids[i] : spec->adc_nids[i];
5037 idx = get_connection_index(codec, cap, pin);
5040 /* use only this ADC */
5041 if (spec->capsrc_nids)
5042 spec->capsrc_nids += i;
5043 spec->adc_nids += i;
5044 spec->num_adc_nids = 1;
5045 /* select or unmute this route */
5046 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5047 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5050 snd_hda_codec_write_cache(codec, cap, 0,
5051 AC_VERB_SET_CONNECT_SEL, idx);
5057 static void set_capture_mixer(struct hda_codec *codec)
5059 struct alc_spec *spec = codec->spec;
5060 static struct snd_kcontrol_new *caps[2][3] = {
5061 { alc_capture_mixer_nosrc1,
5062 alc_capture_mixer_nosrc2,
5063 alc_capture_mixer_nosrc3 },
5064 { alc_capture_mixer1,
5066 alc_capture_mixer3 },
5068 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5071 fixup_automic_adc(codec);
5072 else if (spec->input_mux) {
5073 if (spec->input_mux->num_items > 1)
5075 else if (spec->input_mux->num_items == 1)
5076 fixup_single_adc(codec);
5078 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
5082 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5083 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5086 struct alc_spec *spec = codec->spec;
5088 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5090 for (n = 0; n < num_nids; n++) {
5092 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5096 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5099 nconns = snd_hda_get_connections(codec, cap, conn,
5103 nconns = snd_hda_get_connections(codec, cap, conn,
5108 if (!fallback_adc) {
5112 for (i = 0; i < AUTO_PIN_LAST; i++) {
5113 hda_nid_t nid = spec->autocfg.input_pins[i];
5116 for (j = 0; j < nconns; j++) {
5123 if (i >= AUTO_PIN_LAST) {
5124 int num_adcs = spec->num_adc_nids;
5125 spec->private_adc_nids[num_adcs] = adc;
5126 spec->private_capsrc_nids[num_adcs] = cap;
5127 spec->num_adc_nids++;
5128 spec->adc_nids = spec->private_adc_nids;
5130 spec->capsrc_nids = spec->private_capsrc_nids;
5133 if (!spec->num_adc_nids) {
5134 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5135 " using fallback 0x%x\n",
5136 codec->chip_name, fallback_adc);
5137 spec->private_adc_nids[0] = fallback_adc;
5138 spec->adc_nids = spec->private_adc_nids;
5139 if (fallback_adc != fallback_cap) {
5140 spec->private_capsrc_nids[0] = fallback_cap;
5141 spec->capsrc_nids = spec->private_adc_nids;
5146 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5147 #define set_beep_amp(spec, nid, idx, dir) \
5148 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5150 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5154 * OK, here we have finally the patch for ALC880
5157 static int patch_alc880(struct hda_codec *codec)
5159 struct alc_spec *spec;
5163 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5169 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5172 if (board_config < 0) {
5173 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5175 board_config = ALC880_AUTO;
5178 if (board_config == ALC880_AUTO) {
5179 /* automatic parse from the BIOS config */
5180 err = alc880_parse_auto_config(codec);
5186 "hda_codec: Cannot set up configuration "
5187 "from BIOS. Using 3-stack mode...\n");
5188 board_config = ALC880_3ST;
5192 err = snd_hda_attach_beep_device(codec, 0x1);
5198 if (board_config != ALC880_AUTO)
5199 setup_preset(codec, &alc880_presets[board_config]);
5201 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5202 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5203 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5205 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5206 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5208 if (!spec->adc_nids && spec->input_mux) {
5209 /* check whether NID 0x07 is valid */
5210 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5212 wcap = get_wcaps_type(wcap);
5213 if (wcap != AC_WID_AUD_IN) {
5214 spec->adc_nids = alc880_adc_nids_alt;
5215 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5217 spec->adc_nids = alc880_adc_nids;
5218 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5221 set_capture_mixer(codec);
5222 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5224 spec->vmaster_nid = 0x0c;
5226 codec->patch_ops = alc_patch_ops;
5227 if (board_config == ALC880_AUTO)
5228 spec->init_hook = alc880_auto_init;
5229 #ifdef CONFIG_SND_HDA_POWER_SAVE
5230 if (!spec->loopback.amplist)
5231 spec->loopback.amplist = alc880_loopbacks;
5242 static hda_nid_t alc260_dac_nids[1] = {
5247 static hda_nid_t alc260_adc_nids[1] = {
5252 static hda_nid_t alc260_adc_nids_alt[1] = {
5257 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5258 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5260 static hda_nid_t alc260_dual_adc_nids[2] = {
5265 #define ALC260_DIGOUT_NID 0x03
5266 #define ALC260_DIGIN_NID 0x06
5268 static struct hda_input_mux alc260_capture_source = {
5272 { "Front Mic", 0x1 },
5278 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5279 * headphone jack and the internal CD lines since these are the only pins at
5280 * which audio can appear. For flexibility, also allow the option of
5281 * recording the mixer output on the second ADC (ADC0 doesn't have a
5282 * connection to the mixer output).
5284 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5288 { "Mic/Line", 0x0 },
5290 { "Headphone", 0x2 },
5296 { "Mic/Line", 0x0 },
5298 { "Headphone", 0x2 },
5305 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5306 * the Fujitsu S702x, but jacks are marked differently.
5308 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5315 { "Headphone", 0x5 },
5324 { "Headphone", 0x6 },
5330 /* Maxdata Favorit 100XS */
5331 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5335 { "Line/Mic", 0x0 },
5342 { "Line/Mic", 0x0 },
5350 * This is just place-holder, so there's something for alc_build_pcms to look
5351 * at when it calculates the maximum number of channels. ALC260 has no mixer
5352 * element which allows changing the channel mode, so the verb list is
5355 static struct hda_channel_mode alc260_modes[1] = {
5360 /* Mixer combinations
5362 * basic: base_output + input + pc_beep + capture
5363 * HP: base_output + input + capture_alt
5364 * HP_3013: hp_3013 + input + capture
5365 * fujitsu: fujitsu + capture
5366 * acer: acer + capture
5369 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5370 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5371 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5372 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5373 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5374 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5375 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5379 static struct snd_kcontrol_new alc260_input_mixer[] = {
5380 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5381 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5382 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5383 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5385 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5386 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5387 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5391 /* update HP, line and mono out pins according to the master switch */
5392 static void alc260_hp_master_update(struct hda_codec *codec,
5393 hda_nid_t hp, hda_nid_t line,
5396 struct alc_spec *spec = codec->spec;
5397 unsigned int val = spec->master_sw ? PIN_HP : 0;
5398 /* change HP and line-out pins */
5399 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5401 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5403 /* mono (speaker) depending on the HP jack sense */
5404 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5405 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5409 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5410 struct snd_ctl_elem_value *ucontrol)
5412 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5413 struct alc_spec *spec = codec->spec;
5414 *ucontrol->value.integer.value = spec->master_sw;
5418 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5419 struct snd_ctl_elem_value *ucontrol)
5421 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5422 struct alc_spec *spec = codec->spec;
5423 int val = !!*ucontrol->value.integer.value;
5424 hda_nid_t hp, line, mono;
5426 if (val == spec->master_sw)
5428 spec->master_sw = val;
5429 hp = (kcontrol->private_value >> 16) & 0xff;
5430 line = (kcontrol->private_value >> 8) & 0xff;
5431 mono = kcontrol->private_value & 0xff;
5432 alc260_hp_master_update(codec, hp, line, mono);
5436 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5439 .name = "Master Playback Switch",
5440 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5441 .info = snd_ctl_boolean_mono_info,
5442 .get = alc260_hp_master_sw_get,
5443 .put = alc260_hp_master_sw_put,
5444 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5446 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5447 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5448 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5449 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5450 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5452 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5456 static struct hda_verb alc260_hp_unsol_verbs[] = {
5457 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5461 static void alc260_hp_automute(struct hda_codec *codec)
5463 struct alc_spec *spec = codec->spec;
5465 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5466 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5469 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5471 if ((res >> 26) == ALC880_HP_EVENT)
5472 alc260_hp_automute(codec);
5475 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5477 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5478 .name = "Master Playback Switch",
5479 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5480 .info = snd_ctl_boolean_mono_info,
5481 .get = alc260_hp_master_sw_get,
5482 .put = alc260_hp_master_sw_put,
5483 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5485 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5486 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5487 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5488 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5489 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5490 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5491 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5492 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5496 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5497 .ops = &snd_hda_bind_vol,
5499 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5500 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5501 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5506 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5507 .ops = &snd_hda_bind_sw,
5509 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5510 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5515 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5516 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5517 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5518 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5519 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5523 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5524 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5528 static void alc260_hp_3013_automute(struct hda_codec *codec)
5530 struct alc_spec *spec = codec->spec;
5532 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5533 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5536 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5539 if ((res >> 26) == ALC880_HP_EVENT)
5540 alc260_hp_3013_automute(codec);
5543 static void alc260_hp_3012_automute(struct hda_codec *codec)
5545 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5547 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5549 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5551 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5555 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5558 if ((res >> 26) == ALC880_HP_EVENT)
5559 alc260_hp_3012_automute(codec);
5562 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5563 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5565 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5566 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5567 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5568 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5569 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5570 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5571 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5572 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5573 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5574 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5575 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5579 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5580 * versions of the ALC260 don't act on requests to enable mic bias from NID
5581 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5582 * datasheet doesn't mention this restriction. At this stage it's not clear
5583 * whether this behaviour is intentional or is a hardware bug in chip
5584 * revisions available in early 2006. Therefore for now allow the
5585 * "Headphone Jack Mode" control to span all choices, but if it turns out
5586 * that the lack of mic bias for this NID is intentional we could change the
5587 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5589 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5590 * don't appear to make the mic bias available from the "line" jack, even
5591 * though the NID used for this jack (0x14) can supply it. The theory is
5592 * that perhaps Acer have included blocking capacitors between the ALC260
5593 * and the output jack. If this turns out to be the case for all such
5594 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5595 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5597 * The C20x Tablet series have a mono internal speaker which is controlled
5598 * via the chip's Mono sum widget and pin complex, so include the necessary
5599 * controls for such models. On models without a "mono speaker" the control
5600 * won't do anything.
5602 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5603 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5604 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5605 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5606 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5608 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5610 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5611 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5613 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5614 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5615 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5616 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5617 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5621 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5623 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5624 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5625 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5626 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5627 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5628 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5629 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5633 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5634 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5636 static struct snd_kcontrol_new alc260_will_mixer[] = {
5637 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5638 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5640 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5641 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5642 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5643 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5644 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5645 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5646 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5650 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5651 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5653 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5654 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5655 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5657 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5658 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5659 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5660 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5661 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5662 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5663 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5668 * initialization verbs
5670 static struct hda_verb alc260_init_verbs[] = {
5671 /* Line In pin widget for input */
5672 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5673 /* CD pin widget for input */
5674 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5675 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5676 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5677 /* Mic2 (front panel) pin widget for input and vref at 80% */
5678 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5679 /* LINE-2 is used for line-out in rear */
5680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5681 /* select line-out */
5682 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5684 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5686 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5688 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5689 /* mute capture amp left and right */
5690 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5691 /* set connection select to line in (default select for this ADC) */
5692 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5693 /* mute capture amp left and right */
5694 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5695 /* set connection select to line in (default select for this ADC) */
5696 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5697 /* set vol=0 Line-Out mixer amp left and right */
5698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5699 /* unmute pin widget amp left and right (no gain on this amp) */
5700 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5701 /* set vol=0 HP mixer amp left and right */
5702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5703 /* unmute pin widget amp left and right (no gain on this amp) */
5704 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5705 /* set vol=0 Mono mixer amp left and right */
5706 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5707 /* unmute pin widget amp left and right (no gain on this amp) */
5708 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5709 /* unmute LINE-2 out pin */
5710 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5711 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5714 /* mute analog inputs */
5715 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5716 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5717 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5720 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5721 /* mute Front out path */
5722 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5723 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5724 /* mute Headphone out path */
5725 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5726 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5727 /* mute Mono out path */
5728 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5729 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5733 #if 0 /* should be identical with alc260_init_verbs? */
5734 static struct hda_verb alc260_hp_init_verbs[] = {
5735 /* Headphone and output */
5736 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5738 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5739 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5740 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5741 /* Mic2 (front panel) pin widget for input and vref at 80% */
5742 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5743 /* Line In pin widget for input */
5744 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5745 /* Line-2 pin widget for output */
5746 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5747 /* CD pin widget for input */
5748 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5749 /* unmute amp left and right */
5750 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5751 /* set connection select to line in (default select for this ADC) */
5752 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5753 /* unmute Line-Out mixer amp left and right (volume = 0) */
5754 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5755 /* mute pin widget amp left and right (no gain on this amp) */
5756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5757 /* unmute HP mixer amp left and right (volume = 0) */
5758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5759 /* mute pin widget amp left and right (no gain on this amp) */
5760 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5761 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5764 /* mute analog inputs */
5765 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5766 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5767 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5768 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5769 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5770 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5771 /* Unmute Front out path */
5772 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5773 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5774 /* Unmute Headphone out path */
5775 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5776 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5777 /* Unmute Mono out path */
5778 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5779 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5784 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5785 /* Line out and output */
5786 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5788 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5789 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5790 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5791 /* Mic2 (front panel) pin widget for input and vref at 80% */
5792 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5793 /* Line In pin widget for input */
5794 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5795 /* Headphone pin widget for output */
5796 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5797 /* CD pin widget for input */
5798 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5799 /* unmute amp left and right */
5800 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5801 /* set connection select to line in (default select for this ADC) */
5802 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5803 /* unmute Line-Out mixer amp left and right (volume = 0) */
5804 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5805 /* mute pin widget amp left and right (no gain on this amp) */
5806 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5807 /* unmute HP mixer amp left and right (volume = 0) */
5808 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5809 /* mute pin widget amp left and right (no gain on this amp) */
5810 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5811 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5814 /* mute analog inputs */
5815 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5816 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5817 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5820 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5821 /* Unmute Front out path */
5822 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5824 /* Unmute Headphone out path */
5825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5827 /* Unmute Mono out path */
5828 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5829 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5833 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5834 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5835 * audio = 0x16, internal speaker = 0x10.
5837 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5838 /* Disable all GPIOs */
5839 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5840 /* Internal speaker is connected to headphone pin */
5841 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5842 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5843 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5844 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5845 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5846 /* Ensure all other unused pins are disabled and muted. */
5847 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5849 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5850 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5851 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5852 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5856 /* Disable digital (SPDIF) pins */
5857 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5858 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5860 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5861 * when acting as an output.
5863 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5865 /* Start with output sum widgets muted and their output gains at min */
5866 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5867 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5869 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5870 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5871 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5872 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5873 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5874 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5876 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5877 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5878 /* Unmute Line1 pin widget output buffer since it starts as an output.
5879 * If the pin mode is changed by the user the pin mode control will
5880 * take care of enabling the pin's input/output buffers as needed.
5881 * Therefore there's no need to enable the input buffer at this
5884 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5885 /* Unmute input buffer of pin widget used for Line-in (no equiv
5888 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5890 /* Mute capture amp left and right */
5891 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5892 /* Set ADC connection select to match default mixer setting - line
5895 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5897 /* Do the same for the second ADC: mute capture input amp and
5898 * set ADC connection to line in (on mic1 pin)
5900 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5901 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5903 /* Mute all inputs to mixer widget (even unconnected ones) */
5904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5909 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5910 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5916 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5917 * similar laptops (adapted from Fujitsu init verbs).
5919 static struct hda_verb alc260_acer_init_verbs[] = {
5920 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5921 * the headphone jack. Turn this on and rely on the standard mute
5922 * methods whenever the user wants to turn these outputs off.
5924 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5925 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5926 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5927 /* Internal speaker/Headphone jack is connected to Line-out pin */
5928 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5929 /* Internal microphone/Mic jack is connected to Mic1 pin */
5930 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5931 /* Line In jack is connected to Line1 pin */
5932 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5933 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5934 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5935 /* Ensure all other unused pins are disabled and muted. */
5936 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5937 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5938 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5939 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5940 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5942 /* Disable digital (SPDIF) pins */
5943 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5944 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5946 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5947 * bus when acting as outputs.
5949 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5950 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5952 /* Start with output sum widgets muted and their output gains at min */
5953 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5954 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5955 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5956 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5957 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5958 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5959 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5960 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5961 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5963 /* Unmute Line-out pin widget amp left and right
5964 * (no equiv mixer ctrl)
5966 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5967 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5968 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5969 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5970 * inputs. If the pin mode is changed by the user the pin mode control
5971 * will take care of enabling the pin's input/output buffers as needed.
5972 * Therefore there's no need to enable the input buffer at this
5975 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5976 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5978 /* Mute capture amp left and right */
5979 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5980 /* Set ADC connection select to match default mixer setting - mic
5983 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5985 /* Do similar with the second ADC: mute capture input amp and
5986 * set ADC connection to mic to match ALSA's default state.
5988 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5989 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5991 /* Mute all inputs to mixer widget (even unconnected ones) */
5992 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5993 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5994 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5995 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5998 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5999 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6004 /* Initialisation sequence for Maxdata Favorit 100XS
6005 * (adapted from Acer init verbs).
6007 static struct hda_verb alc260_favorit100_init_verbs[] = {
6008 /* GPIO 0 enables the output jack.
6009 * Turn this on and rely on the standard mute
6010 * methods whenever the user wants to turn these outputs off.
6012 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6013 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6014 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6015 /* Line/Mic input jack is connected to Mic1 pin */
6016 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6017 /* Ensure all other unused pins are disabled and muted. */
6018 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6019 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6020 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6021 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6022 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6023 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6024 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6028 /* Disable digital (SPDIF) pins */
6029 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6030 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6032 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6033 * bus when acting as outputs.
6035 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6036 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6038 /* Start with output sum widgets muted and their output gains at min */
6039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6040 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6041 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6042 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6043 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6044 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6045 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6046 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6047 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6049 /* Unmute Line-out pin widget amp left and right
6050 * (no equiv mixer ctrl)
6052 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6053 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6054 * inputs. If the pin mode is changed by the user the pin mode control
6055 * will take care of enabling the pin's input/output buffers as needed.
6056 * Therefore there's no need to enable the input buffer at this
6059 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6061 /* Mute capture amp left and right */
6062 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6063 /* Set ADC connection select to match default mixer setting - mic
6066 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6068 /* Do similar with the second ADC: mute capture input amp and
6069 * set ADC connection to mic to match ALSA's default state.
6071 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6072 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6074 /* Mute all inputs to mixer widget (even unconnected ones) */
6075 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6076 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6077 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6078 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6079 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6080 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6082 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6087 static struct hda_verb alc260_will_verbs[] = {
6088 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6089 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6090 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6091 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6092 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6093 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6097 static struct hda_verb alc260_replacer_672v_verbs[] = {
6098 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6099 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6100 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6102 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6103 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6104 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6106 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6110 /* toggle speaker-output according to the hp-jack state */
6111 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6113 unsigned int present;
6115 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6116 present = snd_hda_jack_detect(codec, 0x0f);
6118 snd_hda_codec_write_cache(codec, 0x01, 0,
6119 AC_VERB_SET_GPIO_DATA, 1);
6120 snd_hda_codec_write_cache(codec, 0x0f, 0,
6121 AC_VERB_SET_PIN_WIDGET_CONTROL,
6124 snd_hda_codec_write_cache(codec, 0x01, 0,
6125 AC_VERB_SET_GPIO_DATA, 0);
6126 snd_hda_codec_write_cache(codec, 0x0f, 0,
6127 AC_VERB_SET_PIN_WIDGET_CONTROL,
6132 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6135 if ((res >> 26) == ALC880_HP_EVENT)
6136 alc260_replacer_672v_automute(codec);
6139 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6140 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6141 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6142 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6143 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6144 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6146 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6147 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6148 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6149 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6153 /* Test configuration for debugging, modelled after the ALC880 test
6156 #ifdef CONFIG_SND_DEBUG
6157 static hda_nid_t alc260_test_dac_nids[1] = {
6160 static hda_nid_t alc260_test_adc_nids[2] = {
6163 /* For testing the ALC260, each input MUX needs its own definition since
6164 * the signal assignments are different. This assumes that the first ADC
6167 static struct hda_input_mux alc260_test_capture_sources[2] = {
6171 { "MIC1 pin", 0x0 },
6172 { "MIC2 pin", 0x1 },
6173 { "LINE1 pin", 0x2 },
6174 { "LINE2 pin", 0x3 },
6176 { "LINE-OUT pin", 0x5 },
6177 { "HP-OUT pin", 0x6 },
6183 { "MIC1 pin", 0x0 },
6184 { "MIC2 pin", 0x1 },
6185 { "LINE1 pin", 0x2 },
6186 { "LINE2 pin", 0x3 },
6189 { "LINE-OUT pin", 0x6 },
6190 { "HP-OUT pin", 0x7 },
6194 static struct snd_kcontrol_new alc260_test_mixer[] = {
6195 /* Output driver widgets */
6196 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6197 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6198 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6199 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6200 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6201 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6203 /* Modes for retasking pin widgets
6204 * Note: the ALC260 doesn't seem to act on requests to enable mic
6205 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6206 * mention this restriction. At this stage it's not clear whether
6207 * this behaviour is intentional or is a hardware bug in chip
6208 * revisions available at least up until early 2006. Therefore for
6209 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6210 * choices, but if it turns out that the lack of mic bias for these
6211 * NIDs is intentional we could change their modes from
6212 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6214 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6215 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6216 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6217 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6218 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6219 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6221 /* Loopback mixer controls */
6222 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6223 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6224 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6225 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6226 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6227 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6228 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6229 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6230 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6231 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6232 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6233 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6234 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6235 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6237 /* Controls for GPIO pins, assuming they are configured as outputs */
6238 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6239 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6240 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6241 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6243 /* Switches to allow the digital IO pins to be enabled. The datasheet
6244 * is ambigious as to which NID is which; testing on laptops which
6245 * make this output available should provide clarification.
6247 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6248 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6250 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6251 * this output to turn on an external amplifier.
6253 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6254 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6258 static struct hda_verb alc260_test_init_verbs[] = {
6259 /* Enable all GPIOs as outputs with an initial value of 0 */
6260 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6261 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6262 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6264 /* Enable retasking pins as output, initially without power amp */
6265 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6266 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6267 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6269 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6270 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6272 /* Disable digital (SPDIF) pins initially, but users can enable
6273 * them via a mixer switch. In the case of SPDIF-out, this initverb
6274 * payload also sets the generation to 0, output to be in "consumer"
6275 * PCM format, copyright asserted, no pre-emphasis and no validity
6278 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6279 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6281 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6282 * OUT1 sum bus when acting as an output.
6284 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6285 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6286 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6287 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6289 /* Start with output sum widgets muted and their output gains at min */
6290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6291 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6292 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6293 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6295 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6296 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6297 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6298 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6300 /* Unmute retasking pin widget output buffers since the default
6301 * state appears to be output. As the pin mode is changed by the
6302 * user the pin mode control will take care of enabling the pin's
6303 * input/output buffers as needed.
6305 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6306 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6308 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6309 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6310 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6311 /* Also unmute the mono-out pin widget */
6312 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6314 /* Mute capture amp left and right */
6315 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6316 /* Set ADC connection select to match default mixer setting (mic1
6319 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6321 /* Do the same for the second ADC: mute capture input amp and
6322 * set ADC connection to mic1 pin
6324 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6325 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6327 /* Mute all inputs to mixer widget (even unconnected ones) */
6328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6341 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6342 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6344 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6345 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6348 * for BIOS auto-configuration
6351 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6352 const char *pfx, int *vol_bits)
6355 unsigned long vol_val, sw_val;
6358 if (nid >= 0x0f && nid < 0x11) {
6359 nid_vol = nid - 0x7;
6360 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6361 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6362 } else if (nid == 0x11) {
6363 nid_vol = nid - 0x7;
6364 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6365 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6366 } else if (nid >= 0x12 && nid <= 0x15) {
6368 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6369 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6373 if (!(*vol_bits & (1 << nid_vol))) {
6374 /* first control for the volume widget */
6375 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6378 *vol_bits |= (1 << nid_vol);
6380 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6386 /* add playback controls from the parsed DAC table */
6387 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6388 const struct auto_pin_cfg *cfg)
6394 spec->multiout.num_dacs = 1;
6395 spec->multiout.dac_nids = spec->private_dac_nids;
6396 spec->multiout.dac_nids[0] = 0x02;
6398 nid = cfg->line_out_pins[0];
6401 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6403 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6407 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6412 nid = cfg->speaker_pins[0];
6414 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6419 nid = cfg->hp_pins[0];
6421 err = alc260_add_playback_controls(spec, nid, "Headphone",
6429 /* create playback/capture controls for input pins */
6430 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6431 const struct auto_pin_cfg *cfg)
6433 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6436 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6437 hda_nid_t nid, int pin_type,
6440 alc_set_pin_output(codec, nid, pin_type);
6441 /* need the manual connection? */
6443 int idx = nid - 0x12;
6444 snd_hda_codec_write(codec, idx + 0x0b, 0,
6445 AC_VERB_SET_CONNECT_SEL, sel_idx);
6449 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6451 struct alc_spec *spec = codec->spec;
6454 nid = spec->autocfg.line_out_pins[0];
6456 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6457 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6460 nid = spec->autocfg.speaker_pins[0];
6462 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6464 nid = spec->autocfg.hp_pins[0];
6466 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6469 #define ALC260_PIN_CD_NID 0x16
6470 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6472 struct alc_spec *spec = codec->spec;
6475 for (i = 0; i < AUTO_PIN_LAST; i++) {
6476 hda_nid_t nid = spec->autocfg.input_pins[i];
6478 alc_set_input_pin(codec, nid, i);
6479 if (nid != ALC260_PIN_CD_NID &&
6480 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6481 snd_hda_codec_write(codec, nid, 0,
6482 AC_VERB_SET_AMP_GAIN_MUTE,
6489 * generic initialization of ADC, input mixers and output mixers
6491 static struct hda_verb alc260_volume_init_verbs[] = {
6493 * Unmute ADC0-1 and set the default input to mic-in
6495 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6496 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6497 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6498 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6500 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6502 * Note: PASD motherboards uses the Line In 2 as the input for
6503 * front panel mic (mic 2)
6505 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6506 /* mute analog inputs */
6507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6514 * Set up output mixers (0x08 - 0x0a)
6516 /* set vol=0 to output mixers */
6517 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6518 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6519 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6520 /* set up input amps for analog loopback */
6521 /* Amp Indices: DAC = 0, mixer = 1 */
6522 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6523 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6524 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6525 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6526 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6527 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6532 static int alc260_parse_auto_config(struct hda_codec *codec)
6534 struct alc_spec *spec = codec->spec;
6536 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6538 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6542 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6545 if (!spec->kctls.list)
6546 return 0; /* can't find valid BIOS pin config */
6547 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6551 spec->multiout.max_channels = 2;
6553 if (spec->autocfg.dig_outs)
6554 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6555 if (spec->kctls.list)
6556 add_mixer(spec, spec->kctls.list);
6558 add_verb(spec, alc260_volume_init_verbs);
6560 spec->num_mux_defs = 1;
6561 spec->input_mux = &spec->private_imux[0];
6563 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6568 /* additional initialization for auto-configuration model */
6569 static void alc260_auto_init(struct hda_codec *codec)
6571 struct alc_spec *spec = codec->spec;
6572 alc260_auto_init_multi_out(codec);
6573 alc260_auto_init_analog_input(codec);
6574 if (spec->unsol_event)
6575 alc_inithook(codec);
6578 #ifdef CONFIG_SND_HDA_POWER_SAVE
6579 static struct hda_amp_list alc260_loopbacks[] = {
6580 { 0x07, HDA_INPUT, 0 },
6581 { 0x07, HDA_INPUT, 1 },
6582 { 0x07, HDA_INPUT, 2 },
6583 { 0x07, HDA_INPUT, 3 },
6584 { 0x07, HDA_INPUT, 4 },
6590 * ALC260 configurations
6592 static const char *alc260_models[ALC260_MODEL_LAST] = {
6593 [ALC260_BASIC] = "basic",
6595 [ALC260_HP_3013] = "hp-3013",
6596 [ALC260_HP_DC7600] = "hp-dc7600",
6597 [ALC260_FUJITSU_S702X] = "fujitsu",
6598 [ALC260_ACER] = "acer",
6599 [ALC260_WILL] = "will",
6600 [ALC260_REPLACER_672V] = "replacer",
6601 [ALC260_FAVORIT100] = "favorit100",
6602 #ifdef CONFIG_SND_DEBUG
6603 [ALC260_TEST] = "test",
6605 [ALC260_AUTO] = "auto",
6608 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6609 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6610 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6611 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6612 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6613 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6614 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6615 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6616 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6617 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6618 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6619 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6620 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6621 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6622 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6623 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6624 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6625 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6626 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6627 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6628 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6632 static struct alc_config_preset alc260_presets[] = {
6634 .mixers = { alc260_base_output_mixer,
6635 alc260_input_mixer },
6636 .init_verbs = { alc260_init_verbs },
6637 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6638 .dac_nids = alc260_dac_nids,
6639 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6640 .adc_nids = alc260_dual_adc_nids,
6641 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6642 .channel_mode = alc260_modes,
6643 .input_mux = &alc260_capture_source,
6646 .mixers = { alc260_hp_output_mixer,
6647 alc260_input_mixer },
6648 .init_verbs = { alc260_init_verbs,
6649 alc260_hp_unsol_verbs },
6650 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6651 .dac_nids = alc260_dac_nids,
6652 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6653 .adc_nids = alc260_adc_nids_alt,
6654 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6655 .channel_mode = alc260_modes,
6656 .input_mux = &alc260_capture_source,
6657 .unsol_event = alc260_hp_unsol_event,
6658 .init_hook = alc260_hp_automute,
6660 [ALC260_HP_DC7600] = {
6661 .mixers = { alc260_hp_dc7600_mixer,
6662 alc260_input_mixer },
6663 .init_verbs = { alc260_init_verbs,
6664 alc260_hp_dc7600_verbs },
6665 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6666 .dac_nids = alc260_dac_nids,
6667 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6668 .adc_nids = alc260_adc_nids_alt,
6669 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6670 .channel_mode = alc260_modes,
6671 .input_mux = &alc260_capture_source,
6672 .unsol_event = alc260_hp_3012_unsol_event,
6673 .init_hook = alc260_hp_3012_automute,
6675 [ALC260_HP_3013] = {
6676 .mixers = { alc260_hp_3013_mixer,
6677 alc260_input_mixer },
6678 .init_verbs = { alc260_hp_3013_init_verbs,
6679 alc260_hp_3013_unsol_verbs },
6680 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6681 .dac_nids = alc260_dac_nids,
6682 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6683 .adc_nids = alc260_adc_nids_alt,
6684 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6685 .channel_mode = alc260_modes,
6686 .input_mux = &alc260_capture_source,
6687 .unsol_event = alc260_hp_3013_unsol_event,
6688 .init_hook = alc260_hp_3013_automute,
6690 [ALC260_FUJITSU_S702X] = {
6691 .mixers = { alc260_fujitsu_mixer },
6692 .init_verbs = { alc260_fujitsu_init_verbs },
6693 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6694 .dac_nids = alc260_dac_nids,
6695 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6696 .adc_nids = alc260_dual_adc_nids,
6697 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6698 .channel_mode = alc260_modes,
6699 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6700 .input_mux = alc260_fujitsu_capture_sources,
6703 .mixers = { alc260_acer_mixer },
6704 .init_verbs = { alc260_acer_init_verbs },
6705 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6706 .dac_nids = alc260_dac_nids,
6707 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6708 .adc_nids = alc260_dual_adc_nids,
6709 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6710 .channel_mode = alc260_modes,
6711 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6712 .input_mux = alc260_acer_capture_sources,
6714 [ALC260_FAVORIT100] = {
6715 .mixers = { alc260_favorit100_mixer },
6716 .init_verbs = { alc260_favorit100_init_verbs },
6717 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6718 .dac_nids = alc260_dac_nids,
6719 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6720 .adc_nids = alc260_dual_adc_nids,
6721 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6722 .channel_mode = alc260_modes,
6723 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6724 .input_mux = alc260_favorit100_capture_sources,
6727 .mixers = { alc260_will_mixer },
6728 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6729 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6730 .dac_nids = alc260_dac_nids,
6731 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6732 .adc_nids = alc260_adc_nids,
6733 .dig_out_nid = ALC260_DIGOUT_NID,
6734 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6735 .channel_mode = alc260_modes,
6736 .input_mux = &alc260_capture_source,
6738 [ALC260_REPLACER_672V] = {
6739 .mixers = { alc260_replacer_672v_mixer },
6740 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6741 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6742 .dac_nids = alc260_dac_nids,
6743 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6744 .adc_nids = alc260_adc_nids,
6745 .dig_out_nid = ALC260_DIGOUT_NID,
6746 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6747 .channel_mode = alc260_modes,
6748 .input_mux = &alc260_capture_source,
6749 .unsol_event = alc260_replacer_672v_unsol_event,
6750 .init_hook = alc260_replacer_672v_automute,
6752 #ifdef CONFIG_SND_DEBUG
6754 .mixers = { alc260_test_mixer },
6755 .init_verbs = { alc260_test_init_verbs },
6756 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6757 .dac_nids = alc260_test_dac_nids,
6758 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6759 .adc_nids = alc260_test_adc_nids,
6760 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6761 .channel_mode = alc260_modes,
6762 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6763 .input_mux = alc260_test_capture_sources,
6768 static int patch_alc260(struct hda_codec *codec)
6770 struct alc_spec *spec;
6771 int err, board_config;
6773 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6779 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6782 if (board_config < 0) {
6783 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6785 board_config = ALC260_AUTO;
6788 if (board_config == ALC260_AUTO) {
6789 /* automatic parse from the BIOS config */
6790 err = alc260_parse_auto_config(codec);
6796 "hda_codec: Cannot set up configuration "
6797 "from BIOS. Using base mode...\n");
6798 board_config = ALC260_BASIC;
6802 err = snd_hda_attach_beep_device(codec, 0x1);
6808 if (board_config != ALC260_AUTO)
6809 setup_preset(codec, &alc260_presets[board_config]);
6811 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6812 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6814 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6815 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6817 if (!spec->adc_nids && spec->input_mux) {
6818 /* check whether NID 0x04 is valid */
6819 unsigned int wcap = get_wcaps(codec, 0x04);
6820 wcap = get_wcaps_type(wcap);
6822 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6823 spec->adc_nids = alc260_adc_nids_alt;
6824 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6826 spec->adc_nids = alc260_adc_nids;
6827 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6830 set_capture_mixer(codec);
6831 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6833 spec->vmaster_nid = 0x08;
6835 codec->patch_ops = alc_patch_ops;
6836 if (board_config == ALC260_AUTO)
6837 spec->init_hook = alc260_auto_init;
6838 #ifdef CONFIG_SND_HDA_POWER_SAVE
6839 if (!spec->loopback.amplist)
6840 spec->loopback.amplist = alc260_loopbacks;
6848 * ALC882/883/885/888/889 support
6850 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6851 * configuration. Each pin widget can choose any input DACs and a mixer.
6852 * Each ADC is connected from a mixer of all inputs. This makes possible
6853 * 6-channel independent captures.
6855 * In addition, an independent DAC for the multi-playback (not used in this
6858 #define ALC882_DIGOUT_NID 0x06
6859 #define ALC882_DIGIN_NID 0x0a
6860 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6861 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6862 #define ALC1200_DIGOUT_NID 0x10
6865 static struct hda_channel_mode alc882_ch_modes[1] = {
6870 static hda_nid_t alc882_dac_nids[4] = {
6871 /* front, rear, clfe, rear_surr */
6872 0x02, 0x03, 0x04, 0x05
6874 #define alc883_dac_nids alc882_dac_nids
6877 #define alc882_adc_nids alc880_adc_nids
6878 #define alc882_adc_nids_alt alc880_adc_nids_alt
6879 #define alc883_adc_nids alc882_adc_nids_alt
6880 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6881 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6882 #define alc889_adc_nids alc880_adc_nids
6884 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6885 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6886 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6887 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6888 #define alc889_capsrc_nids alc882_capsrc_nids
6891 /* FIXME: should be a matrix-type input source selection */
6893 static struct hda_input_mux alc882_capture_source = {
6897 { "Front Mic", 0x1 },
6903 #define alc883_capture_source alc882_capture_source
6905 static struct hda_input_mux alc889_capture_source = {
6908 { "Front Mic", 0x0 },
6914 static struct hda_input_mux mb5_capture_source = {
6923 static struct hda_input_mux macmini3_capture_source = {
6931 static struct hda_input_mux alc883_3stack_6ch_intel = {
6935 { "Front Mic", 0x0 },
6941 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6949 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6959 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6967 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6971 { "Front Mic", 0x1 },
6976 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6984 static struct hda_input_mux alc889A_mb31_capture_source = {
6988 /* Front Mic (0x01) unused */
6990 /* Line 2 (0x03) unused */
6991 /* CD (0x04) unused? */
6998 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7005 static struct hda_verb alc882_3ST_ch2_init[] = {
7006 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7007 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7008 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7009 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7016 static struct hda_verb alc882_3ST_ch4_init[] = {
7017 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7018 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7019 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7020 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7021 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7028 static struct hda_verb alc882_3ST_ch6_init[] = {
7029 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7030 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7031 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7032 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7033 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7034 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7038 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7039 { 2, alc882_3ST_ch2_init },
7040 { 4, alc882_3ST_ch4_init },
7041 { 6, alc882_3ST_ch6_init },
7044 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7049 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7050 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7051 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7052 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7053 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7054 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7061 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7062 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7063 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7064 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7065 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7066 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7067 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7074 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7075 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7076 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7077 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7078 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7079 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7080 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7081 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7085 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7086 { 2, alc883_3ST_ch2_clevo_init },
7087 { 4, alc883_3ST_ch4_clevo_init },
7088 { 6, alc883_3ST_ch6_clevo_init },
7095 static struct hda_verb alc882_sixstack_ch6_init[] = {
7096 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7097 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7098 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7099 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7106 static struct hda_verb alc882_sixstack_ch8_init[] = {
7107 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7108 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7109 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7110 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7114 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7115 { 6, alc882_sixstack_ch6_init },
7116 { 8, alc882_sixstack_ch8_init },
7120 /* Macbook Air 2,1 */
7122 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7127 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7133 static struct hda_verb alc885_mbp_ch2_init[] = {
7134 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7135 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7136 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7143 static struct hda_verb alc885_mbp_ch4_init[] = {
7144 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7145 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7146 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7147 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7148 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7152 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7153 { 2, alc885_mbp_ch2_init },
7154 { 4, alc885_mbp_ch4_init },
7159 * Speakers/Woofer/HP = Front
7162 static struct hda_verb alc885_mb5_ch2_init[] = {
7163 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7164 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7170 * Speakers/HP = Front
7174 static struct hda_verb alc885_mb5_ch6_init[] = {
7175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7177 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7181 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7182 { 2, alc885_mb5_ch2_init },
7183 { 6, alc885_mb5_ch6_init },
7186 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7191 static struct hda_verb alc883_4ST_ch2_init[] = {
7192 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7193 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7194 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7195 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7196 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7197 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7204 static struct hda_verb alc883_4ST_ch4_init[] = {
7205 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7206 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7207 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7208 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7209 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7210 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7211 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7218 static struct hda_verb alc883_4ST_ch6_init[] = {
7219 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7220 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7221 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7222 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7223 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7224 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7225 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7226 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7233 static struct hda_verb alc883_4ST_ch8_init[] = {
7234 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7235 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7236 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7237 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7238 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7239 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7240 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7241 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7242 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7246 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7247 { 2, alc883_4ST_ch2_init },
7248 { 4, alc883_4ST_ch4_init },
7249 { 6, alc883_4ST_ch6_init },
7250 { 8, alc883_4ST_ch8_init },
7257 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7258 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7259 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7260 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7261 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7268 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7269 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7270 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7271 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7272 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7273 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7280 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7281 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7282 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7283 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7284 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7285 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7286 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7290 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7291 { 2, alc883_3ST_ch2_intel_init },
7292 { 4, alc883_3ST_ch4_intel_init },
7293 { 6, alc883_3ST_ch6_intel_init },
7299 static struct hda_verb alc889_ch2_intel_init[] = {
7300 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7301 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7302 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7303 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7304 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7305 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7312 static struct hda_verb alc889_ch6_intel_init[] = {
7313 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7314 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7315 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7316 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7317 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7318 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7325 static struct hda_verb alc889_ch8_intel_init[] = {
7326 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7327 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7328 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7329 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7330 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7331 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7332 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7336 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7337 { 2, alc889_ch2_intel_init },
7338 { 6, alc889_ch6_intel_init },
7339 { 8, alc889_ch8_intel_init },
7345 static struct hda_verb alc883_sixstack_ch6_init[] = {
7346 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7347 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7348 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7349 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7356 static struct hda_verb alc883_sixstack_ch8_init[] = {
7357 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7358 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7359 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7360 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7364 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7365 { 6, alc883_sixstack_ch6_init },
7366 { 8, alc883_sixstack_ch8_init },
7370 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7371 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7373 static struct snd_kcontrol_new alc882_base_mixer[] = {
7374 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7375 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7376 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7377 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7378 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7379 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7380 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7381 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7382 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7383 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7385 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7386 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7387 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7388 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7390 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7391 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7392 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7393 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7398 /* Macbook Air 2,1 same control for HP and internal Speaker */
7400 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7401 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7402 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7407 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7408 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7409 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7410 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7411 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7412 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7413 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7414 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7416 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7417 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7418 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7422 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7424 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7425 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7426 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7427 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7428 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7429 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7430 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7432 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7434 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7435 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7436 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7440 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7441 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7442 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7443 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7444 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7445 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7446 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7448 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7449 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7450 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7455 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7456 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7457 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7458 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7459 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7460 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7461 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7463 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7464 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7469 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7470 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7471 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7472 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7473 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7475 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7477 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7478 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7482 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7483 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7484 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7485 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7486 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7487 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7488 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7489 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7492 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7493 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7494 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7495 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7499 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7500 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7502 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7503 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7504 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7506 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7507 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7508 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7509 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7510 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7511 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7512 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7513 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7514 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7515 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7519 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7520 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7521 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7523 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7524 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7525 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7526 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7527 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7528 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7529 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7533 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7535 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7536 .name = "Channel Mode",
7537 .info = alc_ch_mode_info,
7538 .get = alc_ch_mode_get,
7539 .put = alc_ch_mode_put,
7544 static struct hda_verb alc882_base_init_verbs[] = {
7545 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7549 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7550 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7552 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7553 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7555 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7556 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7558 /* Front Pin: output 0 (0x0c) */
7559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7561 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7562 /* Rear Pin: output 1 (0x0d) */
7563 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7565 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7566 /* CLFE Pin: output 2 (0x0e) */
7567 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7568 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7569 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7570 /* Side Pin: output 3 (0x0f) */
7571 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7572 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7573 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7574 /* Mic (rear) pin: input vref at 80% */
7575 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7576 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7577 /* Front Mic pin: input vref at 80% */
7578 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7579 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7580 /* Line In pin: input */
7581 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7582 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7583 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7584 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7585 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7586 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7587 /* CD pin widget for input */
7588 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7590 /* FIXME: use matrix-type input source selection */
7591 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
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 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7599 /* ADC3: mute amp left and right */
7600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7601 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7606 static struct hda_verb alc882_adc1_init_verbs[] = {
7607 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7609 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7612 /* ADC1: mute amp left and right */
7613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7614 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7618 static struct hda_verb alc882_eapd_verbs[] = {
7619 /* change to EAPD mode */
7620 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7621 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7625 static struct hda_verb alc889_eapd_verbs[] = {
7626 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7627 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7631 static struct hda_verb alc_hp15_unsol_verbs[] = {
7632 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7633 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7637 static struct hda_verb alc885_init_verbs[] = {
7638 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7648 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7649 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7651 /* Front HP Pin: output 0 (0x0c) */
7652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7654 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7655 /* Front Pin: output 0 (0x0c) */
7656 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7658 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7659 /* Rear Pin: output 1 (0x0d) */
7660 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7661 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7662 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7663 /* CLFE Pin: output 2 (0x0e) */
7664 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7665 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7666 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7667 /* Side Pin: output 3 (0x0f) */
7668 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7669 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7670 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7671 /* Mic (rear) pin: input vref at 80% */
7672 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7673 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7674 /* Front Mic pin: input vref at 80% */
7675 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7676 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7677 /* Line In pin: input */
7678 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7679 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7681 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7683 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7685 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7687 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7688 /* ADC2: mute amp left and right */
7689 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7690 /* ADC3: mute amp left and right */
7691 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7696 static struct hda_verb alc885_init_input_verbs[] = {
7697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7704 /* Unmute Selector 24h and set the default input to front mic */
7705 static struct hda_verb alc889_init_input_verbs[] = {
7706 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7712 #define alc883_init_verbs alc882_base_init_verbs
7715 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7716 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7717 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7718 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7719 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7720 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7721 /* FIXME: this looks suspicious...
7722 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7723 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7728 static struct hda_verb alc882_macpro_init_verbs[] = {
7729 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7733 /* Front Pin: output 0 (0x0c) */
7734 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7735 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7736 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7737 /* Front Mic pin: input vref at 80% */
7738 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7739 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7740 /* Speaker: output */
7741 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7742 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7743 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7744 /* Headphone output (output 0 - 0x0c) */
7745 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7746 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7747 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7749 /* FIXME: use matrix-type input source selection */
7750 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7751 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7752 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7753 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7754 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7755 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7757 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7758 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7759 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7760 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7763 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7765 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7766 /* ADC1: mute amp left and right */
7767 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7768 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7769 /* ADC2: mute amp left and right */
7770 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7771 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7772 /* ADC3: mute amp left and right */
7773 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7774 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7780 static struct hda_verb alc885_mb5_init_verbs[] = {
7782 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7783 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7784 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7785 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7788 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7789 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7790 /* Surround mixer */
7791 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7792 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7793 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7795 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7796 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7797 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7799 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7800 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7801 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7802 /* Front Pin (0x0c) */
7803 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7804 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7805 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7806 /* LFE Pin (0x0e) */
7807 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7808 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7809 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7813 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7814 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7815 /* Front Mic pin: input vref at 80% */
7816 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7817 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7820 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7822 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7823 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7824 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7825 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7830 static struct hda_verb alc885_macmini3_init_verbs[] = {
7832 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7833 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7834 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7835 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7840 /* Surround mixer */
7841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7850 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7851 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7852 /* Front Pin (0x0c) */
7853 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7854 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7855 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7856 /* LFE Pin (0x0e) */
7857 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7858 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7859 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7861 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7862 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7863 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7864 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7866 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7867 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7869 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7870 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7871 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7872 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7877 static struct hda_verb alc885_mba21_init_verbs[] = {
7878 /*Internal and HP Speaker Mixer*/
7879 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7882 /*Internal Speaker Pin (0x0c)*/
7883 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7885 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7886 /* HP Pin: output 0 (0x0e) */
7887 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7888 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7889 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7890 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7891 /* Line in (is hp when jack connected)*/
7892 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7893 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7899 /* Macbook Pro rev3 */
7900 static struct hda_verb alc885_mbp3_init_verbs[] = {
7901 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7906 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7907 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7908 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7910 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7913 /* Front Pin: output 0 (0x0c) */
7914 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7915 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7916 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7917 /* HP Pin: output 0 (0x0e) */
7918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7919 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7920 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7921 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7922 /* Mic (rear) pin: input vref at 80% */
7923 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7924 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7925 /* Front Mic pin: input vref at 80% */
7926 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7928 /* Line In pin: use output 1 when in LineOut mode */
7929 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7931 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7933 /* FIXME: use matrix-type input source selection */
7934 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7935 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7936 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7937 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7938 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7939 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7941 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7942 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7943 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7944 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7946 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7947 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7948 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7949 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7950 /* ADC1: mute amp left and right */
7951 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7952 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7953 /* ADC2: mute amp left and right */
7954 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7955 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7956 /* ADC3: mute amp left and right */
7957 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7958 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7964 static struct hda_verb alc885_imac91_init_verbs[] = {
7965 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7967 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7970 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7971 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7972 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7973 /* HP Pin: output 0 (0x0c) */
7974 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7975 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7976 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7977 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7978 /* Internal Speakers: output 0 (0x0d) */
7979 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7980 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7981 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7982 /* Mic (rear) pin: input vref at 80% */
7983 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7984 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7985 /* Front Mic pin: input vref at 80% */
7986 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7987 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7988 /* Line In pin: use output 1 when in LineOut mode */
7989 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7990 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7991 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7993 /* FIXME: use matrix-type input source selection */
7994 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7995 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7996 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7997 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7998 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8001 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8002 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8006 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8007 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8008 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8010 /* ADC1: mute amp left and right */
8011 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8012 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8013 /* ADC2: mute amp left and right */
8014 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8015 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8016 /* ADC3: mute amp left and right */
8017 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8018 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8023 /* iMac 24 mixer. */
8024 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8025 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8026 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8030 /* iMac 24 init verbs. */
8031 static struct hda_verb alc885_imac24_init_verbs[] = {
8032 /* Internal speakers: output 0 (0x0c) */
8033 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8034 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8035 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8036 /* Internal speakers: output 0 (0x0c) */
8037 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8038 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8039 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8040 /* Headphone: output 0 (0x0c) */
8041 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8042 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8043 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8044 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8045 /* Front Mic: input vref at 80% */
8046 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8047 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8051 /* Toggle speaker-output according to the hp-jack state */
8052 static void alc885_imac24_setup(struct hda_codec *codec)
8054 struct alc_spec *spec = codec->spec;
8056 spec->autocfg.hp_pins[0] = 0x14;
8057 spec->autocfg.speaker_pins[0] = 0x18;
8058 spec->autocfg.speaker_pins[1] = 0x1a;
8061 #define alc885_mb5_setup alc885_imac24_setup
8062 #define alc885_macmini3_setup alc885_imac24_setup
8064 /* Macbook Air 2,1 */
8065 static void alc885_mba21_setup(struct hda_codec *codec)
8067 struct alc_spec *spec = codec->spec;
8069 spec->autocfg.hp_pins[0] = 0x14;
8070 spec->autocfg.speaker_pins[0] = 0x18;
8075 static void alc885_mbp3_setup(struct hda_codec *codec)
8077 struct alc_spec *spec = codec->spec;
8079 spec->autocfg.hp_pins[0] = 0x15;
8080 spec->autocfg.speaker_pins[0] = 0x14;
8083 static void alc885_imac91_setup(struct hda_codec *codec)
8085 struct alc_spec *spec = codec->spec;
8087 spec->autocfg.hp_pins[0] = 0x14;
8088 spec->autocfg.speaker_pins[0] = 0x15;
8089 spec->autocfg.speaker_pins[1] = 0x1a;
8092 static struct hda_verb alc882_targa_verbs[] = {
8093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8094 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8096 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8097 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8099 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8100 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8101 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8103 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8107 /* toggle speaker-output according to the hp-jack state */
8108 static void alc882_targa_automute(struct hda_codec *codec)
8110 struct alc_spec *spec = codec->spec;
8111 alc_automute_amp(codec);
8112 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8113 spec->jack_present ? 1 : 3);
8116 static void alc882_targa_setup(struct hda_codec *codec)
8118 struct alc_spec *spec = codec->spec;
8120 spec->autocfg.hp_pins[0] = 0x14;
8121 spec->autocfg.speaker_pins[0] = 0x1b;
8124 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8126 if ((res >> 26) == ALC880_HP_EVENT)
8127 alc882_targa_automute(codec);
8130 static struct hda_verb alc882_asus_a7j_verbs[] = {
8131 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8132 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8134 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8135 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8136 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8138 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8139 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8140 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8142 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8143 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8144 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8148 static struct hda_verb alc882_asus_a7m_verbs[] = {
8149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8153 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8154 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8156 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8157 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8158 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8160 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8161 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8162 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8166 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8168 unsigned int gpiostate, gpiomask, gpiodir;
8170 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8171 AC_VERB_GET_GPIO_DATA, 0);
8174 gpiostate |= (1 << pin);
8176 gpiostate &= ~(1 << pin);
8178 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8179 AC_VERB_GET_GPIO_MASK, 0);
8180 gpiomask |= (1 << pin);
8182 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8183 AC_VERB_GET_GPIO_DIRECTION, 0);
8184 gpiodir |= (1 << pin);
8187 snd_hda_codec_write(codec, codec->afg, 0,
8188 AC_VERB_SET_GPIO_MASK, gpiomask);
8189 snd_hda_codec_write(codec, codec->afg, 0,
8190 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8194 snd_hda_codec_write(codec, codec->afg, 0,
8195 AC_VERB_SET_GPIO_DATA, gpiostate);
8198 /* set up GPIO at initialization */
8199 static void alc885_macpro_init_hook(struct hda_codec *codec)
8201 alc882_gpio_mute(codec, 0, 0);
8202 alc882_gpio_mute(codec, 1, 0);
8205 /* set up GPIO and update auto-muting at initialization */
8206 static void alc885_imac24_init_hook(struct hda_codec *codec)
8208 alc885_macpro_init_hook(codec);
8209 alc_automute_amp(codec);
8213 * generic initialization of ADC, input mixers and output mixers
8215 static struct hda_verb alc883_auto_init_verbs[] = {
8217 * Unmute ADC0-2 and set the default input to mic-in
8219 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8220 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8221 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8222 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8225 * Set up output mixers (0x0c - 0x0f)
8227 /* set vol=0 to output mixers */
8228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8229 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8230 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8231 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8232 /* set up input amps for analog loopback */
8233 /* Amp Indices: DAC = 0, mixer = 1 */
8234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8236 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8237 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8238 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8239 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8240 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8241 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8242 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8243 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8245 /* FIXME: use matrix-type input source selection */
8246 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8248 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8250 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8254 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8255 static struct hda_verb alc889A_mb31_ch2_init[] = {
8256 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8257 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8258 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8259 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8263 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8264 static struct hda_verb alc889A_mb31_ch4_init[] = {
8265 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8266 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8267 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8272 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8273 static struct hda_verb alc889A_mb31_ch5_init[] = {
8274 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8275 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8276 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8277 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8281 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8282 static struct hda_verb alc889A_mb31_ch6_init[] = {
8283 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8284 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8286 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8290 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8291 { 2, alc889A_mb31_ch2_init },
8292 { 4, alc889A_mb31_ch4_init },
8293 { 5, alc889A_mb31_ch5_init },
8294 { 6, alc889A_mb31_ch6_init },
8297 static struct hda_verb alc883_medion_eapd_verbs[] = {
8298 /* eanable EAPD on medion laptop */
8299 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8300 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8304 #define alc883_base_mixer alc882_base_mixer
8306 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8307 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8308 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8309 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8310 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8311 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8312 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8313 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8315 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8317 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8318 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8319 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8323 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8324 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8325 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8326 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8327 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8328 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8329 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8330 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8331 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8332 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8333 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8337 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8338 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8339 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8340 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8341 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8343 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8344 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8345 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8346 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8347 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8351 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8352 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8353 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8354 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8355 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8356 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8360 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8361 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8362 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8363 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8364 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8368 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8369 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8370 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8371 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8372 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8373 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8374 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8375 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8376 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8377 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8378 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8379 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8380 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8381 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8382 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8383 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8384 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8385 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8386 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8387 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8391 static struct snd_kcontrol_new alc883_3ST_6ch_intel_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_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8395 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8396 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8398 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8399 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8400 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8401 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8402 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8403 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8404 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8405 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8406 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8407 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8408 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8409 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8410 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8411 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8415 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8416 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8417 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8418 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8419 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8420 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8422 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8423 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8424 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8425 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8426 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8428 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8429 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8431 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8433 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8434 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8439 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8440 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8441 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8442 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8443 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8444 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8445 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8446 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8447 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8448 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8449 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8450 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8451 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8452 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8454 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8456 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8457 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8458 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8462 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8463 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8464 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8466 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8467 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8468 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8469 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8470 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8471 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8472 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8476 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8477 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8478 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8479 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8483 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8484 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8485 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8486 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8487 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8488 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8489 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8491 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8492 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8493 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8494 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8495 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8499 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8500 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8501 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8502 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8503 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8504 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8508 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8509 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8510 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8511 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8512 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8513 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8515 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8516 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8520 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8521 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8522 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8523 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8524 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8525 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8526 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8527 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8528 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8529 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8533 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8534 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8535 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8536 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8537 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8538 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8541 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8542 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8546 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8547 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8548 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8549 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8550 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8551 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8553 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8554 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8558 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8559 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8560 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8561 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8562 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8563 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8564 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8565 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8566 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8567 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8571 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8572 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8573 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8574 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8575 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8576 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8577 0x0d, 1, 0x0, HDA_OUTPUT),
8578 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8579 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8580 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8581 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8582 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8583 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8584 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8585 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8586 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8588 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8590 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8591 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8592 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8596 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8598 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8599 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8600 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8601 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8602 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8604 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8605 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8606 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8607 /* Output switches */
8608 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8609 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8610 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8612 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8613 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8617 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8618 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8622 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8623 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8624 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8625 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8627 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8632 static struct hda_bind_ctls alc883_bind_cap_vol = {
8633 .ops = &snd_hda_bind_vol,
8635 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8636 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8641 static struct hda_bind_ctls alc883_bind_cap_switch = {
8642 .ops = &snd_hda_bind_sw,
8644 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8645 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8650 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8651 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8652 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8653 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8654 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8655 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8657 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8662 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8663 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8664 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8666 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8667 /* .name = "Capture Source", */
8668 .name = "Input Source",
8670 .info = alc_mux_enum_info,
8671 .get = alc_mux_enum_get,
8672 .put = alc_mux_enum_put,
8677 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8680 .name = "Channel Mode",
8681 .info = alc_ch_mode_info,
8682 .get = alc_ch_mode_get,
8683 .put = alc_ch_mode_put,
8688 /* toggle speaker-output according to the hp-jack state */
8689 static void alc883_mitac_setup(struct hda_codec *codec)
8691 struct alc_spec *spec = codec->spec;
8693 spec->autocfg.hp_pins[0] = 0x15;
8694 spec->autocfg.speaker_pins[0] = 0x14;
8695 spec->autocfg.speaker_pins[1] = 0x17;
8698 /* auto-toggle front mic */
8700 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8702 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8704 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8708 static struct hda_verb alc883_mitac_verbs[] = {
8710 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8713 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8714 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8716 /* enable unsolicited event */
8717 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8718 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8723 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8725 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8726 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8728 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8730 /* enable unsolicited event */
8732 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8733 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8739 static struct hda_verb alc883_clevo_m720_verbs[] = {
8741 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8744 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8745 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8747 /* enable unsolicited event */
8748 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8749 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8754 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8756 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8759 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8760 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8762 /* enable unsolicited event */
8763 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8768 static struct hda_verb alc883_targa_verbs[] = {
8769 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8770 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8773 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8775 /* Connect Line-Out side jack (SPDIF) to Side */
8776 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8777 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8778 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8779 /* Connect Mic jack to CLFE */
8780 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8781 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8782 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8783 /* Connect Line-in jack to Surround */
8784 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8785 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8786 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8787 /* Connect HP out jack to Front */
8788 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8789 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8790 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8792 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8797 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8798 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8799 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8800 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8804 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8805 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8807 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8812 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8815 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8816 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8817 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8821 static struct hda_verb alc883_haier_w66_verbs[] = {
8822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8825 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8827 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8828 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8829 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8830 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8834 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8835 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8836 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8837 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8838 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8839 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8840 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8841 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8842 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8846 static struct hda_verb alc888_6st_dell_verbs[] = {
8847 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8851 static struct hda_verb alc883_vaiott_verbs[] = {
8853 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8854 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8856 /* enable unsolicited event */
8857 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8862 static void alc888_3st_hp_setup(struct hda_codec *codec)
8864 struct alc_spec *spec = codec->spec;
8866 spec->autocfg.hp_pins[0] = 0x1b;
8867 spec->autocfg.speaker_pins[0] = 0x14;
8868 spec->autocfg.speaker_pins[1] = 0x16;
8869 spec->autocfg.speaker_pins[2] = 0x18;
8872 static struct hda_verb alc888_3st_hp_verbs[] = {
8873 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8874 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8875 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8876 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8883 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8884 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8885 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8886 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8887 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8894 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8895 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8896 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8897 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8898 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8899 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8906 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8907 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8908 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8909 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8910 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8911 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8912 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8916 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8917 { 2, alc888_3st_hp_2ch_init },
8918 { 4, alc888_3st_hp_4ch_init },
8919 { 6, alc888_3st_hp_6ch_init },
8922 /* toggle front-jack and RCA according to the hp-jack state */
8923 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8925 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8927 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8928 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8929 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8930 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8933 /* toggle RCA according to the front-jack state */
8934 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8936 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8938 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8939 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8942 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8945 if ((res >> 26) == ALC880_HP_EVENT)
8946 alc888_lenovo_ms7195_front_automute(codec);
8947 if ((res >> 26) == ALC880_FRONT_EVENT)
8948 alc888_lenovo_ms7195_rca_automute(codec);
8951 static struct hda_verb alc883_medion_md2_verbs[] = {
8952 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8955 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8957 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8961 /* toggle speaker-output according to the hp-jack state */
8962 static void alc883_medion_md2_setup(struct hda_codec *codec)
8964 struct alc_spec *spec = codec->spec;
8966 spec->autocfg.hp_pins[0] = 0x14;
8967 spec->autocfg.speaker_pins[0] = 0x15;
8970 /* toggle speaker-output according to the hp-jack state */
8971 #define alc883_targa_init_hook alc882_targa_init_hook
8972 #define alc883_targa_unsol_event alc882_targa_unsol_event
8974 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8976 unsigned int present;
8978 present = snd_hda_jack_detect(codec, 0x18);
8979 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8980 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8983 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8985 struct alc_spec *spec = codec->spec;
8987 spec->autocfg.hp_pins[0] = 0x15;
8988 spec->autocfg.speaker_pins[0] = 0x14;
8991 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8993 alc_automute_amp(codec);
8994 alc883_clevo_m720_mic_automute(codec);
8997 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9000 switch (res >> 26) {
9001 case ALC880_MIC_EVENT:
9002 alc883_clevo_m720_mic_automute(codec);
9005 alc_automute_amp_unsol_event(codec, res);
9010 /* toggle speaker-output according to the hp-jack state */
9011 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9013 struct alc_spec *spec = codec->spec;
9015 spec->autocfg.hp_pins[0] = 0x14;
9016 spec->autocfg.speaker_pins[0] = 0x15;
9019 static void alc883_haier_w66_setup(struct hda_codec *codec)
9021 struct alc_spec *spec = codec->spec;
9023 spec->autocfg.hp_pins[0] = 0x1b;
9024 spec->autocfg.speaker_pins[0] = 0x14;
9027 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9029 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9031 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9032 HDA_AMP_MUTE, bits);
9035 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9037 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9039 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9040 HDA_AMP_MUTE, bits);
9041 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9042 HDA_AMP_MUTE, bits);
9045 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9048 if ((res >> 26) == ALC880_HP_EVENT)
9049 alc883_lenovo_101e_all_automute(codec);
9050 if ((res >> 26) == ALC880_FRONT_EVENT)
9051 alc883_lenovo_101e_ispeaker_automute(codec);
9054 /* toggle speaker-output according to the hp-jack state */
9055 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9057 struct alc_spec *spec = codec->spec;
9059 spec->autocfg.hp_pins[0] = 0x14;
9060 spec->autocfg.speaker_pins[0] = 0x15;
9061 spec->autocfg.speaker_pins[1] = 0x16;
9064 static struct hda_verb alc883_acer_eapd_verbs[] = {
9065 /* HP Pin: output 0 (0x0c) */
9066 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9067 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9068 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9069 /* Front Pin: output 0 (0x0c) */
9070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9071 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9072 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9073 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9074 /* eanable EAPD on medion laptop */
9075 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9076 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9077 /* enable unsolicited event */
9078 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9082 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9083 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9084 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9085 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9089 static void alc888_6st_dell_setup(struct hda_codec *codec)
9091 struct alc_spec *spec = codec->spec;
9093 spec->autocfg.hp_pins[0] = 0x1b;
9094 spec->autocfg.speaker_pins[0] = 0x14;
9095 spec->autocfg.speaker_pins[1] = 0x15;
9096 spec->autocfg.speaker_pins[2] = 0x16;
9097 spec->autocfg.speaker_pins[3] = 0x17;
9100 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9102 struct alc_spec *spec = codec->spec;
9104 spec->autocfg.hp_pins[0] = 0x1b;
9105 spec->autocfg.speaker_pins[0] = 0x14;
9106 spec->autocfg.speaker_pins[1] = 0x15;
9107 spec->autocfg.speaker_pins[2] = 0x16;
9108 spec->autocfg.speaker_pins[3] = 0x17;
9109 spec->autocfg.speaker_pins[4] = 0x1a;
9112 static void alc883_vaiott_setup(struct hda_codec *codec)
9114 struct alc_spec *spec = codec->spec;
9116 spec->autocfg.hp_pins[0] = 0x15;
9117 spec->autocfg.speaker_pins[0] = 0x14;
9118 spec->autocfg.speaker_pins[1] = 0x17;
9121 static struct hda_verb alc888_asus_m90v_verbs[] = {
9122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9123 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9124 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9125 /* enable unsolicited event */
9126 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9127 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9131 static void alc883_mode2_setup(struct hda_codec *codec)
9133 struct alc_spec *spec = codec->spec;
9135 spec->autocfg.hp_pins[0] = 0x1b;
9136 spec->autocfg.speaker_pins[0] = 0x14;
9137 spec->autocfg.speaker_pins[1] = 0x15;
9138 spec->autocfg.speaker_pins[2] = 0x16;
9139 spec->ext_mic.pin = 0x18;
9140 spec->int_mic.pin = 0x19;
9141 spec->ext_mic.mux_idx = 0;
9142 spec->int_mic.mux_idx = 1;
9146 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9147 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9148 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9149 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9151 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9152 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9153 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9154 /* enable unsolicited event */
9155 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9159 static void alc883_eee1601_inithook(struct hda_codec *codec)
9161 struct alc_spec *spec = codec->spec;
9163 spec->autocfg.hp_pins[0] = 0x14;
9164 spec->autocfg.speaker_pins[0] = 0x1b;
9165 alc_automute_pin(codec);
9168 static struct hda_verb alc889A_mb31_verbs[] = {
9169 /* Init rear pin (used as headphone output) */
9170 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9171 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9172 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9173 /* Init line pin (used as output in 4ch and 6ch mode) */
9174 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9175 /* Init line 2 pin (used as headphone out by default) */
9176 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9177 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9181 /* Mute speakers according to the headphone jack state */
9182 static void alc889A_mb31_automute(struct hda_codec *codec)
9184 unsigned int present;
9186 /* Mute only in 2ch or 4ch mode */
9187 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9189 present = snd_hda_jack_detect(codec, 0x15);
9190 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9191 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9192 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9193 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9197 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9199 if ((res >> 26) == ALC880_HP_EVENT)
9200 alc889A_mb31_automute(codec);
9204 #ifdef CONFIG_SND_HDA_POWER_SAVE
9205 #define alc882_loopbacks alc880_loopbacks
9208 /* pcm configuration: identical with ALC880 */
9209 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9210 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9211 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9212 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9214 static hda_nid_t alc883_slave_dig_outs[] = {
9215 ALC1200_DIGOUT_NID, 0,
9218 static hda_nid_t alc1200_slave_dig_outs[] = {
9219 ALC883_DIGOUT_NID, 0,
9223 * configuration and preset
9225 static const char *alc882_models[ALC882_MODEL_LAST] = {
9226 [ALC882_3ST_DIG] = "3stack-dig",
9227 [ALC882_6ST_DIG] = "6stack-dig",
9228 [ALC882_ARIMA] = "arima",
9229 [ALC882_W2JC] = "w2jc",
9230 [ALC882_TARGA] = "targa",
9231 [ALC882_ASUS_A7J] = "asus-a7j",
9232 [ALC882_ASUS_A7M] = "asus-a7m",
9233 [ALC885_MACPRO] = "macpro",
9234 [ALC885_MB5] = "mb5",
9235 [ALC885_MACMINI3] = "macmini3",
9236 [ALC885_MBA21] = "mba21",
9237 [ALC885_MBP3] = "mbp3",
9238 [ALC885_IMAC24] = "imac24",
9239 [ALC885_IMAC91] = "imac91",
9240 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9241 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9242 [ALC883_3ST_6ch] = "3stack-6ch",
9243 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9244 [ALC883_TARGA_DIG] = "targa-dig",
9245 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9246 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9247 [ALC883_ACER] = "acer",
9248 [ALC883_ACER_ASPIRE] = "acer-aspire",
9249 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9250 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9251 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9252 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9253 [ALC883_MEDION] = "medion",
9254 [ALC883_MEDION_MD2] = "medion-md2",
9255 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9256 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9257 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9258 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9259 [ALC888_LENOVO_SKY] = "lenovo-sky",
9260 [ALC883_HAIER_W66] = "haier-w66",
9261 [ALC888_3ST_HP] = "3stack-hp",
9262 [ALC888_6ST_DELL] = "6stack-dell",
9263 [ALC883_MITAC] = "mitac",
9264 [ALC883_CLEVO_M540R] = "clevo-m540r",
9265 [ALC883_CLEVO_M720] = "clevo-m720",
9266 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9267 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9268 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9269 [ALC889A_INTEL] = "intel-alc889a",
9270 [ALC889_INTEL] = "intel-x58",
9271 [ALC1200_ASUS_P5Q] = "asus-p5q",
9272 [ALC889A_MB31] = "mb31",
9273 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9274 [ALC882_AUTO] = "auto",
9277 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9278 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9280 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9281 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9282 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9283 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9284 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9285 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9286 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9287 ALC888_ACER_ASPIRE_4930G),
9288 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9289 ALC888_ACER_ASPIRE_4930G),
9290 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9291 ALC888_ACER_ASPIRE_8930G),
9292 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9293 ALC888_ACER_ASPIRE_8930G),
9294 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9295 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9296 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9297 ALC888_ACER_ASPIRE_6530G),
9298 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9299 ALC888_ACER_ASPIRE_6530G),
9300 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9301 ALC888_ACER_ASPIRE_7730G),
9302 /* default Acer -- disabled as it causes more problems.
9303 * model=auto should work fine now
9305 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9307 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9309 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9310 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9311 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9312 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9313 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9314 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9316 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9317 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9318 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9319 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9320 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9321 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9322 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9323 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9324 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9325 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9326 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9328 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9329 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9330 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9331 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9332 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9333 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9334 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9335 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9336 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9338 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9339 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9340 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9341 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9342 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9343 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9344 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9345 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9346 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9347 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9348 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9349 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9350 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9351 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9352 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9353 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9354 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9355 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9356 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9357 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9358 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9359 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9360 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9361 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9362 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9363 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9364 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9365 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9366 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9367 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9368 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9370 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9371 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9372 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9373 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9374 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9375 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9376 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9377 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9378 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9379 ALC883_FUJITSU_PI2515),
9380 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9381 ALC888_FUJITSU_XA3530),
9382 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9383 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9384 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9385 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9386 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9387 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9388 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9389 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9390 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9392 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9393 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9394 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9395 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9396 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9397 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9398 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9403 /* codec SSID table for Intel Mac */
9404 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9405 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9406 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9407 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9408 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9409 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9410 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9411 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9412 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9413 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9414 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9415 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9416 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9417 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9418 * so apparently no perfect solution yet
9420 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9421 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9422 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9426 static struct alc_config_preset alc882_presets[] = {
9427 [ALC882_3ST_DIG] = {
9428 .mixers = { alc882_base_mixer },
9429 .init_verbs = { alc882_base_init_verbs,
9430 alc882_adc1_init_verbs },
9431 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9432 .dac_nids = alc882_dac_nids,
9433 .dig_out_nid = ALC882_DIGOUT_NID,
9434 .dig_in_nid = ALC882_DIGIN_NID,
9435 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9436 .channel_mode = alc882_ch_modes,
9438 .input_mux = &alc882_capture_source,
9440 [ALC882_6ST_DIG] = {
9441 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9442 .init_verbs = { alc882_base_init_verbs,
9443 alc882_adc1_init_verbs },
9444 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9445 .dac_nids = alc882_dac_nids,
9446 .dig_out_nid = ALC882_DIGOUT_NID,
9447 .dig_in_nid = ALC882_DIGIN_NID,
9448 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9449 .channel_mode = alc882_sixstack_modes,
9450 .input_mux = &alc882_capture_source,
9453 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9454 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9455 alc882_eapd_verbs },
9456 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9457 .dac_nids = alc882_dac_nids,
9458 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9459 .channel_mode = alc882_sixstack_modes,
9460 .input_mux = &alc882_capture_source,
9463 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9464 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9465 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9466 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9467 .dac_nids = alc882_dac_nids,
9468 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9469 .channel_mode = alc880_threestack_modes,
9471 .input_mux = &alc882_capture_source,
9472 .dig_out_nid = ALC882_DIGOUT_NID,
9475 .mixers = { alc885_mba21_mixer },
9476 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9478 .dac_nids = alc882_dac_nids,
9479 .channel_mode = alc885_mba21_ch_modes,
9480 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9481 .input_mux = &alc882_capture_source,
9482 .unsol_event = alc_automute_amp_unsol_event,
9483 .setup = alc885_mba21_setup,
9484 .init_hook = alc_automute_amp,
9487 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9488 .init_verbs = { alc885_mbp3_init_verbs,
9489 alc880_gpio1_init_verbs },
9491 .dac_nids = alc882_dac_nids,
9493 .channel_mode = alc885_mbp_4ch_modes,
9494 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9495 .input_mux = &alc882_capture_source,
9496 .dig_out_nid = ALC882_DIGOUT_NID,
9497 .dig_in_nid = ALC882_DIGIN_NID,
9498 .unsol_event = alc_automute_amp_unsol_event,
9499 .setup = alc885_mbp3_setup,
9500 .init_hook = alc_automute_amp,
9503 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9504 .init_verbs = { alc885_mb5_init_verbs,
9505 alc880_gpio1_init_verbs },
9506 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9507 .dac_nids = alc882_dac_nids,
9508 .channel_mode = alc885_mb5_6ch_modes,
9509 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9510 .input_mux = &mb5_capture_source,
9511 .dig_out_nid = ALC882_DIGOUT_NID,
9512 .dig_in_nid = ALC882_DIGIN_NID,
9513 .unsol_event = alc_automute_amp_unsol_event,
9514 .setup = alc885_mb5_setup,
9515 .init_hook = alc_automute_amp,
9517 [ALC885_MACMINI3] = {
9518 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9519 .init_verbs = { alc885_macmini3_init_verbs,
9520 alc880_gpio1_init_verbs },
9521 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9522 .dac_nids = alc882_dac_nids,
9523 .channel_mode = alc885_macmini3_6ch_modes,
9524 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9525 .input_mux = &macmini3_capture_source,
9526 .dig_out_nid = ALC882_DIGOUT_NID,
9527 .dig_in_nid = ALC882_DIGIN_NID,
9528 .unsol_event = alc_automute_amp_unsol_event,
9529 .setup = alc885_macmini3_setup,
9530 .init_hook = alc_automute_amp,
9533 .mixers = { alc882_macpro_mixer },
9534 .init_verbs = { alc882_macpro_init_verbs },
9535 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9536 .dac_nids = alc882_dac_nids,
9537 .dig_out_nid = ALC882_DIGOUT_NID,
9538 .dig_in_nid = ALC882_DIGIN_NID,
9539 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9540 .channel_mode = alc882_ch_modes,
9541 .input_mux = &alc882_capture_source,
9542 .init_hook = alc885_macpro_init_hook,
9545 .mixers = { alc885_imac24_mixer },
9546 .init_verbs = { alc885_imac24_init_verbs },
9547 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9548 .dac_nids = alc882_dac_nids,
9549 .dig_out_nid = ALC882_DIGOUT_NID,
9550 .dig_in_nid = ALC882_DIGIN_NID,
9551 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9552 .channel_mode = alc882_ch_modes,
9553 .input_mux = &alc882_capture_source,
9554 .unsol_event = alc_automute_amp_unsol_event,
9555 .setup = alc885_imac24_setup,
9556 .init_hook = alc885_imac24_init_hook,
9559 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9560 .init_verbs = { alc885_imac91_init_verbs,
9561 alc880_gpio1_init_verbs },
9562 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9563 .dac_nids = alc882_dac_nids,
9564 .channel_mode = alc885_mbp_4ch_modes,
9565 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9566 .input_mux = &alc882_capture_source,
9567 .dig_out_nid = ALC882_DIGOUT_NID,
9568 .dig_in_nid = ALC882_DIGIN_NID,
9569 .unsol_event = alc_automute_amp_unsol_event,
9570 .setup = alc885_imac91_setup,
9571 .init_hook = alc_automute_amp,
9574 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9575 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9576 alc880_gpio3_init_verbs, alc882_targa_verbs},
9577 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9578 .dac_nids = alc882_dac_nids,
9579 .dig_out_nid = ALC882_DIGOUT_NID,
9580 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9581 .adc_nids = alc882_adc_nids,
9582 .capsrc_nids = alc882_capsrc_nids,
9583 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9584 .channel_mode = alc882_3ST_6ch_modes,
9586 .input_mux = &alc882_capture_source,
9587 .unsol_event = alc882_targa_unsol_event,
9588 .setup = alc882_targa_setup,
9589 .init_hook = alc882_targa_automute,
9591 [ALC882_ASUS_A7J] = {
9592 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9593 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9594 alc882_asus_a7j_verbs},
9595 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9596 .dac_nids = alc882_dac_nids,
9597 .dig_out_nid = ALC882_DIGOUT_NID,
9598 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9599 .adc_nids = alc882_adc_nids,
9600 .capsrc_nids = alc882_capsrc_nids,
9601 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9602 .channel_mode = alc882_3ST_6ch_modes,
9604 .input_mux = &alc882_capture_source,
9606 [ALC882_ASUS_A7M] = {
9607 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9608 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9609 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9610 alc882_asus_a7m_verbs },
9611 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9612 .dac_nids = alc882_dac_nids,
9613 .dig_out_nid = ALC882_DIGOUT_NID,
9614 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9615 .channel_mode = alc880_threestack_modes,
9617 .input_mux = &alc882_capture_source,
9619 [ALC883_3ST_2ch_DIG] = {
9620 .mixers = { alc883_3ST_2ch_mixer },
9621 .init_verbs = { alc883_init_verbs },
9622 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9623 .dac_nids = alc883_dac_nids,
9624 .dig_out_nid = ALC883_DIGOUT_NID,
9625 .dig_in_nid = ALC883_DIGIN_NID,
9626 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9627 .channel_mode = alc883_3ST_2ch_modes,
9628 .input_mux = &alc883_capture_source,
9630 [ALC883_3ST_6ch_DIG] = {
9631 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9632 .init_verbs = { alc883_init_verbs },
9633 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9634 .dac_nids = alc883_dac_nids,
9635 .dig_out_nid = ALC883_DIGOUT_NID,
9636 .dig_in_nid = ALC883_DIGIN_NID,
9637 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9638 .channel_mode = alc883_3ST_6ch_modes,
9640 .input_mux = &alc883_capture_source,
9642 [ALC883_3ST_6ch] = {
9643 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9644 .init_verbs = { alc883_init_verbs },
9645 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9646 .dac_nids = alc883_dac_nids,
9647 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9648 .channel_mode = alc883_3ST_6ch_modes,
9650 .input_mux = &alc883_capture_source,
9652 [ALC883_3ST_6ch_INTEL] = {
9653 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9654 .init_verbs = { alc883_init_verbs },
9655 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9656 .dac_nids = alc883_dac_nids,
9657 .dig_out_nid = ALC883_DIGOUT_NID,
9658 .dig_in_nid = ALC883_DIGIN_NID,
9659 .slave_dig_outs = alc883_slave_dig_outs,
9660 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9661 .channel_mode = alc883_3ST_6ch_intel_modes,
9663 .input_mux = &alc883_3stack_6ch_intel,
9666 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9667 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9668 alc_hp15_unsol_verbs },
9669 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9670 .dac_nids = alc883_dac_nids,
9671 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9672 .adc_nids = alc889_adc_nids,
9673 .dig_out_nid = ALC883_DIGOUT_NID,
9674 .dig_in_nid = ALC883_DIGIN_NID,
9675 .slave_dig_outs = alc883_slave_dig_outs,
9676 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9677 .channel_mode = alc889_8ch_intel_modes,
9678 .capsrc_nids = alc889_capsrc_nids,
9679 .input_mux = &alc889_capture_source,
9680 .setup = alc889_automute_setup,
9681 .init_hook = alc_automute_amp,
9682 .unsol_event = alc_automute_amp_unsol_event,
9686 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9687 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9688 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9689 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9690 .dac_nids = alc883_dac_nids,
9691 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9692 .adc_nids = alc889_adc_nids,
9693 .dig_out_nid = ALC883_DIGOUT_NID,
9694 .dig_in_nid = ALC883_DIGIN_NID,
9695 .slave_dig_outs = alc883_slave_dig_outs,
9696 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9697 .channel_mode = alc889_8ch_intel_modes,
9698 .capsrc_nids = alc889_capsrc_nids,
9699 .input_mux = &alc889_capture_source,
9700 .setup = alc889_automute_setup,
9701 .init_hook = alc889_intel_init_hook,
9702 .unsol_event = alc_automute_amp_unsol_event,
9705 [ALC883_6ST_DIG] = {
9706 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9707 .init_verbs = { alc883_init_verbs },
9708 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9709 .dac_nids = alc883_dac_nids,
9710 .dig_out_nid = ALC883_DIGOUT_NID,
9711 .dig_in_nid = ALC883_DIGIN_NID,
9712 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9713 .channel_mode = alc883_sixstack_modes,
9714 .input_mux = &alc883_capture_source,
9716 [ALC883_TARGA_DIG] = {
9717 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9718 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9719 alc883_targa_verbs},
9720 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9721 .dac_nids = alc883_dac_nids,
9722 .dig_out_nid = ALC883_DIGOUT_NID,
9723 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9724 .channel_mode = alc883_3ST_6ch_modes,
9726 .input_mux = &alc883_capture_source,
9727 .unsol_event = alc883_targa_unsol_event,
9728 .setup = alc882_targa_setup,
9729 .init_hook = alc882_targa_automute,
9731 [ALC883_TARGA_2ch_DIG] = {
9732 .mixers = { alc883_targa_2ch_mixer},
9733 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9734 alc883_targa_verbs},
9735 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9736 .dac_nids = alc883_dac_nids,
9737 .adc_nids = alc883_adc_nids_alt,
9738 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9739 .capsrc_nids = alc883_capsrc_nids,
9740 .dig_out_nid = ALC883_DIGOUT_NID,
9741 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9742 .channel_mode = alc883_3ST_2ch_modes,
9743 .input_mux = &alc883_capture_source,
9744 .unsol_event = alc883_targa_unsol_event,
9745 .setup = alc882_targa_setup,
9746 .init_hook = alc882_targa_automute,
9748 [ALC883_TARGA_8ch_DIG] = {
9749 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9750 alc883_chmode_mixer },
9751 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9752 alc883_targa_verbs },
9753 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9754 .dac_nids = alc883_dac_nids,
9755 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9756 .adc_nids = alc883_adc_nids_rev,
9757 .capsrc_nids = alc883_capsrc_nids_rev,
9758 .dig_out_nid = ALC883_DIGOUT_NID,
9759 .dig_in_nid = ALC883_DIGIN_NID,
9760 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9761 .channel_mode = alc883_4ST_8ch_modes,
9763 .input_mux = &alc883_capture_source,
9764 .unsol_event = alc883_targa_unsol_event,
9765 .setup = alc882_targa_setup,
9766 .init_hook = alc882_targa_automute,
9769 .mixers = { alc883_base_mixer },
9770 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9771 * and the headphone jack. Turn this on and rely on the
9772 * standard mute methods whenever the user wants to turn
9773 * these outputs off.
9775 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9776 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9777 .dac_nids = alc883_dac_nids,
9778 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9779 .channel_mode = alc883_3ST_2ch_modes,
9780 .input_mux = &alc883_capture_source,
9782 [ALC883_ACER_ASPIRE] = {
9783 .mixers = { alc883_acer_aspire_mixer },
9784 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9785 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9786 .dac_nids = alc883_dac_nids,
9787 .dig_out_nid = ALC883_DIGOUT_NID,
9788 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9789 .channel_mode = alc883_3ST_2ch_modes,
9790 .input_mux = &alc883_capture_source,
9791 .unsol_event = alc_automute_amp_unsol_event,
9792 .setup = alc883_acer_aspire_setup,
9793 .init_hook = alc_automute_amp,
9795 [ALC888_ACER_ASPIRE_4930G] = {
9796 .mixers = { alc888_base_mixer,
9797 alc883_chmode_mixer },
9798 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9799 alc888_acer_aspire_4930g_verbs },
9800 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9801 .dac_nids = alc883_dac_nids,
9802 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9803 .adc_nids = alc883_adc_nids_rev,
9804 .capsrc_nids = alc883_capsrc_nids_rev,
9805 .dig_out_nid = ALC883_DIGOUT_NID,
9806 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9807 .channel_mode = alc883_3ST_6ch_modes,
9809 .const_channel_count = 6,
9811 ARRAY_SIZE(alc888_2_capture_sources),
9812 .input_mux = alc888_2_capture_sources,
9813 .unsol_event = alc_automute_amp_unsol_event,
9814 .setup = alc888_acer_aspire_4930g_setup,
9815 .init_hook = alc_automute_amp,
9817 [ALC888_ACER_ASPIRE_6530G] = {
9818 .mixers = { alc888_acer_aspire_6530_mixer },
9819 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9820 alc888_acer_aspire_6530g_verbs },
9821 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9822 .dac_nids = alc883_dac_nids,
9823 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9824 .adc_nids = alc883_adc_nids_rev,
9825 .capsrc_nids = alc883_capsrc_nids_rev,
9826 .dig_out_nid = ALC883_DIGOUT_NID,
9827 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9828 .channel_mode = alc883_3ST_2ch_modes,
9830 ARRAY_SIZE(alc888_2_capture_sources),
9831 .input_mux = alc888_acer_aspire_6530_sources,
9832 .unsol_event = alc_automute_amp_unsol_event,
9833 .setup = alc888_acer_aspire_6530g_setup,
9834 .init_hook = alc_automute_amp,
9836 [ALC888_ACER_ASPIRE_8930G] = {
9837 .mixers = { alc889_acer_aspire_8930g_mixer,
9838 alc883_chmode_mixer },
9839 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9840 alc889_acer_aspire_8930g_verbs,
9842 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9843 .dac_nids = alc883_dac_nids,
9844 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9845 .adc_nids = alc889_adc_nids,
9846 .capsrc_nids = alc889_capsrc_nids,
9847 .dig_out_nid = ALC883_DIGOUT_NID,
9848 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9849 .channel_mode = alc883_3ST_6ch_modes,
9851 .const_channel_count = 6,
9853 ARRAY_SIZE(alc889_capture_sources),
9854 .input_mux = alc889_capture_sources,
9855 .unsol_event = alc_automute_amp_unsol_event,
9856 .setup = alc889_acer_aspire_8930g_setup,
9857 .init_hook = alc_automute_amp,
9858 #ifdef CONFIG_SND_HDA_POWER_SAVE
9859 .power_hook = alc_power_eapd,
9862 [ALC888_ACER_ASPIRE_7730G] = {
9863 .mixers = { alc883_3ST_6ch_mixer,
9864 alc883_chmode_mixer },
9865 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9866 alc888_acer_aspire_7730G_verbs },
9867 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9868 .dac_nids = alc883_dac_nids,
9869 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9870 .adc_nids = alc883_adc_nids_rev,
9871 .capsrc_nids = alc883_capsrc_nids_rev,
9872 .dig_out_nid = ALC883_DIGOUT_NID,
9873 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9874 .channel_mode = alc883_3ST_6ch_modes,
9876 .const_channel_count = 6,
9877 .input_mux = &alc883_capture_source,
9878 .unsol_event = alc_automute_amp_unsol_event,
9879 .setup = alc888_acer_aspire_6530g_setup,
9880 .init_hook = alc_automute_amp,
9883 .mixers = { alc883_fivestack_mixer,
9884 alc883_chmode_mixer },
9885 .init_verbs = { alc883_init_verbs,
9886 alc883_medion_eapd_verbs },
9887 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9888 .dac_nids = alc883_dac_nids,
9889 .adc_nids = alc883_adc_nids_alt,
9890 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9891 .capsrc_nids = alc883_capsrc_nids,
9892 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9893 .channel_mode = alc883_sixstack_modes,
9894 .input_mux = &alc883_capture_source,
9896 [ALC883_MEDION_MD2] = {
9897 .mixers = { alc883_medion_md2_mixer},
9898 .init_verbs = { alc883_init_verbs, alc883_medion_md2_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_medion_md2_setup,
9907 .init_hook = alc_automute_amp,
9909 [ALC883_LAPTOP_EAPD] = {
9910 .mixers = { alc883_base_mixer },
9911 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9912 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9913 .dac_nids = alc883_dac_nids,
9914 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9915 .channel_mode = alc883_3ST_2ch_modes,
9916 .input_mux = &alc883_capture_source,
9918 [ALC883_CLEVO_M540R] = {
9919 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9920 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9921 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9922 .dac_nids = alc883_dac_nids,
9923 .dig_out_nid = ALC883_DIGOUT_NID,
9924 .dig_in_nid = ALC883_DIGIN_NID,
9925 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9926 .channel_mode = alc883_3ST_6ch_clevo_modes,
9928 .input_mux = &alc883_capture_source,
9929 /* This machine has the hardware HP auto-muting, thus
9930 * we need no software mute via unsol event
9933 [ALC883_CLEVO_M720] = {
9934 .mixers = { alc883_clevo_m720_mixer },
9935 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9936 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9937 .dac_nids = alc883_dac_nids,
9938 .dig_out_nid = ALC883_DIGOUT_NID,
9939 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9940 .channel_mode = alc883_3ST_2ch_modes,
9941 .input_mux = &alc883_capture_source,
9942 .unsol_event = alc883_clevo_m720_unsol_event,
9943 .setup = alc883_clevo_m720_setup,
9944 .init_hook = alc883_clevo_m720_init_hook,
9946 [ALC883_LENOVO_101E_2ch] = {
9947 .mixers = { alc883_lenovo_101e_2ch_mixer},
9948 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9949 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9950 .dac_nids = alc883_dac_nids,
9951 .adc_nids = alc883_adc_nids_alt,
9952 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9953 .capsrc_nids = alc883_capsrc_nids,
9954 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9955 .channel_mode = alc883_3ST_2ch_modes,
9956 .input_mux = &alc883_lenovo_101e_capture_source,
9957 .unsol_event = alc883_lenovo_101e_unsol_event,
9958 .init_hook = alc883_lenovo_101e_all_automute,
9960 [ALC883_LENOVO_NB0763] = {
9961 .mixers = { alc883_lenovo_nb0763_mixer },
9962 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9963 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9964 .dac_nids = alc883_dac_nids,
9965 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9966 .channel_mode = alc883_3ST_2ch_modes,
9968 .input_mux = &alc883_lenovo_nb0763_capture_source,
9969 .unsol_event = alc_automute_amp_unsol_event,
9970 .setup = alc883_medion_md2_setup,
9971 .init_hook = alc_automute_amp,
9973 [ALC888_LENOVO_MS7195_DIG] = {
9974 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9975 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9976 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9977 .dac_nids = alc883_dac_nids,
9978 .dig_out_nid = ALC883_DIGOUT_NID,
9979 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9980 .channel_mode = alc883_3ST_6ch_modes,
9982 .input_mux = &alc883_capture_source,
9983 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9984 .init_hook = alc888_lenovo_ms7195_front_automute,
9986 [ALC883_HAIER_W66] = {
9987 .mixers = { alc883_targa_2ch_mixer},
9988 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9989 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9990 .dac_nids = alc883_dac_nids,
9991 .dig_out_nid = ALC883_DIGOUT_NID,
9992 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9993 .channel_mode = alc883_3ST_2ch_modes,
9994 .input_mux = &alc883_capture_source,
9995 .unsol_event = alc_automute_amp_unsol_event,
9996 .setup = alc883_haier_w66_setup,
9997 .init_hook = alc_automute_amp,
10000 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10001 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10002 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10003 .dac_nids = alc883_dac_nids,
10004 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10005 .channel_mode = alc888_3st_hp_modes,
10007 .input_mux = &alc883_capture_source,
10008 .unsol_event = alc_automute_amp_unsol_event,
10009 .setup = alc888_3st_hp_setup,
10010 .init_hook = alc_automute_amp,
10012 [ALC888_6ST_DELL] = {
10013 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10014 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10015 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10016 .dac_nids = alc883_dac_nids,
10017 .dig_out_nid = ALC883_DIGOUT_NID,
10018 .dig_in_nid = ALC883_DIGIN_NID,
10019 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10020 .channel_mode = alc883_sixstack_modes,
10021 .input_mux = &alc883_capture_source,
10022 .unsol_event = alc_automute_amp_unsol_event,
10023 .setup = alc888_6st_dell_setup,
10024 .init_hook = alc_automute_amp,
10027 .mixers = { alc883_mitac_mixer },
10028 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10029 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10030 .dac_nids = alc883_dac_nids,
10031 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10032 .channel_mode = alc883_3ST_2ch_modes,
10033 .input_mux = &alc883_capture_source,
10034 .unsol_event = alc_automute_amp_unsol_event,
10035 .setup = alc883_mitac_setup,
10036 .init_hook = alc_automute_amp,
10038 [ALC883_FUJITSU_PI2515] = {
10039 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10040 .init_verbs = { alc883_init_verbs,
10041 alc883_2ch_fujitsu_pi2515_verbs},
10042 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10043 .dac_nids = alc883_dac_nids,
10044 .dig_out_nid = ALC883_DIGOUT_NID,
10045 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10046 .channel_mode = alc883_3ST_2ch_modes,
10047 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10048 .unsol_event = alc_automute_amp_unsol_event,
10049 .setup = alc883_2ch_fujitsu_pi2515_setup,
10050 .init_hook = alc_automute_amp,
10052 [ALC888_FUJITSU_XA3530] = {
10053 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10054 .init_verbs = { alc883_init_verbs,
10055 alc888_fujitsu_xa3530_verbs },
10056 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10057 .dac_nids = alc883_dac_nids,
10058 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10059 .adc_nids = alc883_adc_nids_rev,
10060 .capsrc_nids = alc883_capsrc_nids_rev,
10061 .dig_out_nid = ALC883_DIGOUT_NID,
10062 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10063 .channel_mode = alc888_4ST_8ch_intel_modes,
10065 ARRAY_SIZE(alc888_2_capture_sources),
10066 .input_mux = alc888_2_capture_sources,
10067 .unsol_event = alc_automute_amp_unsol_event,
10068 .setup = alc888_fujitsu_xa3530_setup,
10069 .init_hook = alc_automute_amp,
10071 [ALC888_LENOVO_SKY] = {
10072 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10073 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10074 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10075 .dac_nids = alc883_dac_nids,
10076 .dig_out_nid = ALC883_DIGOUT_NID,
10077 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10078 .channel_mode = alc883_sixstack_modes,
10080 .input_mux = &alc883_lenovo_sky_capture_source,
10081 .unsol_event = alc_automute_amp_unsol_event,
10082 .setup = alc888_lenovo_sky_setup,
10083 .init_hook = alc_automute_amp,
10085 [ALC888_ASUS_M90V] = {
10086 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10087 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10088 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10089 .dac_nids = alc883_dac_nids,
10090 .dig_out_nid = ALC883_DIGOUT_NID,
10091 .dig_in_nid = ALC883_DIGIN_NID,
10092 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10093 .channel_mode = alc883_3ST_6ch_modes,
10095 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10096 .unsol_event = alc_sku_unsol_event,
10097 .setup = alc883_mode2_setup,
10098 .init_hook = alc_inithook,
10100 [ALC888_ASUS_EEE1601] = {
10101 .mixers = { alc883_asus_eee1601_mixer },
10102 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10103 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10104 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10105 .dac_nids = alc883_dac_nids,
10106 .dig_out_nid = ALC883_DIGOUT_NID,
10107 .dig_in_nid = ALC883_DIGIN_NID,
10108 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10109 .channel_mode = alc883_3ST_2ch_modes,
10111 .input_mux = &alc883_asus_eee1601_capture_source,
10112 .unsol_event = alc_sku_unsol_event,
10113 .init_hook = alc883_eee1601_inithook,
10115 [ALC1200_ASUS_P5Q] = {
10116 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10117 .init_verbs = { alc883_init_verbs },
10118 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10119 .dac_nids = alc883_dac_nids,
10120 .dig_out_nid = ALC1200_DIGOUT_NID,
10121 .dig_in_nid = ALC883_DIGIN_NID,
10122 .slave_dig_outs = alc1200_slave_dig_outs,
10123 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10124 .channel_mode = alc883_sixstack_modes,
10125 .input_mux = &alc883_capture_source,
10128 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10129 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10130 alc880_gpio1_init_verbs },
10131 .adc_nids = alc883_adc_nids,
10132 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10133 .capsrc_nids = alc883_capsrc_nids,
10134 .dac_nids = alc883_dac_nids,
10135 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10136 .channel_mode = alc889A_mb31_6ch_modes,
10137 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10138 .input_mux = &alc889A_mb31_capture_source,
10139 .dig_out_nid = ALC883_DIGOUT_NID,
10140 .unsol_event = alc889A_mb31_unsol_event,
10141 .init_hook = alc889A_mb31_automute,
10143 [ALC883_SONY_VAIO_TT] = {
10144 .mixers = { alc883_vaiott_mixer },
10145 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10146 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10147 .dac_nids = alc883_dac_nids,
10148 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10149 .channel_mode = alc883_3ST_2ch_modes,
10150 .input_mux = &alc883_capture_source,
10151 .unsol_event = alc_automute_amp_unsol_event,
10152 .setup = alc883_vaiott_setup,
10153 .init_hook = alc_automute_amp,
10162 PINFIX_ABIT_AW9D_MAX
10165 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10166 { 0x15, 0x01080104 }, /* side */
10167 { 0x16, 0x01011012 }, /* rear */
10168 { 0x17, 0x01016011 }, /* clfe */
10172 static const struct alc_fixup alc882_fixups[] = {
10173 [PINFIX_ABIT_AW9D_MAX] = {
10174 .pins = alc882_abit_aw9d_pinfix
10178 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10179 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10184 * BIOS auto configuration
10186 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10187 const struct auto_pin_cfg *cfg)
10189 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10192 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10193 hda_nid_t nid, int pin_type,
10198 printk("XXX set output pin %x, dac %x\n", nid, dac);
10199 /* set as output */
10200 alc_set_pin_output(codec, nid, pin_type);
10204 else if (dac >= 0x02 && dac <= 0x05)
10208 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10211 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10213 struct alc_spec *spec = codec->spec;
10216 for (i = 0; i <= HDA_SIDE; i++) {
10217 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10218 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10220 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10221 spec->multiout.dac_nids[i]);
10225 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10227 struct alc_spec *spec = codec->spec;
10228 hda_nid_t pin, dac;
10230 pin = spec->autocfg.hp_pins[0];
10232 dac = spec->multiout.hp_nid;
10234 dac = spec->multiout.dac_nids[0]; /* to front */
10235 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10237 pin = spec->autocfg.speaker_pins[0];
10239 dac = spec->multiout.extra_out_nid[0];
10241 dac = spec->multiout.dac_nids[0]; /* to front */
10242 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10246 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10248 struct alc_spec *spec = codec->spec;
10251 for (i = 0; i < AUTO_PIN_LAST; i++) {
10252 hda_nid_t nid = spec->autocfg.input_pins[i];
10255 alc_set_input_pin(codec, nid, i);
10256 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10257 snd_hda_codec_write(codec, nid, 0,
10258 AC_VERB_SET_AMP_GAIN_MUTE,
10263 static void alc882_auto_init_input_src(struct hda_codec *codec)
10265 struct alc_spec *spec = codec->spec;
10268 for (c = 0; c < spec->num_adc_nids; c++) {
10269 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10270 hda_nid_t nid = spec->capsrc_nids[c];
10271 unsigned int mux_idx;
10272 const struct hda_input_mux *imux;
10273 int conns, mute, idx, item;
10275 conns = snd_hda_get_connections(codec, nid, conn_list,
10276 ARRAY_SIZE(conn_list));
10279 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10280 imux = &spec->input_mux[mux_idx];
10281 if (!imux->num_items && mux_idx > 0)
10282 imux = &spec->input_mux[0];
10283 for (idx = 0; idx < conns; idx++) {
10284 /* if the current connection is the selected one,
10285 * unmute it as default - otherwise mute it
10287 mute = AMP_IN_MUTE(idx);
10288 for (item = 0; item < imux->num_items; item++) {
10289 if (imux->items[item].index == idx) {
10290 if (spec->cur_mux[c] == item)
10291 mute = AMP_IN_UNMUTE(idx);
10295 /* check if we have a selector or mixer
10296 * we could check for the widget type instead, but
10297 * just check for Amp-In presence (in case of mixer
10298 * without amp-in there is something wrong, this
10299 * function shouldn't be used or capsrc nid is wrong)
10301 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10302 snd_hda_codec_write(codec, nid, 0,
10303 AC_VERB_SET_AMP_GAIN_MUTE,
10305 else if (mute != AMP_IN_MUTE(idx))
10306 snd_hda_codec_write(codec, nid, 0,
10307 AC_VERB_SET_CONNECT_SEL,
10313 /* add mic boosts if needed */
10314 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10316 struct alc_spec *spec = codec->spec;
10320 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10321 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10322 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10324 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10328 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10329 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10330 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10332 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10339 /* almost identical with ALC880 parser... */
10340 static int alc882_parse_auto_config(struct hda_codec *codec)
10342 struct alc_spec *spec = codec->spec;
10343 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10346 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10350 if (!spec->autocfg.line_outs)
10351 return 0; /* can't find valid BIOS pin config */
10353 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10356 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10359 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10363 err = alc880_auto_create_extra_out(spec,
10364 spec->autocfg.speaker_pins[0],
10368 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10372 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10374 /* check multiple SPDIF-out (for recent codecs) */
10375 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10377 err = snd_hda_get_connections(codec,
10378 spec->autocfg.dig_out_pins[i],
10383 spec->multiout.dig_out_nid = dig_nid;
10385 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10386 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10388 spec->slave_dig_outs[i - 1] = dig_nid;
10391 if (spec->autocfg.dig_in_pin)
10392 spec->dig_in_nid = ALC880_DIGIN_NID;
10394 if (spec->kctls.list)
10395 add_mixer(spec, spec->kctls.list);
10397 add_verb(spec, alc883_auto_init_verbs);
10398 /* if ADC 0x07 is available, initialize it, too */
10399 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10400 add_verb(spec, alc882_adc1_init_verbs);
10402 spec->num_mux_defs = 1;
10403 spec->input_mux = &spec->private_imux[0];
10405 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10407 err = alc_auto_add_mic_boost(codec);
10411 return 1; /* config found */
10414 /* additional initialization for auto-configuration model */
10415 static void alc882_auto_init(struct hda_codec *codec)
10417 struct alc_spec *spec = codec->spec;
10418 alc882_auto_init_multi_out(codec);
10419 alc882_auto_init_hp_out(codec);
10420 alc882_auto_init_analog_input(codec);
10421 alc882_auto_init_input_src(codec);
10422 if (spec->unsol_event)
10423 alc_inithook(codec);
10426 static int patch_alc882(struct hda_codec *codec)
10428 struct alc_spec *spec;
10429 int err, board_config;
10431 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10435 codec->spec = spec;
10437 alc_auto_parse_customize_define(codec);
10439 switch (codec->vendor_id) {
10444 /* ALC883 and variants */
10445 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10449 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10453 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10454 board_config = snd_hda_check_board_codec_sid_config(codec,
10455 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10457 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10458 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10460 board_config = ALC882_AUTO;
10463 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10465 if (board_config == ALC882_AUTO) {
10466 /* automatic parse from the BIOS config */
10467 err = alc882_parse_auto_config(codec);
10473 "hda_codec: Cannot set up configuration "
10474 "from BIOS. Using base mode...\n");
10475 board_config = ALC882_3ST_DIG;
10479 err = snd_hda_attach_beep_device(codec, 0x1);
10485 if (board_config != ALC882_AUTO)
10486 setup_preset(codec, &alc882_presets[board_config]);
10488 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10489 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10490 /* FIXME: setup DAC5 */
10491 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10492 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10494 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10495 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10497 if (codec->vendor_id == 0x10ec0888)
10498 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10500 if (!spec->adc_nids && spec->input_mux) {
10502 spec->num_adc_nids = 0;
10503 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10504 const struct hda_input_mux *imux = spec->input_mux;
10506 hda_nid_t items[16];
10507 hda_nid_t nid = alc882_adc_nids[i];
10508 unsigned int wcap = get_wcaps(codec, nid);
10510 wcap = get_wcaps_type(wcap);
10511 if (wcap != AC_WID_AUD_IN)
10513 spec->private_adc_nids[spec->num_adc_nids] = nid;
10514 err = snd_hda_get_connections(codec, nid, &cap, 1);
10517 err = snd_hda_get_connections(codec, cap, items,
10518 ARRAY_SIZE(items));
10521 for (j = 0; j < imux->num_items; j++)
10522 if (imux->items[j].index >= err)
10524 if (j < imux->num_items)
10526 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10527 spec->num_adc_nids++;
10529 spec->adc_nids = spec->private_adc_nids;
10530 spec->capsrc_nids = spec->private_capsrc_nids;
10533 set_capture_mixer(codec);
10535 if (spec->cdefine.enable_pcbeep)
10536 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10538 spec->vmaster_nid = 0x0c;
10540 codec->patch_ops = alc_patch_ops;
10541 if (board_config == ALC882_AUTO)
10542 spec->init_hook = alc882_auto_init;
10543 #ifdef CONFIG_SND_HDA_POWER_SAVE
10544 if (!spec->loopback.amplist)
10545 spec->loopback.amplist = alc882_loopbacks;
10556 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10557 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10559 #define alc262_dac_nids alc260_dac_nids
10560 #define alc262_adc_nids alc882_adc_nids
10561 #define alc262_adc_nids_alt alc882_adc_nids_alt
10562 #define alc262_capsrc_nids alc882_capsrc_nids
10563 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10565 #define alc262_modes alc260_modes
10566 #define alc262_capture_source alc882_capture_source
10568 static hda_nid_t alc262_dmic_adc_nids[1] = {
10573 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10575 static struct snd_kcontrol_new alc262_base_mixer[] = {
10576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10577 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10578 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10579 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10580 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10581 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10582 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10584 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10585 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10586 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10587 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10588 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10589 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10590 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10591 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10595 /* update HP, line and mono-out pins according to the master switch */
10596 static void alc262_hp_master_update(struct hda_codec *codec)
10598 struct alc_spec *spec = codec->spec;
10599 int val = spec->master_sw;
10601 /* HP & line-out */
10602 snd_hda_codec_write_cache(codec, 0x1b, 0,
10603 AC_VERB_SET_PIN_WIDGET_CONTROL,
10605 snd_hda_codec_write_cache(codec, 0x15, 0,
10606 AC_VERB_SET_PIN_WIDGET_CONTROL,
10608 /* mono (speaker) depending on the HP jack sense */
10609 val = val && !spec->jack_present;
10610 snd_hda_codec_write_cache(codec, 0x16, 0,
10611 AC_VERB_SET_PIN_WIDGET_CONTROL,
10612 val ? PIN_OUT : 0);
10615 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10617 struct alc_spec *spec = codec->spec;
10619 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10620 alc262_hp_master_update(codec);
10623 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10625 if ((res >> 26) != ALC880_HP_EVENT)
10627 alc262_hp_bpc_automute(codec);
10630 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10632 struct alc_spec *spec = codec->spec;
10634 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10635 alc262_hp_master_update(codec);
10638 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10641 if ((res >> 26) != ALC880_HP_EVENT)
10643 alc262_hp_wildwest_automute(codec);
10646 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10648 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10649 struct snd_ctl_elem_value *ucontrol)
10651 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10652 struct alc_spec *spec = codec->spec;
10653 int val = !!*ucontrol->value.integer.value;
10655 if (val == spec->master_sw)
10657 spec->master_sw = val;
10658 alc262_hp_master_update(codec);
10662 #define ALC262_HP_MASTER_SWITCH \
10664 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10665 .name = "Master Playback Switch", \
10666 .info = snd_ctl_boolean_mono_info, \
10667 .get = alc262_hp_master_sw_get, \
10668 .put = alc262_hp_master_sw_put, \
10671 .iface = NID_MAPPING, \
10672 .name = "Master Playback Switch", \
10673 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10677 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10678 ALC262_HP_MASTER_SWITCH,
10679 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10680 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10682 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10684 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10687 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10688 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10689 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10690 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10691 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10692 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10693 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10694 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10695 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10696 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10697 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10701 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10702 ALC262_HP_MASTER_SWITCH,
10703 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10704 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10705 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10707 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10709 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10711 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10712 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10713 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10714 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10715 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10716 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10717 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10721 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10722 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10723 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10724 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10728 /* mute/unmute internal speaker according to the hp jack and mute state */
10729 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10731 struct alc_spec *spec = codec->spec;
10733 spec->autocfg.hp_pins[0] = 0x15;
10734 spec->autocfg.speaker_pins[0] = 0x14;
10737 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10738 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10739 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10740 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10741 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10744 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10748 static struct hda_verb alc262_hp_t5735_verbs[] = {
10749 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10752 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10756 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10757 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10759 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10760 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10761 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10762 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10766 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10767 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10768 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10769 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10770 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10771 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10772 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10774 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10780 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10787 /* bind hp and internal speaker mute (with plug check) as master switch */
10788 static void alc262_hippo_master_update(struct hda_codec *codec)
10790 struct alc_spec *spec = codec->spec;
10791 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10792 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10793 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10797 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10798 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10799 HDA_AMP_MUTE, mute);
10800 /* mute internal speaker per jack sense */
10801 if (spec->jack_present)
10802 mute = HDA_AMP_MUTE;
10804 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10805 HDA_AMP_MUTE, mute);
10806 if (speaker_nid && speaker_nid != line_nid)
10807 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10808 HDA_AMP_MUTE, mute);
10811 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10813 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10814 struct snd_ctl_elem_value *ucontrol)
10816 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10817 struct alc_spec *spec = codec->spec;
10818 int val = !!*ucontrol->value.integer.value;
10820 if (val == spec->master_sw)
10822 spec->master_sw = val;
10823 alc262_hippo_master_update(codec);
10827 #define ALC262_HIPPO_MASTER_SWITCH \
10829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10830 .name = "Master Playback Switch", \
10831 .info = snd_ctl_boolean_mono_info, \
10832 .get = alc262_hippo_master_sw_get, \
10833 .put = alc262_hippo_master_sw_put, \
10836 .iface = NID_MAPPING, \
10837 .name = "Master Playback Switch", \
10838 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10839 (SUBDEV_SPEAKER(0) << 16), \
10842 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10843 ALC262_HIPPO_MASTER_SWITCH,
10844 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10845 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10846 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10847 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10848 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10849 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10850 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10851 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10852 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10853 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10854 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10855 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10859 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10860 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10861 ALC262_HIPPO_MASTER_SWITCH,
10862 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10863 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10864 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10865 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10867 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10868 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10869 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10870 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10871 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10875 /* mute/unmute internal speaker according to the hp jack and mute state */
10876 static void alc262_hippo_automute(struct hda_codec *codec)
10878 struct alc_spec *spec = codec->spec;
10879 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10881 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10882 alc262_hippo_master_update(codec);
10885 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10887 if ((res >> 26) != ALC880_HP_EVENT)
10889 alc262_hippo_automute(codec);
10892 static void alc262_hippo_setup(struct hda_codec *codec)
10894 struct alc_spec *spec = codec->spec;
10896 spec->autocfg.hp_pins[0] = 0x15;
10897 spec->autocfg.speaker_pins[0] = 0x14;
10900 static void alc262_hippo1_setup(struct hda_codec *codec)
10902 struct alc_spec *spec = codec->spec;
10904 spec->autocfg.hp_pins[0] = 0x1b;
10905 spec->autocfg.speaker_pins[0] = 0x14;
10909 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10910 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10911 ALC262_HIPPO_MASTER_SWITCH,
10912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10914 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10915 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10919 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10920 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10921 ALC262_HIPPO_MASTER_SWITCH,
10922 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10924 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10925 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10926 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10930 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10931 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10932 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10933 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10934 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10935 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10936 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10939 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10940 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10941 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10942 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10946 static struct hda_verb alc262_tyan_verbs[] = {
10947 /* Headphone automute */
10948 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10949 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10950 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10952 /* P11 AUX_IN, white 4-pin connector */
10953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10954 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10955 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10956 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10961 /* unsolicited event for HP jack sensing */
10962 static void alc262_tyan_setup(struct hda_codec *codec)
10964 struct alc_spec *spec = codec->spec;
10966 spec->autocfg.hp_pins[0] = 0x1b;
10967 spec->autocfg.speaker_pins[0] = 0x15;
10971 #define alc262_capture_mixer alc882_capture_mixer
10972 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10975 * generic initialization of ADC, input mixers and output mixers
10977 static struct hda_verb alc262_init_verbs[] = {
10979 * Unmute ADC0-2 and set the default input to mic-in
10981 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10982 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10983 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10985 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10988 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10990 * Note: PASD motherboards uses the Line In 2 as the input for
10991 * front panel mic (mic 2)
10993 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10994 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10996 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10997 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10998 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11001 * Set up output mixers (0x0c - 0x0e)
11003 /* set vol=0 to output mixers */
11004 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11005 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11006 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11007 /* set up input amps for analog loopback */
11008 /* Amp Indices: DAC = 0, mixer = 1 */
11009 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11010 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11011 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11012 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11013 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11014 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11016 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11017 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11018 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11019 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11020 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11021 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11024 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11025 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11026 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11027 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11029 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11030 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11032 /* FIXME: use matrix-type input source selection */
11033 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11034 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11035 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11036 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11037 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11038 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11040 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11041 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11042 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11043 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11045 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11046 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11047 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11048 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11053 static struct hda_verb alc262_eapd_verbs[] = {
11054 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11055 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11059 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11060 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11061 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11064 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11065 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11069 static struct hda_verb alc262_sony_unsol_verbs[] = {
11070 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11071 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11072 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11074 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11075 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11079 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11080 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11081 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11082 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11084 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11088 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11089 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11090 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11091 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11092 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11093 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11094 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11095 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11096 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11100 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11102 struct alc_spec *spec = codec->spec;
11104 spec->autocfg.hp_pins[0] = 0x15;
11105 spec->autocfg.speaker_pins[0] = 0x14;
11106 spec->ext_mic.pin = 0x18;
11107 spec->ext_mic.mux_idx = 0;
11108 spec->int_mic.pin = 0x12;
11109 spec->int_mic.mux_idx = 9;
11110 spec->auto_mic = 1;
11116 * 0x16 = internal speaker
11117 * 0x18 = external mic
11120 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11121 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11122 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11126 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11128 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11133 static struct hda_verb alc262_nec_verbs[] = {
11134 /* Unmute Speaker */
11135 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11138 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11141 /* External mic to headphone */
11142 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11143 /* External mic to speaker */
11144 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11150 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11151 * 0x1b = port replicator headphone out
11154 #define ALC_HP_EVENT 0x37
11156 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11157 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11158 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11159 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11160 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11164 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11165 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11166 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11170 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11171 /* Front Mic pin: input vref at 50% */
11172 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11173 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11177 static struct hda_input_mux alc262_fujitsu_capture_source = {
11181 { "Int Mic", 0x1 },
11186 static struct hda_input_mux alc262_HP_capture_source = {
11190 { "Front Mic", 0x1 },
11197 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11201 { "Front Mic", 0x2 },
11207 /* mute/unmute internal speaker according to the hp jacks and mute state */
11208 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11210 struct alc_spec *spec = codec->spec;
11213 if (force || !spec->sense_updated) {
11214 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11215 snd_hda_jack_detect(codec, 0x1b);
11216 spec->sense_updated = 1;
11218 /* unmute internal speaker only if both HPs are unplugged and
11219 * master switch is on
11221 if (spec->jack_present)
11222 mute = HDA_AMP_MUTE;
11224 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11225 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11226 HDA_AMP_MUTE, mute);
11229 /* unsolicited event for HP jack sensing */
11230 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11233 if ((res >> 26) != ALC_HP_EVENT)
11235 alc262_fujitsu_automute(codec, 1);
11238 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11240 alc262_fujitsu_automute(codec, 1);
11243 /* bind volumes of both NID 0x0c and 0x0d */
11244 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11245 .ops = &snd_hda_bind_vol,
11247 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11248 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11253 /* mute/unmute internal speaker according to the hp jack and mute state */
11254 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11256 struct alc_spec *spec = codec->spec;
11259 if (force || !spec->sense_updated) {
11260 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11261 spec->sense_updated = 1;
11263 if (spec->jack_present) {
11264 /* mute internal speaker */
11265 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11266 HDA_AMP_MUTE, HDA_AMP_MUTE);
11267 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11268 HDA_AMP_MUTE, HDA_AMP_MUTE);
11270 /* unmute internal speaker if necessary */
11271 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11272 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11273 HDA_AMP_MUTE, mute);
11274 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11275 HDA_AMP_MUTE, mute);
11279 /* unsolicited event for HP jack sensing */
11280 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11283 if ((res >> 26) != ALC_HP_EVENT)
11285 alc262_lenovo_3000_automute(codec, 1);
11288 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11289 int dir, int idx, long *valp)
11293 for (i = 0; i < 2; i++, valp++)
11294 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11296 *valp ? 0 : HDA_AMP_MUTE);
11300 /* bind hp and internal speaker mute (with plug check) */
11301 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11302 struct snd_ctl_elem_value *ucontrol)
11304 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11305 long *valp = ucontrol->value.integer.value;
11308 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11309 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11311 alc262_fujitsu_automute(codec, 0);
11315 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11316 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11318 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11319 .name = "Master Playback Switch",
11320 .subdevice = HDA_SUBDEV_AMP_FLAG,
11321 .info = snd_hda_mixer_amp_switch_info,
11322 .get = snd_hda_mixer_amp_switch_get,
11323 .put = alc262_fujitsu_master_sw_put,
11324 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11327 .iface = NID_MAPPING,
11328 .name = "Master Playback Switch",
11329 .private_value = 0x1b,
11331 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11332 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11333 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11336 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11337 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11338 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11342 /* bind hp and internal speaker mute (with plug check) */
11343 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11344 struct snd_ctl_elem_value *ucontrol)
11346 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11347 long *valp = ucontrol->value.integer.value;
11350 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11352 alc262_lenovo_3000_automute(codec, 0);
11356 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11357 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11359 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11360 .name = "Master Playback Switch",
11361 .subdevice = HDA_SUBDEV_AMP_FLAG,
11362 .info = snd_hda_mixer_amp_switch_info,
11363 .get = snd_hda_mixer_amp_switch_get,
11364 .put = alc262_lenovo_3000_master_sw_put,
11365 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11367 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11368 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11369 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11370 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11371 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11372 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11373 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11374 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11378 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11379 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11380 ALC262_HIPPO_MASTER_SWITCH,
11381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11383 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11384 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11385 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11386 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11390 /* additional init verbs for Benq laptops */
11391 static struct hda_verb alc262_EAPD_verbs[] = {
11392 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11393 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11397 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11399 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11401 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11402 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11406 /* Samsung Q1 Ultra Vista model setup */
11407 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11408 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11409 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11410 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11411 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11412 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11413 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11417 static struct hda_verb alc262_ultra_verbs[] = {
11419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11421 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11423 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11424 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11425 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11426 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11428 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11429 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11430 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11431 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11432 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11434 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11435 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11436 /* ADC, choose mic */
11437 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11441 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11442 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11443 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11444 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11445 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11450 /* mute/unmute internal speaker according to the hp jack and mute state */
11451 static void alc262_ultra_automute(struct hda_codec *codec)
11453 struct alc_spec *spec = codec->spec;
11457 /* auto-mute only when HP is used as HP */
11458 if (!spec->cur_mux[0]) {
11459 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11460 if (spec->jack_present)
11461 mute = HDA_AMP_MUTE;
11463 /* mute/unmute internal speaker */
11464 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11465 HDA_AMP_MUTE, mute);
11466 /* mute/unmute HP */
11467 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11468 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11471 /* unsolicited event for HP jack sensing */
11472 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11475 if ((res >> 26) != ALC880_HP_EVENT)
11477 alc262_ultra_automute(codec);
11480 static struct hda_input_mux alc262_ultra_capture_source = {
11484 { "Headphone", 0x7 },
11488 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11489 struct snd_ctl_elem_value *ucontrol)
11491 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11492 struct alc_spec *spec = codec->spec;
11495 ret = alc_mux_enum_put(kcontrol, ucontrol);
11498 /* reprogram the HP pin as mic or HP according to the input source */
11499 snd_hda_codec_write_cache(codec, 0x15, 0,
11500 AC_VERB_SET_PIN_WIDGET_CONTROL,
11501 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11502 alc262_ultra_automute(codec); /* mute/unmute HP */
11506 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11507 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11508 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11510 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11511 .name = "Capture Source",
11512 .info = alc_mux_enum_info,
11513 .get = alc_mux_enum_get,
11514 .put = alc262_ultra_mux_enum_put,
11517 .iface = NID_MAPPING,
11518 .name = "Capture Source",
11519 .private_value = 0x15,
11524 /* We use two mixers depending on the output pin; 0x16 is a mono output
11525 * and thus it's bound with a different mixer.
11526 * This function returns which mixer amp should be used.
11528 static int alc262_check_volbit(hda_nid_t nid)
11532 else if (nid == 0x16)
11538 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11539 const char *pfx, int *vbits)
11544 vbit = alc262_check_volbit(nid);
11547 if (*vbits & vbit) /* a volume control for this mixer already there */
11551 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11553 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11554 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11557 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11565 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11567 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11568 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11571 /* add playback controls from the parsed DAC table */
11572 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11573 const struct auto_pin_cfg *cfg)
11579 spec->multiout.num_dacs = 1; /* only use one dac */
11580 spec->multiout.dac_nids = spec->private_dac_nids;
11581 spec->multiout.dac_nids[0] = 2;
11583 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11585 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11589 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11592 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11595 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11599 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11600 alc262_check_volbit(cfg->speaker_pins[0]) |
11601 alc262_check_volbit(cfg->hp_pins[0]);
11602 if (vbits == 1 || vbits == 2)
11603 pfx = "Master"; /* only one mixer is used */
11604 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11609 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11612 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11616 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11623 #define alc262_auto_create_input_ctls \
11624 alc882_auto_create_input_ctls
11627 * generic initialization of ADC, input mixers and output mixers
11629 static struct hda_verb alc262_volume_init_verbs[] = {
11631 * Unmute ADC0-2 and set the default input to mic-in
11633 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11635 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11636 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11637 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11638 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11640 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11642 * Note: PASD motherboards uses the Line In 2 as the input for
11643 * front panel mic (mic 2)
11645 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11649 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11650 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11653 * Set up output mixers (0x0c - 0x0f)
11655 /* set vol=0 to output mixers */
11656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11658 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11660 /* set up input amps for analog loopback */
11661 /* Amp Indices: DAC = 0, mixer = 1 */
11662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11666 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11667 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11669 /* FIXME: use matrix-type input source selection */
11670 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11671 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11672 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11674 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11678 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11679 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11680 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11685 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11690 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11692 * Unmute ADC0-2 and set the default input to mic-in
11694 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11696 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11697 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11698 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11699 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11701 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11703 * Note: PASD motherboards uses the Line In 2 as the input for
11704 * front panel mic (mic 2)
11706 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11707 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11716 * Set up output mixers (0x0c - 0x0e)
11718 /* set vol=0 to output mixers */
11719 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11720 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11721 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11723 /* set up input amps for analog loopback */
11724 /* Amp Indices: DAC = 0, mixer = 1 */
11725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11726 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11727 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11728 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11729 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11730 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11732 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11733 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11734 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11736 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11737 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11739 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11740 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11742 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11743 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11744 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11745 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11746 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11748 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11749 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11751 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11752 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11753 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11756 /* FIXME: use matrix-type input source selection */
11757 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11758 /* Input mixer1: only unmute Mic */
11759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11763 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11765 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11766 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11767 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11771 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11776 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11777 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11783 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11784 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11786 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11789 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11794 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11796 * Unmute ADC0-2 and set the default input to mic-in
11798 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11800 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11801 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11802 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11803 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11805 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11807 * Note: PASD motherboards uses the Line In 2 as the input for front
11808 * panel mic (mic 2)
11810 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11811 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11812 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11813 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11814 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11815 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11816 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11817 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11818 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11820 * Set up output mixers (0x0c - 0x0e)
11822 /* set vol=0 to output mixers */
11823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11825 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11827 /* set up input amps for analog loopback */
11828 /* Amp Indices: DAC = 0, mixer = 1 */
11829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11830 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11831 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11832 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11833 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11834 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11838 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11839 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11840 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11841 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11842 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11843 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11845 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11846 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11848 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11849 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11851 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11852 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11853 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11855 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11856 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11858 /* FIXME: use matrix-type input source selection */
11859 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11860 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11864 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11865 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11866 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11867 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11869 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11870 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11871 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11873 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11874 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11875 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11878 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11879 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11880 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11881 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11882 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11883 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11885 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11890 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11892 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11893 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11894 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11896 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11897 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11898 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11899 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11902 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11903 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11908 #ifdef CONFIG_SND_HDA_POWER_SAVE
11909 #define alc262_loopbacks alc880_loopbacks
11912 /* pcm configuration: identical with ALC880 */
11913 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11914 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11915 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11916 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11919 * BIOS auto configuration
11921 static int alc262_parse_auto_config(struct hda_codec *codec)
11923 struct alc_spec *spec = codec->spec;
11925 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11927 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11931 if (!spec->autocfg.line_outs) {
11932 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11933 spec->multiout.max_channels = 2;
11934 spec->no_analog = 1;
11937 return 0; /* can't find valid BIOS pin config */
11939 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11942 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11946 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11949 if (spec->autocfg.dig_outs) {
11950 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11951 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11953 if (spec->autocfg.dig_in_pin)
11954 spec->dig_in_nid = ALC262_DIGIN_NID;
11956 if (spec->kctls.list)
11957 add_mixer(spec, spec->kctls.list);
11959 add_verb(spec, alc262_volume_init_verbs);
11960 spec->num_mux_defs = 1;
11961 spec->input_mux = &spec->private_imux[0];
11963 err = alc_auto_add_mic_boost(codec);
11967 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11972 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11973 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11974 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11975 #define alc262_auto_init_input_src alc882_auto_init_input_src
11978 /* init callback for auto-configuration model -- overriding the default init */
11979 static void alc262_auto_init(struct hda_codec *codec)
11981 struct alc_spec *spec = codec->spec;
11982 alc262_auto_init_multi_out(codec);
11983 alc262_auto_init_hp_out(codec);
11984 alc262_auto_init_analog_input(codec);
11985 alc262_auto_init_input_src(codec);
11986 if (spec->unsol_event)
11987 alc_inithook(codec);
11991 * configuration and preset
11993 static const char *alc262_models[ALC262_MODEL_LAST] = {
11994 [ALC262_BASIC] = "basic",
11995 [ALC262_HIPPO] = "hippo",
11996 [ALC262_HIPPO_1] = "hippo_1",
11997 [ALC262_FUJITSU] = "fujitsu",
11998 [ALC262_HP_BPC] = "hp-bpc",
11999 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12000 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12001 [ALC262_HP_RP5700] = "hp-rp5700",
12002 [ALC262_BENQ_ED8] = "benq",
12003 [ALC262_BENQ_T31] = "benq-t31",
12004 [ALC262_SONY_ASSAMD] = "sony-assamd",
12005 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12006 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12007 [ALC262_ULTRA] = "ultra",
12008 [ALC262_LENOVO_3000] = "lenovo-3000",
12009 [ALC262_NEC] = "nec",
12010 [ALC262_TYAN] = "tyan",
12011 [ALC262_AUTO] = "auto",
12014 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12015 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12016 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12017 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12019 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12021 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12023 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12024 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12025 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12026 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12027 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12028 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12029 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12030 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12031 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12032 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12033 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12034 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12035 ALC262_HP_TC_T5735),
12036 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12037 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12038 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12039 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12040 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12041 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12042 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12043 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12044 #if 0 /* disable the quirk since model=auto works better in recent versions */
12045 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12046 ALC262_SONY_ASSAMD),
12048 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12049 ALC262_TOSHIBA_RX1),
12050 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12051 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12052 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12053 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12054 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12056 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12057 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12058 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12059 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12060 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12064 static struct alc_config_preset alc262_presets[] = {
12066 .mixers = { alc262_base_mixer },
12067 .init_verbs = { alc262_init_verbs },
12068 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12069 .dac_nids = alc262_dac_nids,
12071 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12072 .channel_mode = alc262_modes,
12073 .input_mux = &alc262_capture_source,
12076 .mixers = { alc262_hippo_mixer },
12077 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12078 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12079 .dac_nids = alc262_dac_nids,
12081 .dig_out_nid = ALC262_DIGOUT_NID,
12082 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12083 .channel_mode = alc262_modes,
12084 .input_mux = &alc262_capture_source,
12085 .unsol_event = alc262_hippo_unsol_event,
12086 .setup = alc262_hippo_setup,
12087 .init_hook = alc262_hippo_automute,
12089 [ALC262_HIPPO_1] = {
12090 .mixers = { alc262_hippo1_mixer },
12091 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12092 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12093 .dac_nids = alc262_dac_nids,
12095 .dig_out_nid = ALC262_DIGOUT_NID,
12096 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12097 .channel_mode = alc262_modes,
12098 .input_mux = &alc262_capture_source,
12099 .unsol_event = alc262_hippo_unsol_event,
12100 .setup = alc262_hippo1_setup,
12101 .init_hook = alc262_hippo_automute,
12103 [ALC262_FUJITSU] = {
12104 .mixers = { alc262_fujitsu_mixer },
12105 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12106 alc262_fujitsu_unsol_verbs },
12107 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12108 .dac_nids = alc262_dac_nids,
12110 .dig_out_nid = ALC262_DIGOUT_NID,
12111 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12112 .channel_mode = alc262_modes,
12113 .input_mux = &alc262_fujitsu_capture_source,
12114 .unsol_event = alc262_fujitsu_unsol_event,
12115 .init_hook = alc262_fujitsu_init_hook,
12117 [ALC262_HP_BPC] = {
12118 .mixers = { alc262_HP_BPC_mixer },
12119 .init_verbs = { alc262_HP_BPC_init_verbs },
12120 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12121 .dac_nids = alc262_dac_nids,
12123 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12124 .channel_mode = alc262_modes,
12125 .input_mux = &alc262_HP_capture_source,
12126 .unsol_event = alc262_hp_bpc_unsol_event,
12127 .init_hook = alc262_hp_bpc_automute,
12129 [ALC262_HP_BPC_D7000_WF] = {
12130 .mixers = { alc262_HP_BPC_WildWest_mixer },
12131 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12132 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12133 .dac_nids = alc262_dac_nids,
12135 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12136 .channel_mode = alc262_modes,
12137 .input_mux = &alc262_HP_D7000_capture_source,
12138 .unsol_event = alc262_hp_wildwest_unsol_event,
12139 .init_hook = alc262_hp_wildwest_automute,
12141 [ALC262_HP_BPC_D7000_WL] = {
12142 .mixers = { alc262_HP_BPC_WildWest_mixer,
12143 alc262_HP_BPC_WildWest_option_mixer },
12144 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12145 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12146 .dac_nids = alc262_dac_nids,
12148 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12149 .channel_mode = alc262_modes,
12150 .input_mux = &alc262_HP_D7000_capture_source,
12151 .unsol_event = alc262_hp_wildwest_unsol_event,
12152 .init_hook = alc262_hp_wildwest_automute,
12154 [ALC262_HP_TC_T5735] = {
12155 .mixers = { alc262_hp_t5735_mixer },
12156 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12157 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12158 .dac_nids = alc262_dac_nids,
12160 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12161 .channel_mode = alc262_modes,
12162 .input_mux = &alc262_capture_source,
12163 .unsol_event = alc_sku_unsol_event,
12164 .setup = alc262_hp_t5735_setup,
12165 .init_hook = alc_inithook,
12167 [ALC262_HP_RP5700] = {
12168 .mixers = { alc262_hp_rp5700_mixer },
12169 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12170 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12171 .dac_nids = alc262_dac_nids,
12172 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12173 .channel_mode = alc262_modes,
12174 .input_mux = &alc262_hp_rp5700_capture_source,
12176 [ALC262_BENQ_ED8] = {
12177 .mixers = { alc262_base_mixer },
12178 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12179 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12180 .dac_nids = alc262_dac_nids,
12182 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12183 .channel_mode = alc262_modes,
12184 .input_mux = &alc262_capture_source,
12186 [ALC262_SONY_ASSAMD] = {
12187 .mixers = { alc262_sony_mixer },
12188 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12189 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12190 .dac_nids = alc262_dac_nids,
12192 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12193 .channel_mode = alc262_modes,
12194 .input_mux = &alc262_capture_source,
12195 .unsol_event = alc262_hippo_unsol_event,
12196 .setup = alc262_hippo_setup,
12197 .init_hook = alc262_hippo_automute,
12199 [ALC262_BENQ_T31] = {
12200 .mixers = { alc262_benq_t31_mixer },
12201 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12202 alc_hp15_unsol_verbs },
12203 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12204 .dac_nids = alc262_dac_nids,
12206 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12207 .channel_mode = alc262_modes,
12208 .input_mux = &alc262_capture_source,
12209 .unsol_event = alc262_hippo_unsol_event,
12210 .setup = alc262_hippo_setup,
12211 .init_hook = alc262_hippo_automute,
12214 .mixers = { alc262_ultra_mixer },
12215 .cap_mixer = alc262_ultra_capture_mixer,
12216 .init_verbs = { alc262_ultra_verbs },
12217 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12218 .dac_nids = alc262_dac_nids,
12219 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12220 .channel_mode = alc262_modes,
12221 .input_mux = &alc262_ultra_capture_source,
12222 .adc_nids = alc262_adc_nids, /* ADC0 */
12223 .capsrc_nids = alc262_capsrc_nids,
12224 .num_adc_nids = 1, /* single ADC */
12225 .unsol_event = alc262_ultra_unsol_event,
12226 .init_hook = alc262_ultra_automute,
12228 [ALC262_LENOVO_3000] = {
12229 .mixers = { alc262_lenovo_3000_mixer },
12230 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12231 alc262_lenovo_3000_unsol_verbs,
12232 alc262_lenovo_3000_init_verbs },
12233 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12234 .dac_nids = alc262_dac_nids,
12236 .dig_out_nid = ALC262_DIGOUT_NID,
12237 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12238 .channel_mode = alc262_modes,
12239 .input_mux = &alc262_fujitsu_capture_source,
12240 .unsol_event = alc262_lenovo_3000_unsol_event,
12243 .mixers = { alc262_nec_mixer },
12244 .init_verbs = { alc262_nec_verbs },
12245 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12246 .dac_nids = alc262_dac_nids,
12248 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12249 .channel_mode = alc262_modes,
12250 .input_mux = &alc262_capture_source,
12252 [ALC262_TOSHIBA_S06] = {
12253 .mixers = { alc262_toshiba_s06_mixer },
12254 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12255 alc262_eapd_verbs },
12256 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12257 .capsrc_nids = alc262_dmic_capsrc_nids,
12258 .dac_nids = alc262_dac_nids,
12259 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12260 .num_adc_nids = 1, /* single ADC */
12261 .dig_out_nid = ALC262_DIGOUT_NID,
12262 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12263 .channel_mode = alc262_modes,
12264 .unsol_event = alc_sku_unsol_event,
12265 .setup = alc262_toshiba_s06_setup,
12266 .init_hook = alc_inithook,
12268 [ALC262_TOSHIBA_RX1] = {
12269 .mixers = { alc262_toshiba_rx1_mixer },
12270 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12271 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12272 .dac_nids = alc262_dac_nids,
12274 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12275 .channel_mode = alc262_modes,
12276 .input_mux = &alc262_capture_source,
12277 .unsol_event = alc262_hippo_unsol_event,
12278 .setup = alc262_hippo_setup,
12279 .init_hook = alc262_hippo_automute,
12282 .mixers = { alc262_tyan_mixer },
12283 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12284 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12285 .dac_nids = alc262_dac_nids,
12287 .dig_out_nid = ALC262_DIGOUT_NID,
12288 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12289 .channel_mode = alc262_modes,
12290 .input_mux = &alc262_capture_source,
12291 .unsol_event = alc_automute_amp_unsol_event,
12292 .setup = alc262_tyan_setup,
12293 .init_hook = alc_automute_amp,
12297 static int patch_alc262(struct hda_codec *codec)
12299 struct alc_spec *spec;
12303 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12307 codec->spec = spec;
12309 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12314 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12315 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12316 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12317 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12320 alc_auto_parse_customize_define(codec);
12322 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12324 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12328 if (board_config < 0) {
12329 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12331 board_config = ALC262_AUTO;
12334 if (board_config == ALC262_AUTO) {
12335 /* automatic parse from the BIOS config */
12336 err = alc262_parse_auto_config(codec);
12342 "hda_codec: Cannot set up configuration "
12343 "from BIOS. Using base mode...\n");
12344 board_config = ALC262_BASIC;
12348 if (!spec->no_analog) {
12349 err = snd_hda_attach_beep_device(codec, 0x1);
12356 if (board_config != ALC262_AUTO)
12357 setup_preset(codec, &alc262_presets[board_config]);
12359 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12360 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12362 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12363 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12365 if (!spec->adc_nids && spec->input_mux) {
12367 /* check whether the digital-mic has to be supported */
12368 for (i = 0; i < spec->input_mux->num_items; i++) {
12369 if (spec->input_mux->items[i].index >= 9)
12372 if (i < spec->input_mux->num_items) {
12373 /* use only ADC0 */
12374 spec->adc_nids = alc262_dmic_adc_nids;
12375 spec->num_adc_nids = 1;
12376 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12378 /* all analog inputs */
12379 /* check whether NID 0x07 is valid */
12380 unsigned int wcap = get_wcaps(codec, 0x07);
12383 wcap = get_wcaps_type(wcap);
12384 if (wcap != AC_WID_AUD_IN) {
12385 spec->adc_nids = alc262_adc_nids_alt;
12386 spec->num_adc_nids =
12387 ARRAY_SIZE(alc262_adc_nids_alt);
12388 spec->capsrc_nids = alc262_capsrc_nids_alt;
12390 spec->adc_nids = alc262_adc_nids;
12391 spec->num_adc_nids =
12392 ARRAY_SIZE(alc262_adc_nids);
12393 spec->capsrc_nids = alc262_capsrc_nids;
12397 if (!spec->cap_mixer && !spec->no_analog)
12398 set_capture_mixer(codec);
12399 if (!spec->no_analog && spec->cdefine.enable_pcbeep)
12400 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12402 spec->vmaster_nid = 0x0c;
12404 codec->patch_ops = alc_patch_ops;
12405 if (board_config == ALC262_AUTO)
12406 spec->init_hook = alc262_auto_init;
12407 #ifdef CONFIG_SND_HDA_POWER_SAVE
12408 if (!spec->loopback.amplist)
12409 spec->loopback.amplist = alc262_loopbacks;
12416 * ALC268 channel source setting (2 channel)
12418 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12419 #define alc268_modes alc260_modes
12421 static hda_nid_t alc268_dac_nids[2] = {
12426 static hda_nid_t alc268_adc_nids[2] = {
12431 static hda_nid_t alc268_adc_nids_alt[1] = {
12436 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12438 static struct snd_kcontrol_new alc268_base_mixer[] = {
12439 /* output mixer control */
12440 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12441 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12442 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12443 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12444 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12445 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12446 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12450 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12451 /* output mixer control */
12452 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12453 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12454 ALC262_HIPPO_MASTER_SWITCH,
12455 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12456 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12457 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12461 /* bind Beep switches of both NID 0x0f and 0x10 */
12462 static struct hda_bind_ctls alc268_bind_beep_sw = {
12463 .ops = &snd_hda_bind_sw,
12465 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12466 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12471 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12472 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12473 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12477 static struct hda_verb alc268_eapd_verbs[] = {
12478 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12479 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12483 /* Toshiba specific */
12484 static struct hda_verb alc268_toshiba_verbs[] = {
12485 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12489 /* Acer specific */
12490 /* bind volumes of both NID 0x02 and 0x03 */
12491 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12492 .ops = &snd_hda_bind_vol,
12494 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12495 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12500 /* mute/unmute internal speaker according to the hp jack and mute state */
12501 static void alc268_acer_automute(struct hda_codec *codec, int force)
12503 struct alc_spec *spec = codec->spec;
12506 if (force || !spec->sense_updated) {
12507 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12508 spec->sense_updated = 1;
12510 if (spec->jack_present)
12511 mute = HDA_AMP_MUTE; /* mute internal speaker */
12512 else /* unmute internal speaker if necessary */
12513 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12514 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12515 HDA_AMP_MUTE, mute);
12519 /* bind hp and internal speaker mute (with plug check) */
12520 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12521 struct snd_ctl_elem_value *ucontrol)
12523 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12524 long *valp = ucontrol->value.integer.value;
12527 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12529 alc268_acer_automute(codec, 0);
12533 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12534 /* output mixer control */
12535 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12537 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12538 .name = "Master Playback Switch",
12539 .subdevice = HDA_SUBDEV_AMP_FLAG,
12540 .info = snd_hda_mixer_amp_switch_info,
12541 .get = snd_hda_mixer_amp_switch_get,
12542 .put = alc268_acer_master_sw_put,
12543 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12545 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12549 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12550 /* output mixer control */
12551 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12554 .name = "Master Playback Switch",
12555 .subdevice = HDA_SUBDEV_AMP_FLAG,
12556 .info = snd_hda_mixer_amp_switch_info,
12557 .get = snd_hda_mixer_amp_switch_get,
12558 .put = alc268_acer_master_sw_put,
12559 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12561 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12562 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12563 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12567 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12568 /* output mixer control */
12569 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12571 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12572 .name = "Master Playback Switch",
12573 .subdevice = HDA_SUBDEV_AMP_FLAG,
12574 .info = snd_hda_mixer_amp_switch_info,
12575 .get = snd_hda_mixer_amp_switch_get,
12576 .put = alc268_acer_master_sw_put,
12577 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12579 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12580 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12584 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12585 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12586 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12587 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12588 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12589 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12594 static struct hda_verb alc268_acer_verbs[] = {
12595 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12596 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12597 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12598 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12599 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12600 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12601 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12605 /* unsolicited event for HP jack sensing */
12606 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12607 #define alc268_toshiba_setup alc262_hippo_setup
12608 #define alc268_toshiba_automute alc262_hippo_automute
12610 static void alc268_acer_unsol_event(struct hda_codec *codec,
12613 if ((res >> 26) != ALC880_HP_EVENT)
12615 alc268_acer_automute(codec, 1);
12618 static void alc268_acer_init_hook(struct hda_codec *codec)
12620 alc268_acer_automute(codec, 1);
12623 /* toggle speaker-output according to the hp-jack state */
12624 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12626 unsigned int present;
12627 unsigned char bits;
12629 present = snd_hda_jack_detect(codec, 0x15);
12630 bits = present ? HDA_AMP_MUTE : 0;
12631 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12632 HDA_AMP_MUTE, bits);
12633 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12634 HDA_AMP_MUTE, bits);
12637 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12640 switch (res >> 26) {
12641 case ALC880_HP_EVENT:
12642 alc268_aspire_one_speaker_automute(codec);
12644 case ALC880_MIC_EVENT:
12645 alc_mic_automute(codec);
12650 static void alc268_acer_lc_setup(struct hda_codec *codec)
12652 struct alc_spec *spec = codec->spec;
12653 spec->ext_mic.pin = 0x18;
12654 spec->ext_mic.mux_idx = 0;
12655 spec->int_mic.pin = 0x12;
12656 spec->int_mic.mux_idx = 6;
12657 spec->auto_mic = 1;
12660 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12662 alc268_aspire_one_speaker_automute(codec);
12663 alc_mic_automute(codec);
12666 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12667 /* output mixer control */
12668 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12669 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12670 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12672 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12673 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12677 static struct hda_verb alc268_dell_verbs[] = {
12678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12680 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12681 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12685 /* mute/unmute internal speaker according to the hp jack and mute state */
12686 static void alc268_dell_setup(struct hda_codec *codec)
12688 struct alc_spec *spec = codec->spec;
12690 spec->autocfg.hp_pins[0] = 0x15;
12691 spec->autocfg.speaker_pins[0] = 0x14;
12692 spec->ext_mic.pin = 0x18;
12693 spec->ext_mic.mux_idx = 0;
12694 spec->int_mic.pin = 0x19;
12695 spec->int_mic.mux_idx = 1;
12696 spec->auto_mic = 1;
12699 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12700 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12701 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12702 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12703 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12704 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12705 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12706 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12707 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12711 static struct hda_verb alc267_quanta_il1_verbs[] = {
12712 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12713 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12717 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12719 struct alc_spec *spec = codec->spec;
12720 spec->autocfg.hp_pins[0] = 0x15;
12721 spec->autocfg.speaker_pins[0] = 0x14;
12722 spec->ext_mic.pin = 0x18;
12723 spec->ext_mic.mux_idx = 0;
12724 spec->int_mic.pin = 0x19;
12725 spec->int_mic.mux_idx = 1;
12726 spec->auto_mic = 1;
12730 * generic initialization of ADC, input mixers and output mixers
12732 static struct hda_verb alc268_base_init_verbs[] = {
12733 /* Unmute DAC0-1 and set vol = 0 */
12734 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12735 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12738 * Set up output mixers (0x0c - 0x0e)
12740 /* set vol=0 to output mixers */
12741 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12742 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12744 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12745 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12748 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12749 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12751 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12753 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12754 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12756 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12757 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12758 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12759 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12760 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12762 /* set PCBEEP vol = 0, mute connections */
12763 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12764 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12765 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12767 /* Unmute Selector 23h,24h and set the default input to mic-in */
12769 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12771 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12772 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12778 * generic initialization of ADC, input mixers and output mixers
12780 static struct hda_verb alc268_volume_init_verbs[] = {
12781 /* set output DAC */
12782 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12783 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12785 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12786 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12787 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12788 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12789 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12791 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12792 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12793 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12796 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12798 /* set PCBEEP vol = 0, mute connections */
12799 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12800 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12801 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12806 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12807 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12808 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12812 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12813 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12814 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12819 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12820 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12821 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12822 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12823 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12828 static struct hda_input_mux alc268_capture_source = {
12832 { "Front Mic", 0x1 },
12838 static struct hda_input_mux alc268_acer_capture_source = {
12842 { "Internal Mic", 0x1 },
12847 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12851 { "Internal Mic", 0x6 },
12856 #ifdef CONFIG_SND_DEBUG
12857 static struct snd_kcontrol_new alc268_test_mixer[] = {
12858 /* Volume widgets */
12859 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12860 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12861 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12862 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12863 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12864 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12865 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12866 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12867 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12868 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12869 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12870 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12871 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12872 /* The below appears problematic on some hardwares */
12873 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12874 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12875 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12876 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12877 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12879 /* Modes for retasking pin widgets */
12880 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12881 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12882 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12883 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12885 /* Controls for GPIO pins, assuming they are configured as outputs */
12886 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12887 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12888 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12889 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12891 /* Switches to allow the digital SPDIF output pin to be enabled.
12892 * The ALC268 does not have an SPDIF input.
12894 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12896 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12897 * this output to turn on an external amplifier.
12899 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12900 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12906 /* create input playback/capture controls for the given pin */
12907 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12908 const char *ctlname, int idx)
12924 if (spec->multiout.dac_nids[0] != dac &&
12925 spec->multiout.dac_nids[1] != dac) {
12926 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12927 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12931 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12935 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12936 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12938 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12939 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12945 /* add playback controls from the parsed DAC table */
12946 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12947 const struct auto_pin_cfg *cfg)
12952 spec->multiout.dac_nids = spec->private_dac_nids;
12954 nid = cfg->line_out_pins[0];
12957 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12961 err = alc268_new_analog_output(spec, nid, name, 0);
12966 nid = cfg->speaker_pins[0];
12968 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12969 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12973 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12977 nid = cfg->hp_pins[0];
12979 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12984 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12986 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12987 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12994 /* create playback/capture controls for input pins */
12995 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12996 const struct auto_pin_cfg *cfg)
12998 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13001 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13002 hda_nid_t nid, int pin_type)
13006 alc_set_pin_output(codec, nid, pin_type);
13007 if (nid == 0x14 || nid == 0x16)
13011 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13014 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13016 struct alc_spec *spec = codec->spec;
13017 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13019 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13020 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13024 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13026 struct alc_spec *spec = codec->spec;
13029 pin = spec->autocfg.hp_pins[0];
13031 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13032 pin = spec->autocfg.speaker_pins[0];
13034 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13037 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13039 struct alc_spec *spec = codec->spec;
13040 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13041 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13042 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13043 unsigned int dac_vol1, dac_vol2;
13045 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13046 snd_hda_codec_write(codec, speaker_nid, 0,
13047 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13048 /* mute mixer inputs from 0x1d */
13049 snd_hda_codec_write(codec, 0x0f, 0,
13050 AC_VERB_SET_AMP_GAIN_MUTE,
13052 snd_hda_codec_write(codec, 0x10, 0,
13053 AC_VERB_SET_AMP_GAIN_MUTE,
13056 /* unmute mixer inputs from 0x1d */
13057 snd_hda_codec_write(codec, 0x0f, 0,
13058 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13059 snd_hda_codec_write(codec, 0x10, 0,
13060 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13063 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13064 if (line_nid == 0x14)
13065 dac_vol2 = AMP_OUT_ZERO;
13066 else if (line_nid == 0x15)
13067 dac_vol1 = AMP_OUT_ZERO;
13068 if (hp_nid == 0x14)
13069 dac_vol2 = AMP_OUT_ZERO;
13070 else if (hp_nid == 0x15)
13071 dac_vol1 = AMP_OUT_ZERO;
13072 if (line_nid != 0x16 || hp_nid != 0x16 ||
13073 spec->autocfg.line_out_pins[1] != 0x16 ||
13074 spec->autocfg.line_out_pins[2] != 0x16)
13075 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13077 snd_hda_codec_write(codec, 0x02, 0,
13078 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13079 snd_hda_codec_write(codec, 0x03, 0,
13080 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13083 /* pcm configuration: identical with ALC880 */
13084 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13085 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13086 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13087 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13090 * BIOS auto configuration
13092 static int alc268_parse_auto_config(struct hda_codec *codec)
13094 struct alc_spec *spec = codec->spec;
13096 static hda_nid_t alc268_ignore[] = { 0 };
13098 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13102 if (!spec->autocfg.line_outs) {
13103 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13104 spec->multiout.max_channels = 2;
13105 spec->no_analog = 1;
13108 return 0; /* can't find valid BIOS pin config */
13110 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13113 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13117 spec->multiout.max_channels = 2;
13120 /* digital only support output */
13121 if (spec->autocfg.dig_outs) {
13122 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13123 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13125 if (spec->kctls.list)
13126 add_mixer(spec, spec->kctls.list);
13128 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13129 add_mixer(spec, alc268_beep_mixer);
13131 add_verb(spec, alc268_volume_init_verbs);
13132 spec->num_mux_defs = 2;
13133 spec->input_mux = &spec->private_imux[0];
13135 err = alc_auto_add_mic_boost(codec);
13139 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13144 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13146 /* init callback for auto-configuration model -- overriding the default init */
13147 static void alc268_auto_init(struct hda_codec *codec)
13149 struct alc_spec *spec = codec->spec;
13150 alc268_auto_init_multi_out(codec);
13151 alc268_auto_init_hp_out(codec);
13152 alc268_auto_init_mono_speaker_out(codec);
13153 alc268_auto_init_analog_input(codec);
13154 if (spec->unsol_event)
13155 alc_inithook(codec);
13159 * configuration and preset
13161 static const char *alc268_models[ALC268_MODEL_LAST] = {
13162 [ALC267_QUANTA_IL1] = "quanta-il1",
13163 [ALC268_3ST] = "3stack",
13164 [ALC268_TOSHIBA] = "toshiba",
13165 [ALC268_ACER] = "acer",
13166 [ALC268_ACER_DMIC] = "acer-dmic",
13167 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13168 [ALC268_DELL] = "dell",
13169 [ALC268_ZEPTO] = "zepto",
13170 #ifdef CONFIG_SND_DEBUG
13171 [ALC268_TEST] = "test",
13173 [ALC268_AUTO] = "auto",
13176 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13177 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13178 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13179 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13180 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13181 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13182 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13183 ALC268_ACER_ASPIRE_ONE),
13184 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13185 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13186 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13187 /* almost compatible with toshiba but with optional digital outs;
13188 * auto-probing seems working fine
13190 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13192 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13193 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13194 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13195 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13196 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13197 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13201 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13202 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13203 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13204 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13205 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13210 static struct alc_config_preset alc268_presets[] = {
13211 [ALC267_QUANTA_IL1] = {
13212 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13213 alc268_capture_nosrc_mixer },
13214 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13215 alc267_quanta_il1_verbs },
13216 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13217 .dac_nids = alc268_dac_nids,
13218 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13219 .adc_nids = alc268_adc_nids_alt,
13221 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13222 .channel_mode = alc268_modes,
13223 .unsol_event = alc_sku_unsol_event,
13224 .setup = alc267_quanta_il1_setup,
13225 .init_hook = alc_inithook,
13228 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13229 alc268_beep_mixer },
13230 .init_verbs = { alc268_base_init_verbs },
13231 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13232 .dac_nids = alc268_dac_nids,
13233 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13234 .adc_nids = alc268_adc_nids_alt,
13235 .capsrc_nids = alc268_capsrc_nids,
13237 .dig_out_nid = ALC268_DIGOUT_NID,
13238 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13239 .channel_mode = alc268_modes,
13240 .input_mux = &alc268_capture_source,
13242 [ALC268_TOSHIBA] = {
13243 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13244 alc268_beep_mixer },
13245 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13246 alc268_toshiba_verbs },
13247 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13248 .dac_nids = alc268_dac_nids,
13249 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13250 .adc_nids = alc268_adc_nids_alt,
13251 .capsrc_nids = alc268_capsrc_nids,
13253 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13254 .channel_mode = alc268_modes,
13255 .input_mux = &alc268_capture_source,
13256 .unsol_event = alc268_toshiba_unsol_event,
13257 .setup = alc268_toshiba_setup,
13258 .init_hook = alc268_toshiba_automute,
13261 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13262 alc268_beep_mixer },
13263 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13264 alc268_acer_verbs },
13265 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13266 .dac_nids = alc268_dac_nids,
13267 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13268 .adc_nids = alc268_adc_nids_alt,
13269 .capsrc_nids = alc268_capsrc_nids,
13271 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13272 .channel_mode = alc268_modes,
13273 .input_mux = &alc268_acer_capture_source,
13274 .unsol_event = alc268_acer_unsol_event,
13275 .init_hook = alc268_acer_init_hook,
13277 [ALC268_ACER_DMIC] = {
13278 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13279 alc268_beep_mixer },
13280 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13281 alc268_acer_verbs },
13282 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13283 .dac_nids = alc268_dac_nids,
13284 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13285 .adc_nids = alc268_adc_nids_alt,
13286 .capsrc_nids = alc268_capsrc_nids,
13288 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13289 .channel_mode = alc268_modes,
13290 .input_mux = &alc268_acer_dmic_capture_source,
13291 .unsol_event = alc268_acer_unsol_event,
13292 .init_hook = alc268_acer_init_hook,
13294 [ALC268_ACER_ASPIRE_ONE] = {
13295 .mixers = { alc268_acer_aspire_one_mixer,
13297 alc268_capture_nosrc_mixer },
13298 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13299 alc268_acer_aspire_one_verbs },
13300 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13301 .dac_nids = alc268_dac_nids,
13302 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13303 .adc_nids = alc268_adc_nids_alt,
13304 .capsrc_nids = alc268_capsrc_nids,
13306 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13307 .channel_mode = alc268_modes,
13308 .unsol_event = alc268_acer_lc_unsol_event,
13309 .setup = alc268_acer_lc_setup,
13310 .init_hook = alc268_acer_lc_init_hook,
13313 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13314 alc268_capture_nosrc_mixer },
13315 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13316 alc268_dell_verbs },
13317 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13318 .dac_nids = alc268_dac_nids,
13319 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13320 .adc_nids = alc268_adc_nids_alt,
13321 .capsrc_nids = alc268_capsrc_nids,
13323 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13324 .channel_mode = alc268_modes,
13325 .unsol_event = alc_sku_unsol_event,
13326 .setup = alc268_dell_setup,
13327 .init_hook = alc_inithook,
13330 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13331 alc268_beep_mixer },
13332 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13333 alc268_toshiba_verbs },
13334 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13335 .dac_nids = alc268_dac_nids,
13336 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13337 .adc_nids = alc268_adc_nids_alt,
13338 .capsrc_nids = alc268_capsrc_nids,
13340 .dig_out_nid = ALC268_DIGOUT_NID,
13341 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13342 .channel_mode = alc268_modes,
13343 .input_mux = &alc268_capture_source,
13344 .setup = alc268_toshiba_setup,
13345 .init_hook = alc268_toshiba_automute,
13347 #ifdef CONFIG_SND_DEBUG
13349 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13350 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13351 alc268_volume_init_verbs },
13352 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13353 .dac_nids = alc268_dac_nids,
13354 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13355 .adc_nids = alc268_adc_nids_alt,
13356 .capsrc_nids = alc268_capsrc_nids,
13358 .dig_out_nid = ALC268_DIGOUT_NID,
13359 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13360 .channel_mode = alc268_modes,
13361 .input_mux = &alc268_capture_source,
13366 static int patch_alc268(struct hda_codec *codec)
13368 struct alc_spec *spec;
13370 int i, has_beep, err;
13372 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13376 codec->spec = spec;
13378 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13382 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13383 board_config = snd_hda_check_board_codec_sid_config(codec,
13384 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13386 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13387 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13389 board_config = ALC268_AUTO;
13392 if (board_config == ALC268_AUTO) {
13393 /* automatic parse from the BIOS config */
13394 err = alc268_parse_auto_config(codec);
13400 "hda_codec: Cannot set up configuration "
13401 "from BIOS. Using base mode...\n");
13402 board_config = ALC268_3ST;
13406 if (board_config != ALC268_AUTO)
13407 setup_preset(codec, &alc268_presets[board_config]);
13409 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13410 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13411 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13413 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13416 for (i = 0; i < spec->num_mixers; i++) {
13417 if (spec->mixers[i] == alc268_beep_mixer) {
13424 err = snd_hda_attach_beep_device(codec, 0x1);
13429 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13430 /* override the amp caps for beep generator */
13431 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13432 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13433 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13434 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13435 (0 << AC_AMPCAP_MUTE_SHIFT));
13438 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13439 /* check whether NID 0x07 is valid */
13440 unsigned int wcap = get_wcaps(codec, 0x07);
13443 spec->capsrc_nids = alc268_capsrc_nids;
13445 wcap = get_wcaps_type(wcap);
13446 if (spec->auto_mic ||
13447 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13448 spec->adc_nids = alc268_adc_nids_alt;
13449 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13450 if (spec->auto_mic)
13451 fixup_automic_adc(codec);
13452 if (spec->auto_mic || spec->input_mux->num_items == 1)
13453 add_mixer(spec, alc268_capture_nosrc_mixer);
13455 add_mixer(spec, alc268_capture_alt_mixer);
13457 spec->adc_nids = alc268_adc_nids;
13458 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13459 add_mixer(spec, alc268_capture_mixer);
13461 /* set default input source */
13462 for (i = 0; i < spec->num_adc_nids; i++)
13463 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13464 0, AC_VERB_SET_CONNECT_SEL,
13465 i < spec->num_mux_defs ?
13466 spec->input_mux[i].items[0].index :
13467 spec->input_mux->items[0].index);
13470 spec->vmaster_nid = 0x02;
13472 codec->patch_ops = alc_patch_ops;
13473 if (board_config == ALC268_AUTO)
13474 spec->init_hook = alc268_auto_init;
13480 * ALC269 channel source setting (2 channel)
13482 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13484 #define alc269_dac_nids alc260_dac_nids
13486 static hda_nid_t alc269_adc_nids[1] = {
13491 static hda_nid_t alc269_capsrc_nids[1] = {
13495 static hda_nid_t alc269vb_adc_nids[1] = {
13500 static hda_nid_t alc269vb_capsrc_nids[1] = {
13504 static hda_nid_t alc269_adc_candidates[] = {
13508 #define alc269_modes alc260_modes
13509 #define alc269_capture_source alc880_lg_lw_capture_source
13511 static struct snd_kcontrol_new alc269_base_mixer[] = {
13512 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13513 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13514 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13515 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13516 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13518 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13519 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13520 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13521 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13523 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13527 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13528 /* output mixer control */
13529 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13531 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13532 .name = "Master Playback Switch",
13533 .subdevice = HDA_SUBDEV_AMP_FLAG,
13534 .info = snd_hda_mixer_amp_switch_info,
13535 .get = snd_hda_mixer_amp_switch_get,
13536 .put = alc268_acer_master_sw_put,
13537 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13541 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13542 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13543 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13544 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13548 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13549 /* output mixer control */
13550 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13552 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13553 .name = "Master Playback Switch",
13554 .subdevice = HDA_SUBDEV_AMP_FLAG,
13555 .info = snd_hda_mixer_amp_switch_info,
13556 .get = snd_hda_mixer_amp_switch_get,
13557 .put = alc268_acer_master_sw_put,
13558 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13562 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13563 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13564 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13565 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13566 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13567 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13568 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13572 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13573 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13574 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13575 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13576 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13580 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13581 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13582 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13583 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13584 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13588 /* capture mixer elements */
13589 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13590 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13591 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13592 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13593 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13597 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13598 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13599 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13600 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13604 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13605 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13606 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13607 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13608 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13612 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13613 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13614 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13615 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13620 #define alc269_fujitsu_mixer alc269_laptop_mixer
13622 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13624 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13625 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13626 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13627 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13628 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13632 static struct hda_verb alc269_lifebook_verbs[] = {
13633 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13634 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13635 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13637 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13639 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13640 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13641 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13642 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13646 /* toggle speaker-output according to the hp-jack state */
13647 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13649 unsigned int present;
13650 unsigned char bits;
13652 present = snd_hda_jack_detect(codec, 0x15);
13653 bits = present ? HDA_AMP_MUTE : 0;
13654 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13655 HDA_AMP_MUTE, bits);
13656 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13657 HDA_AMP_MUTE, bits);
13659 snd_hda_codec_write(codec, 0x20, 0,
13660 AC_VERB_SET_COEF_INDEX, 0x0c);
13661 snd_hda_codec_write(codec, 0x20, 0,
13662 AC_VERB_SET_PROC_COEF, 0x680);
13664 snd_hda_codec_write(codec, 0x20, 0,
13665 AC_VERB_SET_COEF_INDEX, 0x0c);
13666 snd_hda_codec_write(codec, 0x20, 0,
13667 AC_VERB_SET_PROC_COEF, 0x480);
13670 /* toggle speaker-output according to the hp-jacks state */
13671 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13673 unsigned int present;
13674 unsigned char bits;
13676 /* Check laptop headphone socket */
13677 present = snd_hda_jack_detect(codec, 0x15);
13679 /* Check port replicator headphone socket */
13680 present |= snd_hda_jack_detect(codec, 0x1a);
13682 bits = present ? HDA_AMP_MUTE : 0;
13683 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13684 HDA_AMP_MUTE, bits);
13685 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13686 HDA_AMP_MUTE, bits);
13688 snd_hda_codec_write(codec, 0x20, 0,
13689 AC_VERB_SET_COEF_INDEX, 0x0c);
13690 snd_hda_codec_write(codec, 0x20, 0,
13691 AC_VERB_SET_PROC_COEF, 0x680);
13693 snd_hda_codec_write(codec, 0x20, 0,
13694 AC_VERB_SET_COEF_INDEX, 0x0c);
13695 snd_hda_codec_write(codec, 0x20, 0,
13696 AC_VERB_SET_PROC_COEF, 0x480);
13699 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13701 unsigned int present_laptop;
13702 unsigned int present_dock;
13704 present_laptop = snd_hda_jack_detect(codec, 0x18);
13705 present_dock = snd_hda_jack_detect(codec, 0x1b);
13707 /* Laptop mic port overrides dock mic port, design decision */
13709 snd_hda_codec_write(codec, 0x23, 0,
13710 AC_VERB_SET_CONNECT_SEL, 0x3);
13711 if (present_laptop)
13712 snd_hda_codec_write(codec, 0x23, 0,
13713 AC_VERB_SET_CONNECT_SEL, 0x0);
13714 if (!present_dock && !present_laptop)
13715 snd_hda_codec_write(codec, 0x23, 0,
13716 AC_VERB_SET_CONNECT_SEL, 0x1);
13719 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13722 switch (res >> 26) {
13723 case ALC880_HP_EVENT:
13724 alc269_quanta_fl1_speaker_automute(codec);
13726 case ALC880_MIC_EVENT:
13727 alc_mic_automute(codec);
13732 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13735 if ((res >> 26) == ALC880_HP_EVENT)
13736 alc269_lifebook_speaker_automute(codec);
13737 if ((res >> 26) == ALC880_MIC_EVENT)
13738 alc269_lifebook_mic_autoswitch(codec);
13741 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13743 struct alc_spec *spec = codec->spec;
13744 spec->autocfg.hp_pins[0] = 0x15;
13745 spec->autocfg.speaker_pins[0] = 0x14;
13746 spec->ext_mic.pin = 0x18;
13747 spec->ext_mic.mux_idx = 0;
13748 spec->int_mic.pin = 0x19;
13749 spec->int_mic.mux_idx = 1;
13750 spec->auto_mic = 1;
13753 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13755 alc269_quanta_fl1_speaker_automute(codec);
13756 alc_mic_automute(codec);
13759 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13761 alc269_lifebook_speaker_automute(codec);
13762 alc269_lifebook_mic_autoswitch(codec);
13765 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13766 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13767 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13768 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13769 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13770 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13771 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13772 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13776 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13777 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13778 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13779 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13780 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13781 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13782 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13786 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13787 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13788 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13789 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13790 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13791 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13792 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13793 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13797 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13798 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13799 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13800 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13801 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13802 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13803 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13804 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13808 /* toggle speaker-output according to the hp-jack state */
13809 static void alc269_speaker_automute(struct hda_codec *codec)
13811 struct alc_spec *spec = codec->spec;
13812 unsigned int nid = spec->autocfg.hp_pins[0];
13813 unsigned int present;
13814 unsigned char bits;
13816 present = snd_hda_jack_detect(codec, nid);
13817 bits = present ? HDA_AMP_MUTE : 0;
13818 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13819 HDA_AMP_MUTE, bits);
13820 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13821 HDA_AMP_MUTE, bits);
13824 /* unsolicited event for HP jack sensing */
13825 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13828 switch (res >> 26) {
13829 case ALC880_HP_EVENT:
13830 alc269_speaker_automute(codec);
13832 case ALC880_MIC_EVENT:
13833 alc_mic_automute(codec);
13838 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13840 struct alc_spec *spec = codec->spec;
13841 spec->autocfg.hp_pins[0] = 0x15;
13842 spec->autocfg.speaker_pins[0] = 0x14;
13843 spec->ext_mic.pin = 0x18;
13844 spec->ext_mic.mux_idx = 0;
13845 spec->int_mic.pin = 0x12;
13846 spec->int_mic.mux_idx = 5;
13847 spec->auto_mic = 1;
13850 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13852 struct alc_spec *spec = codec->spec;
13853 spec->autocfg.hp_pins[0] = 0x15;
13854 spec->autocfg.speaker_pins[0] = 0x14;
13855 spec->ext_mic.pin = 0x18;
13856 spec->ext_mic.mux_idx = 0;
13857 spec->int_mic.pin = 0x12;
13858 spec->int_mic.mux_idx = 6;
13859 spec->auto_mic = 1;
13862 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13864 struct alc_spec *spec = codec->spec;
13865 spec->autocfg.hp_pins[0] = 0x15;
13866 spec->autocfg.speaker_pins[0] = 0x14;
13867 spec->ext_mic.pin = 0x18;
13868 spec->ext_mic.mux_idx = 0;
13869 spec->int_mic.pin = 0x19;
13870 spec->int_mic.mux_idx = 1;
13871 spec->auto_mic = 1;
13874 static void alc269_laptop_inithook(struct hda_codec *codec)
13876 alc269_speaker_automute(codec);
13877 alc_mic_automute(codec);
13881 * generic initialization of ADC, input mixers and output mixers
13883 static struct hda_verb alc269_init_verbs[] = {
13885 * Unmute ADC0 and set the default input to mic-in
13887 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13890 * Set up output mixers (0x02 - 0x03)
13892 /* set vol=0 to output mixers */
13893 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13894 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13896 /* set up input amps for analog loopback */
13897 /* Amp Indices: DAC = 0, mixer = 1 */
13898 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13899 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13900 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13901 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13902 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13903 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13905 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13906 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13907 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13908 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13910 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13911 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13913 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13914 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13916 /* FIXME: use Mux-type input source selection */
13917 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13918 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13919 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13922 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13926 static struct hda_verb alc269vb_init_verbs[] = {
13928 * Unmute ADC0 and set the default input to mic-in
13930 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13933 * Set up output mixers (0x02 - 0x03)
13935 /* set vol=0 to output mixers */
13936 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13937 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13939 /* set up input amps for analog loopback */
13940 /* Amp Indices: DAC = 0, mixer = 1 */
13941 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13942 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13943 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13944 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13945 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13946 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13948 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13949 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13950 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13951 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13952 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13954 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13956 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13957 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13959 /* FIXME: use Mux-type input source selection */
13960 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13961 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13962 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13965 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13969 #define alc269_auto_create_multi_out_ctls \
13970 alc268_auto_create_multi_out_ctls
13971 #define alc269_auto_create_input_ctls \
13972 alc268_auto_create_input_ctls
13974 #ifdef CONFIG_SND_HDA_POWER_SAVE
13975 #define alc269_loopbacks alc880_loopbacks
13978 /* pcm configuration: identical with ALC880 */
13979 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13980 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13981 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13982 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13984 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13988 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13989 /* NID is set in alc_build_pcms */
13991 .open = alc880_playback_pcm_open,
13992 .prepare = alc880_playback_pcm_prepare,
13993 .cleanup = alc880_playback_pcm_cleanup
13997 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14001 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14002 /* NID is set in alc_build_pcms */
14005 #ifdef CONFIG_SND_HDA_POWER_SAVE
14006 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14008 switch (codec->subsystem_id) {
14015 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14017 /* update mute-LED according to the speaker mute state */
14018 if (nid == 0x01 || nid == 0x14) {
14020 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14025 /* mic2 vref pin is used for mute LED control */
14026 snd_hda_codec_update_cache(codec, 0x19, 0,
14027 AC_VERB_SET_PIN_WIDGET_CONTROL,
14030 return alc_check_power_status(codec, nid);
14032 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14035 * BIOS auto configuration
14037 static int alc269_parse_auto_config(struct hda_codec *codec)
14039 struct alc_spec *spec = codec->spec;
14041 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14043 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14048 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14051 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14055 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14057 if (spec->autocfg.dig_outs)
14058 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
14060 if (spec->kctls.list)
14061 add_mixer(spec, spec->kctls.list);
14063 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14064 add_verb(spec, alc269vb_init_verbs);
14065 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14067 add_verb(spec, alc269_init_verbs);
14068 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14071 spec->num_mux_defs = 1;
14072 spec->input_mux = &spec->private_imux[0];
14073 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14074 sizeof(alc269_adc_candidates));
14076 /* set default input source */
14077 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14078 0, AC_VERB_SET_CONNECT_SEL,
14079 spec->input_mux->items[0].index);
14081 err = alc_auto_add_mic_boost(codec);
14085 if (!spec->cap_mixer && !spec->no_analog)
14086 set_capture_mixer(codec);
14091 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14092 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14093 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14096 /* init callback for auto-configuration model -- overriding the default init */
14097 static void alc269_auto_init(struct hda_codec *codec)
14099 struct alc_spec *spec = codec->spec;
14100 alc269_auto_init_multi_out(codec);
14101 alc269_auto_init_hp_out(codec);
14102 alc269_auto_init_analog_input(codec);
14103 if (spec->unsol_event)
14104 alc_inithook(codec);
14108 * configuration and preset
14110 static const char *alc269_models[ALC269_MODEL_LAST] = {
14111 [ALC269_BASIC] = "basic",
14112 [ALC269_QUANTA_FL1] = "quanta",
14113 [ALC269_AMIC] = "laptop-amic",
14114 [ALC269_DMIC] = "laptop-dmic",
14115 [ALC269_FUJITSU] = "fujitsu",
14116 [ALC269_LIFEBOOK] = "lifebook",
14117 [ALC269_AUTO] = "auto",
14120 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14121 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14122 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14124 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14125 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14126 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14127 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14128 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14129 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14130 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14131 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14132 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14133 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14134 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14135 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14136 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14137 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14138 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14139 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14140 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14141 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14142 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14143 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14144 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14145 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14146 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14147 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14148 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14149 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14150 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14151 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14152 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14153 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14154 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14155 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14156 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14157 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14158 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14159 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14160 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14162 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14164 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14165 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14166 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
14167 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14168 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14169 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14170 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14171 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14172 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14173 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14177 static struct alc_config_preset alc269_presets[] = {
14179 .mixers = { alc269_base_mixer },
14180 .init_verbs = { alc269_init_verbs },
14181 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14182 .dac_nids = alc269_dac_nids,
14184 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14185 .channel_mode = alc269_modes,
14186 .input_mux = &alc269_capture_source,
14188 [ALC269_QUANTA_FL1] = {
14189 .mixers = { alc269_quanta_fl1_mixer },
14190 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14191 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14192 .dac_nids = alc269_dac_nids,
14194 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14195 .channel_mode = alc269_modes,
14196 .input_mux = &alc269_capture_source,
14197 .unsol_event = alc269_quanta_fl1_unsol_event,
14198 .setup = alc269_quanta_fl1_setup,
14199 .init_hook = alc269_quanta_fl1_init_hook,
14202 .mixers = { alc269_laptop_mixer },
14203 .cap_mixer = alc269_laptop_analog_capture_mixer,
14204 .init_verbs = { alc269_init_verbs,
14205 alc269_laptop_amic_init_verbs },
14206 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14207 .dac_nids = alc269_dac_nids,
14209 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14210 .channel_mode = alc269_modes,
14211 .unsol_event = alc269_laptop_unsol_event,
14212 .setup = alc269_laptop_amic_setup,
14213 .init_hook = alc269_laptop_inithook,
14216 .mixers = { alc269_laptop_mixer },
14217 .cap_mixer = alc269_laptop_digital_capture_mixer,
14218 .init_verbs = { alc269_init_verbs,
14219 alc269_laptop_dmic_init_verbs },
14220 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14221 .dac_nids = alc269_dac_nids,
14223 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14224 .channel_mode = alc269_modes,
14225 .unsol_event = alc269_laptop_unsol_event,
14226 .setup = alc269_laptop_dmic_setup,
14227 .init_hook = alc269_laptop_inithook,
14229 [ALC269VB_AMIC] = {
14230 .mixers = { alc269vb_laptop_mixer },
14231 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14232 .init_verbs = { alc269vb_init_verbs,
14233 alc269vb_laptop_amic_init_verbs },
14234 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14235 .dac_nids = alc269_dac_nids,
14237 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14238 .channel_mode = alc269_modes,
14239 .unsol_event = alc269_laptop_unsol_event,
14240 .setup = alc269_laptop_amic_setup,
14241 .init_hook = alc269_laptop_inithook,
14243 [ALC269VB_DMIC] = {
14244 .mixers = { alc269vb_laptop_mixer },
14245 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14246 .init_verbs = { alc269vb_init_verbs,
14247 alc269vb_laptop_dmic_init_verbs },
14248 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14249 .dac_nids = alc269_dac_nids,
14251 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14252 .channel_mode = alc269_modes,
14253 .unsol_event = alc269_laptop_unsol_event,
14254 .setup = alc269vb_laptop_dmic_setup,
14255 .init_hook = alc269_laptop_inithook,
14257 [ALC269_FUJITSU] = {
14258 .mixers = { alc269_fujitsu_mixer },
14259 .cap_mixer = alc269_laptop_digital_capture_mixer,
14260 .init_verbs = { alc269_init_verbs,
14261 alc269_laptop_dmic_init_verbs },
14262 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14263 .dac_nids = alc269_dac_nids,
14265 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14266 .channel_mode = alc269_modes,
14267 .unsol_event = alc269_laptop_unsol_event,
14268 .setup = alc269_laptop_dmic_setup,
14269 .init_hook = alc269_laptop_inithook,
14271 [ALC269_LIFEBOOK] = {
14272 .mixers = { alc269_lifebook_mixer },
14273 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14274 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14275 .dac_nids = alc269_dac_nids,
14277 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14278 .channel_mode = alc269_modes,
14279 .input_mux = &alc269_capture_source,
14280 .unsol_event = alc269_lifebook_unsol_event,
14281 .init_hook = alc269_lifebook_init_hook,
14285 static int patch_alc269(struct hda_codec *codec)
14287 struct alc_spec *spec;
14290 int is_alc269vb = 0;
14292 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14296 codec->spec = spec;
14298 alc_auto_parse_customize_define(codec);
14300 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14301 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14302 spec->cdefine.platform_type == 1)
14303 alc_codec_rename(codec, "ALC271X");
14305 alc_codec_rename(codec, "ALC259");
14308 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14310 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14314 if (board_config < 0) {
14315 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14317 board_config = ALC269_AUTO;
14320 if (board_config == ALC269_AUTO) {
14321 /* automatic parse from the BIOS config */
14322 err = alc269_parse_auto_config(codec);
14328 "hda_codec: Cannot set up configuration "
14329 "from BIOS. Using base mode...\n");
14330 board_config = ALC269_BASIC;
14334 err = snd_hda_attach_beep_device(codec, 0x1);
14340 if (board_config != ALC269_AUTO)
14341 setup_preset(codec, &alc269_presets[board_config]);
14343 if (board_config == ALC269_QUANTA_FL1) {
14344 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14345 * fix the sample rate of analog I/O to 44.1kHz
14347 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14348 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14350 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14351 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14353 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14354 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14356 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14357 if (!is_alc269vb) {
14358 spec->adc_nids = alc269_adc_nids;
14359 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14360 spec->capsrc_nids = alc269_capsrc_nids;
14362 spec->adc_nids = alc269vb_adc_nids;
14363 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14364 spec->capsrc_nids = alc269vb_capsrc_nids;
14368 if (!spec->cap_mixer)
14369 set_capture_mixer(codec);
14370 if (spec->cdefine.enable_pcbeep)
14371 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14373 spec->vmaster_nid = 0x02;
14375 codec->patch_ops = alc_patch_ops;
14376 if (board_config == ALC269_AUTO)
14377 spec->init_hook = alc269_auto_init;
14378 #ifdef CONFIG_SND_HDA_POWER_SAVE
14379 if (!spec->loopback.amplist)
14380 spec->loopback.amplist = alc269_loopbacks;
14381 if (alc269_mic2_for_mute_led(codec))
14382 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14389 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14393 * set the path ways for 2 channel output
14394 * need to set the codec line out and mic 1 pin widgets to inputs
14396 static struct hda_verb alc861_threestack_ch2_init[] = {
14397 /* set pin widget 1Ah (line in) for input */
14398 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14399 /* set pin widget 18h (mic1/2) for input, for mic also enable
14402 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14404 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14406 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14407 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14413 * need to set the codec line out and mic 1 pin widgets to outputs
14415 static struct hda_verb alc861_threestack_ch6_init[] = {
14416 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14417 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14418 /* set pin widget 18h (mic1) for output (CLFE)*/
14419 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14421 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14422 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14424 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14426 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14427 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14432 static struct hda_channel_mode alc861_threestack_modes[2] = {
14433 { 2, alc861_threestack_ch2_init },
14434 { 6, alc861_threestack_ch6_init },
14436 /* Set mic1 as input and unmute the mixer */
14437 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14438 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14439 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14442 /* Set mic1 as output and mute mixer */
14443 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14444 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14445 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14449 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14450 { 2, alc861_uniwill_m31_ch2_init },
14451 { 4, alc861_uniwill_m31_ch4_init },
14454 /* Set mic1 and line-in as input and unmute the mixer */
14455 static struct hda_verb alc861_asus_ch2_init[] = {
14456 /* set pin widget 1Ah (line in) for input */
14457 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14458 /* set pin widget 18h (mic1/2) for input, for mic also enable
14461 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14463 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14465 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14466 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14470 /* Set mic1 nad line-in as output and mute mixer */
14471 static struct hda_verb alc861_asus_ch6_init[] = {
14472 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14473 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14474 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14475 /* set pin widget 18h (mic1) for output (CLFE)*/
14476 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14477 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14478 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14479 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14481 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14483 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14484 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14489 static struct hda_channel_mode alc861_asus_modes[2] = {
14490 { 2, alc861_asus_ch2_init },
14491 { 6, alc861_asus_ch6_init },
14496 static struct snd_kcontrol_new alc861_base_mixer[] = {
14497 /* output mixer control */
14498 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14499 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14500 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14501 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14502 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14504 /*Input mixer control */
14505 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14506 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14507 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14508 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14509 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14510 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14511 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14512 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14513 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14514 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14519 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14520 /* output mixer control */
14521 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14522 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14523 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14524 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14525 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14527 /* Input mixer control */
14528 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14529 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14530 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14531 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14532 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14533 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14534 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14535 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14536 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14540 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14541 .name = "Channel Mode",
14542 .info = alc_ch_mode_info,
14543 .get = alc_ch_mode_get,
14544 .put = alc_ch_mode_put,
14545 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14550 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14551 /* output mixer control */
14552 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14553 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14554 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14559 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14560 /* output mixer control */
14561 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14562 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14563 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14564 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14565 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14567 /* Input mixer control */
14568 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14569 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14570 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14571 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14572 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14573 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14574 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14575 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14576 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14577 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14580 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14581 .name = "Channel Mode",
14582 .info = alc_ch_mode_info,
14583 .get = alc_ch_mode_get,
14584 .put = alc_ch_mode_put,
14585 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14590 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14591 /* output mixer control */
14592 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14593 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14594 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14595 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14596 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14598 /* Input mixer control */
14599 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14600 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14601 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14602 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14603 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14604 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14605 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14606 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14607 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14608 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14611 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14612 .name = "Channel Mode",
14613 .info = alc_ch_mode_info,
14614 .get = alc_ch_mode_get,
14615 .put = alc_ch_mode_put,
14616 .private_value = ARRAY_SIZE(alc861_asus_modes),
14621 /* additional mixer */
14622 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14623 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14624 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14629 * generic initialization of ADC, input mixers and output mixers
14631 static struct hda_verb alc861_base_init_verbs[] = {
14633 * Unmute ADC0 and set the default input to mic-in
14635 /* port-A for surround (rear panel) */
14636 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14637 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14638 /* port-B for mic-in (rear panel) with vref */
14639 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14640 /* port-C for line-in (rear panel) */
14641 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14642 /* port-D for Front */
14643 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14644 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14645 /* port-E for HP out (front panel) */
14646 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14647 /* route front PCM to HP */
14648 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14649 /* port-F for mic-in (front panel) with vref */
14650 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14651 /* port-G for CLFE (rear panel) */
14652 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14653 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14654 /* port-H for side (rear panel) */
14655 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14656 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14658 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14659 /* route front mic to ADC1*/
14660 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14661 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14663 /* Unmute DAC0~3 & spdif out*/
14664 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14665 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14666 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14667 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14668 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14670 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14671 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14672 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14673 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14674 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14676 /* Unmute Stereo Mixer 15 */
14677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14678 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14682 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14683 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14684 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14685 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14686 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14687 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14689 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14690 /* hp used DAC 3 (Front) */
14691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14692 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14697 static struct hda_verb alc861_threestack_init_verbs[] = {
14699 * Unmute ADC0 and set the default input to mic-in
14701 /* port-A for surround (rear panel) */
14702 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14703 /* port-B for mic-in (rear panel) with vref */
14704 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14705 /* port-C for line-in (rear panel) */
14706 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14707 /* port-D for Front */
14708 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14709 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14710 /* port-E for HP out (front panel) */
14711 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14712 /* route front PCM to HP */
14713 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14714 /* port-F for mic-in (front panel) with vref */
14715 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14716 /* port-G for CLFE (rear panel) */
14717 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14718 /* port-H for side (rear panel) */
14719 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14721 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14722 /* route front mic to ADC1*/
14723 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14724 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14725 /* Unmute DAC0~3 & spdif out*/
14726 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14727 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14728 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14729 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14730 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14732 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14733 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14734 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14735 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14736 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14738 /* Unmute Stereo Mixer 15 */
14739 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14740 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14744 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14745 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14746 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14747 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14748 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14749 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14751 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14752 /* hp used DAC 3 (Front) */
14753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14754 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14758 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14760 * Unmute ADC0 and set the default input to mic-in
14762 /* port-A for surround (rear panel) */
14763 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14764 /* port-B for mic-in (rear panel) with vref */
14765 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14766 /* port-C for line-in (rear panel) */
14767 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14768 /* port-D for Front */
14769 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14770 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14771 /* port-E for HP out (front panel) */
14772 /* this has to be set to VREF80 */
14773 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14774 /* route front PCM to HP */
14775 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14776 /* port-F for mic-in (front panel) with vref */
14777 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14778 /* port-G for CLFE (rear panel) */
14779 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14780 /* port-H for side (rear panel) */
14781 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14783 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14784 /* route front mic to ADC1*/
14785 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14787 /* Unmute DAC0~3 & spdif out*/
14788 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14789 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14790 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14791 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14792 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14794 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14795 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14796 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14797 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14798 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14800 /* Unmute Stereo Mixer 15 */
14801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14804 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14806 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14807 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14808 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14809 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14814 /* hp used DAC 3 (Front) */
14815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14816 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14820 static struct hda_verb alc861_asus_init_verbs[] = {
14822 * Unmute ADC0 and set the default input to mic-in
14824 /* port-A for surround (rear panel)
14825 * according to codec#0 this is the HP jack
14827 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14828 /* route front PCM to HP */
14829 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14830 /* port-B for mic-in (rear panel) with vref */
14831 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14832 /* port-C for line-in (rear panel) */
14833 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14834 /* port-D for Front */
14835 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14836 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14837 /* port-E for HP out (front panel) */
14838 /* this has to be set to VREF80 */
14839 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14840 /* route front PCM to HP */
14841 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14842 /* port-F for mic-in (front panel) with vref */
14843 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14844 /* port-G for CLFE (rear panel) */
14845 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14846 /* port-H for side (rear panel) */
14847 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14849 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14850 /* route front mic to ADC1*/
14851 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14852 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14853 /* Unmute DAC0~3 & spdif out*/
14854 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14855 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14856 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14857 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14859 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14860 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14861 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14862 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14863 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14865 /* Unmute Stereo Mixer 15 */
14866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14867 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14868 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14872 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14873 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14874 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14877 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14878 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14879 /* hp used DAC 3 (Front) */
14880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14881 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14885 /* additional init verbs for ASUS laptops */
14886 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14887 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14888 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14893 * generic initialization of ADC, input mixers and output mixers
14895 static struct hda_verb alc861_auto_init_verbs[] = {
14897 * Unmute ADC0 and set the default input to mic-in
14899 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14900 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14902 /* Unmute DAC0~3 & spdif out*/
14903 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14904 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14905 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14906 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14909 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14910 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14911 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14912 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14913 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14915 /* Unmute Stereo Mixer 15 */
14916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14917 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14919 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14921 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14922 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14923 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14924 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14925 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14926 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14928 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14931 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14932 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14933 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14934 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14935 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14936 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14939 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14944 static struct hda_verb alc861_toshiba_init_verbs[] = {
14945 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14950 /* toggle speaker-output according to the hp-jack state */
14951 static void alc861_toshiba_automute(struct hda_codec *codec)
14953 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14955 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14956 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14957 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14958 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14961 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14964 if ((res >> 26) == ALC880_HP_EVENT)
14965 alc861_toshiba_automute(codec);
14968 /* pcm configuration: identical with ALC880 */
14969 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14970 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14971 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14972 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14975 #define ALC861_DIGOUT_NID 0x07
14977 static struct hda_channel_mode alc861_8ch_modes[1] = {
14981 static hda_nid_t alc861_dac_nids[4] = {
14982 /* front, surround, clfe, side */
14983 0x03, 0x06, 0x05, 0x04
14986 static hda_nid_t alc660_dac_nids[3] = {
14987 /* front, clfe, surround */
14991 static hda_nid_t alc861_adc_nids[1] = {
14996 static struct hda_input_mux alc861_capture_source = {
15000 { "Front Mic", 0x3 },
15007 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15009 struct alc_spec *spec = codec->spec;
15010 hda_nid_t mix, srcs[5];
15013 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15015 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15018 for (i = 0; i < num; i++) {
15020 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15021 if (type != AC_WID_AUD_OUT)
15023 for (j = 0; j < spec->multiout.num_dacs; j++)
15024 if (spec->multiout.dac_nids[j] == srcs[i])
15026 if (j >= spec->multiout.num_dacs)
15032 /* fill in the dac_nids table from the parsed pin configuration */
15033 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15034 const struct auto_pin_cfg *cfg)
15036 struct alc_spec *spec = codec->spec;
15038 hda_nid_t nid, dac;
15040 spec->multiout.dac_nids = spec->private_dac_nids;
15041 for (i = 0; i < cfg->line_outs; i++) {
15042 nid = cfg->line_out_pins[i];
15043 dac = alc861_look_for_dac(codec, nid);
15046 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15051 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15052 hda_nid_t nid, unsigned int chs)
15054 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15055 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15058 /* add playback controls from the parsed DAC table */
15059 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15060 const struct auto_pin_cfg *cfg)
15062 struct alc_spec *spec = codec->spec;
15063 static const char *chname[4] = {
15064 "Front", "Surround", NULL /*CLFE*/, "Side"
15069 if (cfg->line_outs == 1) {
15070 const char *pfx = NULL;
15073 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15076 nid = spec->multiout.dac_nids[0];
15077 return alc861_create_out_sw(codec, pfx, nid, 3);
15081 for (i = 0; i < cfg->line_outs; i++) {
15082 nid = spec->multiout.dac_nids[i];
15087 err = alc861_create_out_sw(codec, "Center", nid, 1);
15090 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15094 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15102 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15104 struct alc_spec *spec = codec->spec;
15111 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15112 nid = alc861_look_for_dac(codec, pin);
15114 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15117 spec->multiout.hp_nid = nid;
15123 /* create playback/capture controls for input pins */
15124 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15125 const struct auto_pin_cfg *cfg)
15127 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15130 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15132 int pin_type, hda_nid_t dac)
15134 hda_nid_t mix, srcs[5];
15137 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15139 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15141 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15143 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15146 for (i = 0; i < num; i++) {
15148 if (srcs[i] == dac || srcs[i] == 0x15)
15149 mute = AMP_IN_UNMUTE(i);
15151 mute = AMP_IN_MUTE(i);
15152 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15157 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15159 struct alc_spec *spec = codec->spec;
15162 for (i = 0; i < spec->autocfg.line_outs; i++) {
15163 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15164 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15166 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15167 spec->multiout.dac_nids[i]);
15171 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15173 struct alc_spec *spec = codec->spec;
15175 if (spec->autocfg.hp_outs)
15176 alc861_auto_set_output_and_unmute(codec,
15177 spec->autocfg.hp_pins[0],
15179 spec->multiout.hp_nid);
15180 if (spec->autocfg.speaker_outs)
15181 alc861_auto_set_output_and_unmute(codec,
15182 spec->autocfg.speaker_pins[0],
15184 spec->multiout.dac_nids[0]);
15187 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15189 struct alc_spec *spec = codec->spec;
15192 for (i = 0; i < AUTO_PIN_LAST; i++) {
15193 hda_nid_t nid = spec->autocfg.input_pins[i];
15194 if (nid >= 0x0c && nid <= 0x11)
15195 alc_set_input_pin(codec, nid, i);
15199 /* parse the BIOS configuration and set up the alc_spec */
15200 /* return 1 if successful, 0 if the proper config is not found,
15201 * or a negative error code
15203 static int alc861_parse_auto_config(struct hda_codec *codec)
15205 struct alc_spec *spec = codec->spec;
15207 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15209 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15213 if (!spec->autocfg.line_outs)
15214 return 0; /* can't find valid BIOS pin config */
15216 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15219 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15222 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15225 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15229 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15231 if (spec->autocfg.dig_outs)
15232 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15234 if (spec->kctls.list)
15235 add_mixer(spec, spec->kctls.list);
15237 add_verb(spec, alc861_auto_init_verbs);
15239 spec->num_mux_defs = 1;
15240 spec->input_mux = &spec->private_imux[0];
15242 spec->adc_nids = alc861_adc_nids;
15243 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15244 set_capture_mixer(codec);
15246 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15251 /* additional initialization for auto-configuration model */
15252 static void alc861_auto_init(struct hda_codec *codec)
15254 struct alc_spec *spec = codec->spec;
15255 alc861_auto_init_multi_out(codec);
15256 alc861_auto_init_hp_out(codec);
15257 alc861_auto_init_analog_input(codec);
15258 if (spec->unsol_event)
15259 alc_inithook(codec);
15262 #ifdef CONFIG_SND_HDA_POWER_SAVE
15263 static struct hda_amp_list alc861_loopbacks[] = {
15264 { 0x15, HDA_INPUT, 0 },
15265 { 0x15, HDA_INPUT, 1 },
15266 { 0x15, HDA_INPUT, 2 },
15267 { 0x15, HDA_INPUT, 3 },
15274 * configuration and preset
15276 static const char *alc861_models[ALC861_MODEL_LAST] = {
15277 [ALC861_3ST] = "3stack",
15278 [ALC660_3ST] = "3stack-660",
15279 [ALC861_3ST_DIG] = "3stack-dig",
15280 [ALC861_6ST_DIG] = "6stack-dig",
15281 [ALC861_UNIWILL_M31] = "uniwill-m31",
15282 [ALC861_TOSHIBA] = "toshiba",
15283 [ALC861_ASUS] = "asus",
15284 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15285 [ALC861_AUTO] = "auto",
15288 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15289 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15290 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15291 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15292 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15293 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15294 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15295 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15296 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15297 * Any other models that need this preset?
15299 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15300 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15301 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15302 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15303 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15304 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15305 /* FIXME: the below seems conflict */
15306 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15307 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15308 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15312 static struct alc_config_preset alc861_presets[] = {
15314 .mixers = { alc861_3ST_mixer },
15315 .init_verbs = { alc861_threestack_init_verbs },
15316 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15317 .dac_nids = alc861_dac_nids,
15318 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15319 .channel_mode = alc861_threestack_modes,
15321 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15322 .adc_nids = alc861_adc_nids,
15323 .input_mux = &alc861_capture_source,
15325 [ALC861_3ST_DIG] = {
15326 .mixers = { alc861_base_mixer },
15327 .init_verbs = { alc861_threestack_init_verbs },
15328 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15329 .dac_nids = alc861_dac_nids,
15330 .dig_out_nid = ALC861_DIGOUT_NID,
15331 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15332 .channel_mode = alc861_threestack_modes,
15334 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15335 .adc_nids = alc861_adc_nids,
15336 .input_mux = &alc861_capture_source,
15338 [ALC861_6ST_DIG] = {
15339 .mixers = { alc861_base_mixer },
15340 .init_verbs = { alc861_base_init_verbs },
15341 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15342 .dac_nids = alc861_dac_nids,
15343 .dig_out_nid = ALC861_DIGOUT_NID,
15344 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15345 .channel_mode = alc861_8ch_modes,
15346 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15347 .adc_nids = alc861_adc_nids,
15348 .input_mux = &alc861_capture_source,
15351 .mixers = { alc861_3ST_mixer },
15352 .init_verbs = { alc861_threestack_init_verbs },
15353 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15354 .dac_nids = alc660_dac_nids,
15355 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15356 .channel_mode = alc861_threestack_modes,
15358 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15359 .adc_nids = alc861_adc_nids,
15360 .input_mux = &alc861_capture_source,
15362 [ALC861_UNIWILL_M31] = {
15363 .mixers = { alc861_uniwill_m31_mixer },
15364 .init_verbs = { alc861_uniwill_m31_init_verbs },
15365 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15366 .dac_nids = alc861_dac_nids,
15367 .dig_out_nid = ALC861_DIGOUT_NID,
15368 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15369 .channel_mode = alc861_uniwill_m31_modes,
15371 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15372 .adc_nids = alc861_adc_nids,
15373 .input_mux = &alc861_capture_source,
15375 [ALC861_TOSHIBA] = {
15376 .mixers = { alc861_toshiba_mixer },
15377 .init_verbs = { alc861_base_init_verbs,
15378 alc861_toshiba_init_verbs },
15379 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15380 .dac_nids = alc861_dac_nids,
15381 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15382 .channel_mode = alc883_3ST_2ch_modes,
15383 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15384 .adc_nids = alc861_adc_nids,
15385 .input_mux = &alc861_capture_source,
15386 .unsol_event = alc861_toshiba_unsol_event,
15387 .init_hook = alc861_toshiba_automute,
15390 .mixers = { alc861_asus_mixer },
15391 .init_verbs = { alc861_asus_init_verbs },
15392 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15393 .dac_nids = alc861_dac_nids,
15394 .dig_out_nid = ALC861_DIGOUT_NID,
15395 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15396 .channel_mode = alc861_asus_modes,
15399 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15400 .adc_nids = alc861_adc_nids,
15401 .input_mux = &alc861_capture_source,
15403 [ALC861_ASUS_LAPTOP] = {
15404 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15405 .init_verbs = { alc861_asus_init_verbs,
15406 alc861_asus_laptop_init_verbs },
15407 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15408 .dac_nids = alc861_dac_nids,
15409 .dig_out_nid = ALC861_DIGOUT_NID,
15410 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15411 .channel_mode = alc883_3ST_2ch_modes,
15413 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15414 .adc_nids = alc861_adc_nids,
15415 .input_mux = &alc861_capture_source,
15419 /* Pin config fixes */
15421 PINFIX_FSC_AMILO_PI1505,
15424 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15425 { 0x0b, 0x0221101f }, /* HP */
15426 { 0x0f, 0x90170310 }, /* speaker */
15430 static const struct alc_fixup alc861_fixups[] = {
15431 [PINFIX_FSC_AMILO_PI1505] = {
15432 .pins = alc861_fsc_amilo_pi1505_pinfix
15436 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15437 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15441 static int patch_alc861(struct hda_codec *codec)
15443 struct alc_spec *spec;
15447 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15451 codec->spec = spec;
15453 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15457 if (board_config < 0) {
15458 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15460 board_config = ALC861_AUTO;
15463 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15465 if (board_config == ALC861_AUTO) {
15466 /* automatic parse from the BIOS config */
15467 err = alc861_parse_auto_config(codec);
15473 "hda_codec: Cannot set up configuration "
15474 "from BIOS. Using base mode...\n");
15475 board_config = ALC861_3ST_DIG;
15479 err = snd_hda_attach_beep_device(codec, 0x23);
15485 if (board_config != ALC861_AUTO)
15486 setup_preset(codec, &alc861_presets[board_config]);
15488 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15489 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15491 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15492 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15494 if (!spec->cap_mixer)
15495 set_capture_mixer(codec);
15496 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15498 spec->vmaster_nid = 0x03;
15500 codec->patch_ops = alc_patch_ops;
15501 if (board_config == ALC861_AUTO) {
15502 spec->init_hook = alc861_auto_init;
15503 #ifdef CONFIG_SND_HDA_POWER_SAVE
15504 spec->power_hook = alc_power_eapd;
15507 #ifdef CONFIG_SND_HDA_POWER_SAVE
15508 if (!spec->loopback.amplist)
15509 spec->loopback.amplist = alc861_loopbacks;
15516 * ALC861-VD support
15520 * In addition, an independent DAC
15522 #define ALC861VD_DIGOUT_NID 0x06
15524 static hda_nid_t alc861vd_dac_nids[4] = {
15525 /* front, surr, clfe, side surr */
15526 0x02, 0x03, 0x04, 0x05
15529 /* dac_nids for ALC660vd are in a different order - according to
15530 * Realtek's driver.
15531 * This should probably result in a different mixer for 6stack models
15532 * of ALC660vd codecs, but for now there is only 3stack mixer
15533 * - and it is the same as in 861vd.
15534 * adc_nids in ALC660vd are (is) the same as in 861vd
15536 static hda_nid_t alc660vd_dac_nids[3] = {
15537 /* front, rear, clfe, rear_surr */
15541 static hda_nid_t alc861vd_adc_nids[1] = {
15546 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15549 /* FIXME: should be a matrix-type input source selection */
15550 static struct hda_input_mux alc861vd_capture_source = {
15554 { "Front Mic", 0x1 },
15560 static struct hda_input_mux alc861vd_dallas_capture_source = {
15563 { "Ext Mic", 0x0 },
15564 { "Int Mic", 0x1 },
15568 static struct hda_input_mux alc861vd_hp_capture_source = {
15571 { "Front Mic", 0x0 },
15572 { "ATAPI Mic", 0x1 },
15579 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15586 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15587 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15588 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15589 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15590 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15597 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15598 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15599 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15600 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15601 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15605 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15606 { 6, alc861vd_6stack_ch6_init },
15607 { 8, alc861vd_6stack_ch8_init },
15610 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15613 .name = "Channel Mode",
15614 .info = alc_ch_mode_info,
15615 .get = alc_ch_mode_get,
15616 .put = alc_ch_mode_put,
15621 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15622 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15624 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15625 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15626 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15628 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15629 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15631 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15633 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15635 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15636 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15638 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15639 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15643 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15644 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15645 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15647 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15648 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15649 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15651 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15652 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15654 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15655 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15660 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15661 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15662 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15666 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15670 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15671 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15672 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15674 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15675 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15677 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15678 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15683 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15684 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15685 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15686 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15688 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15690 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15694 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15695 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15696 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15698 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15699 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15704 /* Pin assignment: Speaker=0x14, HP = 0x15,
15705 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15707 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15708 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15709 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15710 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15711 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15712 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15713 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15714 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15715 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15716 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15717 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15721 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15722 * Front Mic=0x18, ATAPI Mic = 0x19,
15724 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15725 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15726 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15727 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15728 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15729 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15730 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15731 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15732 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15738 * generic initialization of ADC, input mixers and output mixers
15740 static struct hda_verb alc861vd_volume_init_verbs[] = {
15742 * Unmute ADC0 and set the default input to mic-in
15744 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15745 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15747 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15748 * the analog-loopback mixer widget
15750 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15751 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15752 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15753 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15754 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15755 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15757 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15761 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15764 * Set up output mixers (0x02 - 0x05)
15766 /* set vol=0 to output mixers */
15767 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15768 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15769 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15770 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15772 /* set up input amps for analog loopback */
15773 /* Amp Indices: DAC = 0, mixer = 1 */
15774 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15776 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15778 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15779 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15780 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15787 * 3-stack pin configuration:
15788 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15790 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15792 * Set pin mode and muting
15794 /* set front pin widgets 0x14 for output */
15795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15796 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15797 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15799 /* Mic (rear) pin: input vref at 80% */
15800 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15801 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15802 /* Front Mic pin: input vref at 80% */
15803 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15804 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15805 /* Line In pin: input */
15806 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15807 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15808 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15809 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15810 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15811 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15812 /* CD pin widget for input */
15813 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15819 * 6-stack pin configuration:
15821 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15823 * Set pin mode and muting
15825 /* set front pin widgets 0x14 for output */
15826 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15827 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15828 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15830 /* Rear Pin: output 1 (0x0d) */
15831 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15832 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15833 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15834 /* CLFE Pin: output 2 (0x0e) */
15835 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15836 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15837 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15838 /* Side Pin: output 3 (0x0f) */
15839 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15840 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15841 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15843 /* Mic (rear) pin: input vref at 80% */
15844 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15845 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15846 /* Front Mic pin: input vref at 80% */
15847 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15848 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15849 /* Line In pin: input */
15850 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15851 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15852 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15853 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15854 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15855 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15856 /* CD pin widget for input */
15857 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15862 static struct hda_verb alc861vd_eapd_verbs[] = {
15863 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15867 static struct hda_verb alc660vd_eapd_verbs[] = {
15868 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15869 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15873 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15876 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15877 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15878 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15882 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15884 unsigned int present;
15885 unsigned char bits;
15887 present = snd_hda_jack_detect(codec, 0x18);
15888 bits = present ? HDA_AMP_MUTE : 0;
15890 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15891 HDA_AMP_MUTE, bits);
15894 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15896 struct alc_spec *spec = codec->spec;
15897 spec->autocfg.hp_pins[0] = 0x1b;
15898 spec->autocfg.speaker_pins[0] = 0x14;
15901 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15903 alc_automute_amp(codec);
15904 alc861vd_lenovo_mic_automute(codec);
15907 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15910 switch (res >> 26) {
15911 case ALC880_MIC_EVENT:
15912 alc861vd_lenovo_mic_automute(codec);
15915 alc_automute_amp_unsol_event(codec, res);
15920 static struct hda_verb alc861vd_dallas_verbs[] = {
15921 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15922 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15923 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15924 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15928 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15929 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15930 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15931 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15932 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15933 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15935 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15936 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15937 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15938 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15939 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15940 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15941 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15942 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15944 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15945 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15946 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15947 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15948 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15949 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15950 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15951 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15958 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15959 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15960 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15965 /* toggle speaker-output according to the hp-jack state */
15966 static void alc861vd_dallas_setup(struct hda_codec *codec)
15968 struct alc_spec *spec = codec->spec;
15970 spec->autocfg.hp_pins[0] = 0x15;
15971 spec->autocfg.speaker_pins[0] = 0x14;
15974 #ifdef CONFIG_SND_HDA_POWER_SAVE
15975 #define alc861vd_loopbacks alc880_loopbacks
15978 /* pcm configuration: identical with ALC880 */
15979 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15980 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15981 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15982 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15985 * configuration and preset
15987 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15988 [ALC660VD_3ST] = "3stack-660",
15989 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15990 [ALC660VD_ASUS_V1S] = "asus-v1s",
15991 [ALC861VD_3ST] = "3stack",
15992 [ALC861VD_3ST_DIG] = "3stack-digout",
15993 [ALC861VD_6ST_DIG] = "6stack-digout",
15994 [ALC861VD_LENOVO] = "lenovo",
15995 [ALC861VD_DALLAS] = "dallas",
15996 [ALC861VD_HP] = "hp",
15997 [ALC861VD_AUTO] = "auto",
16000 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16001 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16002 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16003 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16004 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16005 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16006 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16007 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16008 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16009 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16010 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16011 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16012 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16013 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16014 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16015 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16019 static struct alc_config_preset alc861vd_presets[] = {
16021 .mixers = { alc861vd_3st_mixer },
16022 .init_verbs = { alc861vd_volume_init_verbs,
16023 alc861vd_3stack_init_verbs },
16024 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16025 .dac_nids = alc660vd_dac_nids,
16026 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16027 .channel_mode = alc861vd_3stack_2ch_modes,
16028 .input_mux = &alc861vd_capture_source,
16030 [ALC660VD_3ST_DIG] = {
16031 .mixers = { alc861vd_3st_mixer },
16032 .init_verbs = { alc861vd_volume_init_verbs,
16033 alc861vd_3stack_init_verbs },
16034 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16035 .dac_nids = alc660vd_dac_nids,
16036 .dig_out_nid = ALC861VD_DIGOUT_NID,
16037 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16038 .channel_mode = alc861vd_3stack_2ch_modes,
16039 .input_mux = &alc861vd_capture_source,
16042 .mixers = { alc861vd_3st_mixer },
16043 .init_verbs = { alc861vd_volume_init_verbs,
16044 alc861vd_3stack_init_verbs },
16045 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16046 .dac_nids = alc861vd_dac_nids,
16047 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16048 .channel_mode = alc861vd_3stack_2ch_modes,
16049 .input_mux = &alc861vd_capture_source,
16051 [ALC861VD_3ST_DIG] = {
16052 .mixers = { alc861vd_3st_mixer },
16053 .init_verbs = { alc861vd_volume_init_verbs,
16054 alc861vd_3stack_init_verbs },
16055 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16056 .dac_nids = alc861vd_dac_nids,
16057 .dig_out_nid = ALC861VD_DIGOUT_NID,
16058 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16059 .channel_mode = alc861vd_3stack_2ch_modes,
16060 .input_mux = &alc861vd_capture_source,
16062 [ALC861VD_6ST_DIG] = {
16063 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16064 .init_verbs = { alc861vd_volume_init_verbs,
16065 alc861vd_6stack_init_verbs },
16066 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16067 .dac_nids = alc861vd_dac_nids,
16068 .dig_out_nid = ALC861VD_DIGOUT_NID,
16069 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16070 .channel_mode = alc861vd_6stack_modes,
16071 .input_mux = &alc861vd_capture_source,
16073 [ALC861VD_LENOVO] = {
16074 .mixers = { alc861vd_lenovo_mixer },
16075 .init_verbs = { alc861vd_volume_init_verbs,
16076 alc861vd_3stack_init_verbs,
16077 alc861vd_eapd_verbs,
16078 alc861vd_lenovo_unsol_verbs },
16079 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16080 .dac_nids = alc660vd_dac_nids,
16081 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16082 .channel_mode = alc861vd_3stack_2ch_modes,
16083 .input_mux = &alc861vd_capture_source,
16084 .unsol_event = alc861vd_lenovo_unsol_event,
16085 .setup = alc861vd_lenovo_setup,
16086 .init_hook = alc861vd_lenovo_init_hook,
16088 [ALC861VD_DALLAS] = {
16089 .mixers = { alc861vd_dallas_mixer },
16090 .init_verbs = { alc861vd_dallas_verbs },
16091 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16092 .dac_nids = alc861vd_dac_nids,
16093 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16094 .channel_mode = alc861vd_3stack_2ch_modes,
16095 .input_mux = &alc861vd_dallas_capture_source,
16096 .unsol_event = alc_automute_amp_unsol_event,
16097 .setup = alc861vd_dallas_setup,
16098 .init_hook = alc_automute_amp,
16101 .mixers = { alc861vd_hp_mixer },
16102 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16103 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16104 .dac_nids = alc861vd_dac_nids,
16105 .dig_out_nid = ALC861VD_DIGOUT_NID,
16106 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16107 .channel_mode = alc861vd_3stack_2ch_modes,
16108 .input_mux = &alc861vd_hp_capture_source,
16109 .unsol_event = alc_automute_amp_unsol_event,
16110 .setup = alc861vd_dallas_setup,
16111 .init_hook = alc_automute_amp,
16113 [ALC660VD_ASUS_V1S] = {
16114 .mixers = { alc861vd_lenovo_mixer },
16115 .init_verbs = { alc861vd_volume_init_verbs,
16116 alc861vd_3stack_init_verbs,
16117 alc861vd_eapd_verbs,
16118 alc861vd_lenovo_unsol_verbs },
16119 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16120 .dac_nids = alc660vd_dac_nids,
16121 .dig_out_nid = ALC861VD_DIGOUT_NID,
16122 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16123 .channel_mode = alc861vd_3stack_2ch_modes,
16124 .input_mux = &alc861vd_capture_source,
16125 .unsol_event = alc861vd_lenovo_unsol_event,
16126 .setup = alc861vd_lenovo_setup,
16127 .init_hook = alc861vd_lenovo_init_hook,
16132 * BIOS auto configuration
16134 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16135 const struct auto_pin_cfg *cfg)
16137 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16141 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16142 hda_nid_t nid, int pin_type, int dac_idx)
16144 alc_set_pin_output(codec, nid, pin_type);
16147 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16149 struct alc_spec *spec = codec->spec;
16152 for (i = 0; i <= HDA_SIDE; i++) {
16153 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16154 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16156 alc861vd_auto_set_output_and_unmute(codec, nid,
16162 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16164 struct alc_spec *spec = codec->spec;
16167 pin = spec->autocfg.hp_pins[0];
16168 if (pin) /* connect to front and use dac 0 */
16169 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16170 pin = spec->autocfg.speaker_pins[0];
16172 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16175 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16177 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16179 struct alc_spec *spec = codec->spec;
16182 for (i = 0; i < AUTO_PIN_LAST; i++) {
16183 hda_nid_t nid = spec->autocfg.input_pins[i];
16184 if (alc_is_input_pin(codec, nid)) {
16185 alc_set_input_pin(codec, nid, i);
16186 if (nid != ALC861VD_PIN_CD_NID &&
16187 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16188 snd_hda_codec_write(codec, nid, 0,
16189 AC_VERB_SET_AMP_GAIN_MUTE,
16195 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16197 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16198 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16200 /* add playback controls from the parsed DAC table */
16201 /* Based on ALC880 version. But ALC861VD has separate,
16202 * different NIDs for mute/unmute switch and volume control */
16203 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16204 const struct auto_pin_cfg *cfg)
16206 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16207 hda_nid_t nid_v, nid_s;
16210 for (i = 0; i < cfg->line_outs; i++) {
16211 if (!spec->multiout.dac_nids[i])
16213 nid_v = alc861vd_idx_to_mixer_vol(
16215 spec->multiout.dac_nids[i]));
16216 nid_s = alc861vd_idx_to_mixer_switch(
16218 spec->multiout.dac_nids[i]));
16222 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16224 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16228 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16230 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16234 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16236 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16240 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16242 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16248 if (cfg->line_outs == 1 &&
16249 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16256 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16257 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16261 if (cfg->line_outs == 1 &&
16262 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16264 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16265 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16274 /* add playback controls for speaker and HP outputs */
16275 /* Based on ALC880 version. But ALC861VD has separate,
16276 * different NIDs for mute/unmute switch and volume control */
16277 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16278 hda_nid_t pin, const char *pfx)
16280 hda_nid_t nid_v, nid_s;
16286 if (alc880_is_fixed_pin(pin)) {
16287 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16288 /* specify the DAC as the extra output */
16289 if (!spec->multiout.hp_nid)
16290 spec->multiout.hp_nid = nid_v;
16292 spec->multiout.extra_out_nid[0] = nid_v;
16293 /* control HP volume/switch on the output mixer amp */
16294 nid_v = alc861vd_idx_to_mixer_vol(
16295 alc880_fixed_pin_idx(pin));
16296 nid_s = alc861vd_idx_to_mixer_switch(
16297 alc880_fixed_pin_idx(pin));
16299 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16300 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16303 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16304 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16307 } else if (alc880_is_multi_pin(pin)) {
16308 /* set manual connection */
16309 /* we have only a switch on HP-out PIN */
16310 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16311 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16318 /* parse the BIOS configuration and set up the alc_spec
16319 * return 1 if successful, 0 if the proper config is not found,
16320 * or a negative error code
16321 * Based on ALC880 version - had to change it to override
16322 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16323 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16325 struct alc_spec *spec = codec->spec;
16327 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16329 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16333 if (!spec->autocfg.line_outs)
16334 return 0; /* can't find valid BIOS pin config */
16336 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16339 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16342 err = alc861vd_auto_create_extra_out(spec,
16343 spec->autocfg.speaker_pins[0],
16347 err = alc861vd_auto_create_extra_out(spec,
16348 spec->autocfg.hp_pins[0],
16352 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16356 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16358 if (spec->autocfg.dig_outs)
16359 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16361 if (spec->kctls.list)
16362 add_mixer(spec, spec->kctls.list);
16364 add_verb(spec, alc861vd_volume_init_verbs);
16366 spec->num_mux_defs = 1;
16367 spec->input_mux = &spec->private_imux[0];
16369 err = alc_auto_add_mic_boost(codec);
16373 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16378 /* additional initialization for auto-configuration model */
16379 static void alc861vd_auto_init(struct hda_codec *codec)
16381 struct alc_spec *spec = codec->spec;
16382 alc861vd_auto_init_multi_out(codec);
16383 alc861vd_auto_init_hp_out(codec);
16384 alc861vd_auto_init_analog_input(codec);
16385 alc861vd_auto_init_input_src(codec);
16386 if (spec->unsol_event)
16387 alc_inithook(codec);
16391 ALC660VD_FIX_ASUS_GPIO1
16395 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16396 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16397 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16398 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16402 static const struct alc_fixup alc861vd_fixups[] = {
16403 [ALC660VD_FIX_ASUS_GPIO1] = {
16404 .verbs = alc660vd_fix_asus_gpio1_verbs,
16408 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16409 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16413 static int patch_alc861vd(struct hda_codec *codec)
16415 struct alc_spec *spec;
16416 int err, board_config;
16418 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16422 codec->spec = spec;
16424 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16428 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16429 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16431 board_config = ALC861VD_AUTO;
16434 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16436 if (board_config == ALC861VD_AUTO) {
16437 /* automatic parse from the BIOS config */
16438 err = alc861vd_parse_auto_config(codec);
16444 "hda_codec: Cannot set up configuration "
16445 "from BIOS. Using base mode...\n");
16446 board_config = ALC861VD_3ST;
16450 err = snd_hda_attach_beep_device(codec, 0x23);
16456 if (board_config != ALC861VD_AUTO)
16457 setup_preset(codec, &alc861vd_presets[board_config]);
16459 if (codec->vendor_id == 0x10ec0660) {
16460 /* always turn on EAPD */
16461 add_verb(spec, alc660vd_eapd_verbs);
16464 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16465 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16467 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16468 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16470 if (!spec->adc_nids) {
16471 spec->adc_nids = alc861vd_adc_nids;
16472 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16474 if (!spec->capsrc_nids)
16475 spec->capsrc_nids = alc861vd_capsrc_nids;
16477 set_capture_mixer(codec);
16478 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16480 spec->vmaster_nid = 0x02;
16482 codec->patch_ops = alc_patch_ops;
16484 if (board_config == ALC861VD_AUTO)
16485 spec->init_hook = alc861vd_auto_init;
16486 #ifdef CONFIG_SND_HDA_POWER_SAVE
16487 if (!spec->loopback.amplist)
16488 spec->loopback.amplist = alc861vd_loopbacks;
16497 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16498 * configuration. Each pin widget can choose any input DACs and a mixer.
16499 * Each ADC is connected from a mixer of all inputs. This makes possible
16500 * 6-channel independent captures.
16502 * In addition, an independent DAC for the multi-playback (not used in this
16505 #define ALC662_DIGOUT_NID 0x06
16506 #define ALC662_DIGIN_NID 0x0a
16508 static hda_nid_t alc662_dac_nids[4] = {
16509 /* front, rear, clfe, rear_surr */
16513 static hda_nid_t alc272_dac_nids[2] = {
16517 static hda_nid_t alc662_adc_nids[2] = {
16522 static hda_nid_t alc272_adc_nids[1] = {
16527 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16528 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16532 /* FIXME: should be a matrix-type input source selection */
16533 static struct hda_input_mux alc662_capture_source = {
16537 { "Front Mic", 0x1 },
16543 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16551 static struct hda_input_mux alc663_capture_source = {
16555 { "Front Mic", 0x1 },
16560 #if 0 /* set to 1 for testing other input sources below */
16561 static struct hda_input_mux alc272_nc10_capture_source = {
16564 { "Autoselect Mic", 0x0 },
16565 { "Internal Mic", 0x1 },
16566 { "In-0x02", 0x2 },
16567 { "In-0x03", 0x3 },
16568 { "In-0x04", 0x4 },
16569 { "In-0x05", 0x5 },
16570 { "In-0x06", 0x6 },
16571 { "In-0x07", 0x7 },
16572 { "In-0x08", 0x8 },
16573 { "In-0x09", 0x9 },
16574 { "In-0x0a", 0x0a },
16575 { "In-0x0b", 0x0b },
16576 { "In-0x0c", 0x0c },
16577 { "In-0x0d", 0x0d },
16578 { "In-0x0e", 0x0e },
16579 { "In-0x0f", 0x0f },
16587 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16594 static struct hda_verb alc662_3ST_ch2_init[] = {
16595 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16596 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16597 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16598 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16605 static struct hda_verb alc662_3ST_ch6_init[] = {
16606 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16607 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16608 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16609 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16610 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16611 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16615 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16616 { 2, alc662_3ST_ch2_init },
16617 { 6, alc662_3ST_ch6_init },
16623 static struct hda_verb alc662_sixstack_ch6_init[] = {
16624 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16625 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16626 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16633 static struct hda_verb alc662_sixstack_ch8_init[] = {
16634 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16635 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16636 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16640 static struct hda_channel_mode alc662_5stack_modes[2] = {
16641 { 2, alc662_sixstack_ch6_init },
16642 { 6, alc662_sixstack_ch8_init },
16645 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16646 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16649 static struct snd_kcontrol_new alc662_base_mixer[] = {
16650 /* output mixer control */
16651 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16652 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16653 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16654 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16655 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16656 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16657 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16658 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16659 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16661 /*Input mixer control */
16662 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16663 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16664 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16665 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16666 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16667 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16668 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16669 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16673 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16674 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16675 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16677 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16678 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16679 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16680 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16683 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16684 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16688 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16689 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16690 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16691 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16692 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16693 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16694 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16695 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16696 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16697 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16698 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16699 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16700 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16701 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16702 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16703 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16704 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16705 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16709 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16710 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16711 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16712 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16713 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16714 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16715 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16716 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16717 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16718 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16722 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16723 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16724 ALC262_HIPPO_MASTER_SWITCH,
16726 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16727 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16728 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16730 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16731 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16732 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16736 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16737 ALC262_HIPPO_MASTER_SWITCH,
16738 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16739 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16740 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16741 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16742 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16743 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16744 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16745 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16750 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16751 .ops = &snd_hda_bind_vol,
16753 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16754 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16759 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16760 .ops = &snd_hda_bind_sw,
16762 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16763 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16768 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16769 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16770 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16772 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16776 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16777 .ops = &snd_hda_bind_sw,
16779 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16780 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16781 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16786 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16787 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16788 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16789 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16791 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16792 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16797 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16798 .ops = &snd_hda_bind_sw,
16800 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16801 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16802 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16807 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16808 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16809 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16811 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16812 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16813 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16817 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16818 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16819 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16820 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16822 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16823 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16824 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16828 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16829 .ops = &snd_hda_bind_vol,
16831 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16832 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16837 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16838 .ops = &snd_hda_bind_sw,
16840 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16841 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16846 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16847 HDA_BIND_VOL("Master Playback Volume",
16848 &alc663_asus_two_bind_master_vol),
16849 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16850 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16851 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16853 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16857 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16858 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16859 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16860 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16862 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16863 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16867 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16868 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16869 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16870 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16871 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16872 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16876 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16877 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16881 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16882 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16883 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16884 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16886 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16887 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16888 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16889 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16890 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16891 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16895 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16896 .ops = &snd_hda_bind_sw,
16898 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16899 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16900 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16901 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16902 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16907 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16908 .ops = &snd_hda_bind_sw,
16910 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16911 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16916 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16917 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16918 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16919 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16920 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16921 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16922 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16923 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16929 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16930 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16931 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16932 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16933 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16934 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16941 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16943 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16944 .name = "Channel Mode",
16945 .info = alc_ch_mode_info,
16946 .get = alc_ch_mode_get,
16947 .put = alc_ch_mode_put,
16952 static struct hda_verb alc662_init_verbs[] = {
16953 /* ADC: mute amp left and right */
16954 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16955 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16959 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16960 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16961 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16962 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16964 /* Front Pin: output 0 (0x0c) */
16965 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16966 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16968 /* Rear Pin: output 1 (0x0d) */
16969 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16970 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16972 /* CLFE Pin: output 2 (0x0e) */
16973 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16974 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16976 /* Mic (rear) pin: input vref at 80% */
16977 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16978 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16979 /* Front Mic pin: input vref at 80% */
16980 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16981 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16982 /* Line In pin: input */
16983 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16984 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16985 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16986 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16987 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16988 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16989 /* CD pin widget for input */
16990 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16992 /* FIXME: use matrix-type input source selection */
16993 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16996 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16998 /* always trun on EAPD */
16999 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17000 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17005 static struct hda_verb alc663_init_verbs[] = {
17006 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17007 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17008 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17009 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17010 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17011 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17015 static struct hda_verb alc272_init_verbs[] = {
17016 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17017 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17018 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17019 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17020 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17021 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17022 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17023 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17027 static struct hda_verb alc662_sue_init_verbs[] = {
17028 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17029 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17033 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17034 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17035 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17039 /* Set Unsolicited Event*/
17040 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17042 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17046 static struct hda_verb alc663_m51va_init_verbs[] = {
17047 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17048 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17049 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17050 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17051 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17054 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17055 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17059 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17060 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17061 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17062 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17065 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17066 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17070 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17071 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17072 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17073 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17074 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17075 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17076 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17077 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17078 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17082 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17083 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17084 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17085 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17088 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17089 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17093 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17094 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17095 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17096 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17097 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17098 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17099 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17100 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17103 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17104 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17105 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17109 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17110 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17111 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17112 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17113 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17114 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17116 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17119 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17120 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17121 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17125 static struct hda_verb alc663_g71v_init_verbs[] = {
17126 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17127 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17128 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17130 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17131 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17132 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17134 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17135 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17136 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17140 static struct hda_verb alc663_g50v_init_verbs[] = {
17141 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17142 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17143 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17145 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17146 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17150 static struct hda_verb alc662_ecs_init_verbs[] = {
17151 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17153 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17154 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17158 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17159 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17160 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17161 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17162 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17163 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17164 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17165 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17166 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17167 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17168 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17169 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17173 static struct hda_verb alc272_dell_init_verbs[] = {
17174 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17175 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17176 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17177 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17178 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17179 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17180 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17181 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17182 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17183 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17184 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17188 static struct hda_verb alc663_mode7_init_verbs[] = {
17189 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17190 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17191 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17192 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17193 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17194 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17195 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17196 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17197 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17198 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17201 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17202 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17203 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17207 static struct hda_verb alc663_mode8_init_verbs[] = {
17208 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17210 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17212 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17213 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17214 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17215 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17216 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17217 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17218 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17220 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17221 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17222 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17223 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17227 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17228 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17229 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17233 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17234 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17235 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17239 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17241 unsigned int present;
17242 unsigned char bits;
17244 present = snd_hda_jack_detect(codec, 0x14);
17245 bits = present ? HDA_AMP_MUTE : 0;
17247 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17248 HDA_AMP_MUTE, bits);
17251 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17253 unsigned int present;
17254 unsigned char bits;
17256 present = snd_hda_jack_detect(codec, 0x1b);
17257 bits = present ? HDA_AMP_MUTE : 0;
17259 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17260 HDA_AMP_MUTE, bits);
17261 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17262 HDA_AMP_MUTE, bits);
17265 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17268 if ((res >> 26) == ALC880_HP_EVENT)
17269 alc662_lenovo_101e_all_automute(codec);
17270 if ((res >> 26) == ALC880_FRONT_EVENT)
17271 alc662_lenovo_101e_ispeaker_automute(codec);
17274 /* unsolicited event for HP jack sensing */
17275 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17278 if ((res >> 26) == ALC880_MIC_EVENT)
17279 alc_mic_automute(codec);
17281 alc262_hippo_unsol_event(codec, res);
17284 static void alc662_eeepc_setup(struct hda_codec *codec)
17286 struct alc_spec *spec = codec->spec;
17288 alc262_hippo1_setup(codec);
17289 spec->ext_mic.pin = 0x18;
17290 spec->ext_mic.mux_idx = 0;
17291 spec->int_mic.pin = 0x19;
17292 spec->int_mic.mux_idx = 1;
17293 spec->auto_mic = 1;
17296 static void alc662_eeepc_inithook(struct hda_codec *codec)
17298 alc262_hippo_automute(codec);
17299 alc_mic_automute(codec);
17302 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17304 struct alc_spec *spec = codec->spec;
17306 spec->autocfg.hp_pins[0] = 0x14;
17307 spec->autocfg.speaker_pins[0] = 0x1b;
17310 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17312 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17314 unsigned int present;
17315 unsigned char bits;
17317 present = snd_hda_jack_detect(codec, 0x21);
17318 bits = present ? HDA_AMP_MUTE : 0;
17319 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17320 HDA_AMP_MUTE, bits);
17321 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17322 HDA_AMP_MUTE, bits);
17325 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17327 unsigned int present;
17328 unsigned char bits;
17330 present = snd_hda_jack_detect(codec, 0x21);
17331 bits = present ? HDA_AMP_MUTE : 0;
17332 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17333 HDA_AMP_MUTE, bits);
17334 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17335 HDA_AMP_MUTE, bits);
17336 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17337 HDA_AMP_MUTE, bits);
17338 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17339 HDA_AMP_MUTE, bits);
17342 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17344 unsigned int present;
17345 unsigned char bits;
17347 present = snd_hda_jack_detect(codec, 0x15);
17348 bits = present ? HDA_AMP_MUTE : 0;
17349 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17350 HDA_AMP_MUTE, bits);
17351 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17352 HDA_AMP_MUTE, bits);
17353 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17354 HDA_AMP_MUTE, bits);
17355 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17356 HDA_AMP_MUTE, bits);
17359 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17361 unsigned int present;
17362 unsigned char bits;
17364 present = snd_hda_jack_detect(codec, 0x1b);
17365 bits = present ? 0 : PIN_OUT;
17366 snd_hda_codec_write(codec, 0x14, 0,
17367 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17370 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17372 unsigned int present1, present2;
17374 present1 = snd_hda_jack_detect(codec, 0x21);
17375 present2 = snd_hda_jack_detect(codec, 0x15);
17377 if (present1 || present2) {
17378 snd_hda_codec_write_cache(codec, 0x14, 0,
17379 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17381 snd_hda_codec_write_cache(codec, 0x14, 0,
17382 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17386 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17388 unsigned int present1, present2;
17390 present1 = snd_hda_jack_detect(codec, 0x1b);
17391 present2 = snd_hda_jack_detect(codec, 0x15);
17393 if (present1 || present2) {
17394 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17395 HDA_AMP_MUTE, HDA_AMP_MUTE);
17396 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17397 HDA_AMP_MUTE, HDA_AMP_MUTE);
17399 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17401 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17406 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17408 unsigned int present1, present2;
17410 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17411 AC_VERB_GET_PIN_SENSE, 0)
17412 & AC_PINSENSE_PRESENCE;
17413 present2 = snd_hda_codec_read(codec, 0x21, 0,
17414 AC_VERB_GET_PIN_SENSE, 0)
17415 & AC_PINSENSE_PRESENCE;
17417 if (present1 || present2) {
17418 snd_hda_codec_write_cache(codec, 0x14, 0,
17419 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17420 snd_hda_codec_write_cache(codec, 0x17, 0,
17421 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17423 snd_hda_codec_write_cache(codec, 0x14, 0,
17424 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17425 snd_hda_codec_write_cache(codec, 0x17, 0,
17426 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17430 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17432 unsigned int present1, present2;
17434 present1 = snd_hda_codec_read(codec, 0x21, 0,
17435 AC_VERB_GET_PIN_SENSE, 0)
17436 & AC_PINSENSE_PRESENCE;
17437 present2 = snd_hda_codec_read(codec, 0x15, 0,
17438 AC_VERB_GET_PIN_SENSE, 0)
17439 & AC_PINSENSE_PRESENCE;
17441 if (present1 || present2) {
17442 snd_hda_codec_write_cache(codec, 0x14, 0,
17443 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17444 snd_hda_codec_write_cache(codec, 0x17, 0,
17445 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17447 snd_hda_codec_write_cache(codec, 0x14, 0,
17448 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17449 snd_hda_codec_write_cache(codec, 0x17, 0,
17450 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17454 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17457 switch (res >> 26) {
17458 case ALC880_HP_EVENT:
17459 alc663_m51va_speaker_automute(codec);
17461 case ALC880_MIC_EVENT:
17462 alc_mic_automute(codec);
17467 static void alc663_m51va_setup(struct hda_codec *codec)
17469 struct alc_spec *spec = codec->spec;
17470 spec->ext_mic.pin = 0x18;
17471 spec->ext_mic.mux_idx = 0;
17472 spec->int_mic.pin = 0x12;
17473 spec->int_mic.mux_idx = 9;
17474 spec->auto_mic = 1;
17477 static void alc663_m51va_inithook(struct hda_codec *codec)
17479 alc663_m51va_speaker_automute(codec);
17480 alc_mic_automute(codec);
17483 /* ***************** Mode1 ******************************/
17484 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17486 static void alc663_mode1_setup(struct hda_codec *codec)
17488 struct alc_spec *spec = codec->spec;
17489 spec->ext_mic.pin = 0x18;
17490 spec->ext_mic.mux_idx = 0;
17491 spec->int_mic.pin = 0x19;
17492 spec->int_mic.mux_idx = 1;
17493 spec->auto_mic = 1;
17496 #define alc663_mode1_inithook alc663_m51va_inithook
17498 /* ***************** Mode2 ******************************/
17499 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17502 switch (res >> 26) {
17503 case ALC880_HP_EVENT:
17504 alc662_f5z_speaker_automute(codec);
17506 case ALC880_MIC_EVENT:
17507 alc_mic_automute(codec);
17512 #define alc662_mode2_setup alc663_mode1_setup
17514 static void alc662_mode2_inithook(struct hda_codec *codec)
17516 alc662_f5z_speaker_automute(codec);
17517 alc_mic_automute(codec);
17519 /* ***************** Mode3 ******************************/
17520 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17523 switch (res >> 26) {
17524 case ALC880_HP_EVENT:
17525 alc663_two_hp_m1_speaker_automute(codec);
17527 case ALC880_MIC_EVENT:
17528 alc_mic_automute(codec);
17533 #define alc663_mode3_setup alc663_mode1_setup
17535 static void alc663_mode3_inithook(struct hda_codec *codec)
17537 alc663_two_hp_m1_speaker_automute(codec);
17538 alc_mic_automute(codec);
17540 /* ***************** Mode4 ******************************/
17541 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17544 switch (res >> 26) {
17545 case ALC880_HP_EVENT:
17546 alc663_21jd_two_speaker_automute(codec);
17548 case ALC880_MIC_EVENT:
17549 alc_mic_automute(codec);
17554 #define alc663_mode4_setup alc663_mode1_setup
17556 static void alc663_mode4_inithook(struct hda_codec *codec)
17558 alc663_21jd_two_speaker_automute(codec);
17559 alc_mic_automute(codec);
17561 /* ***************** Mode5 ******************************/
17562 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17565 switch (res >> 26) {
17566 case ALC880_HP_EVENT:
17567 alc663_15jd_two_speaker_automute(codec);
17569 case ALC880_MIC_EVENT:
17570 alc_mic_automute(codec);
17575 #define alc663_mode5_setup alc663_mode1_setup
17577 static void alc663_mode5_inithook(struct hda_codec *codec)
17579 alc663_15jd_two_speaker_automute(codec);
17580 alc_mic_automute(codec);
17582 /* ***************** Mode6 ******************************/
17583 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17586 switch (res >> 26) {
17587 case ALC880_HP_EVENT:
17588 alc663_two_hp_m2_speaker_automute(codec);
17590 case ALC880_MIC_EVENT:
17591 alc_mic_automute(codec);
17596 #define alc663_mode6_setup alc663_mode1_setup
17598 static void alc663_mode6_inithook(struct hda_codec *codec)
17600 alc663_two_hp_m2_speaker_automute(codec);
17601 alc_mic_automute(codec);
17604 /* ***************** Mode7 ******************************/
17605 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17608 switch (res >> 26) {
17609 case ALC880_HP_EVENT:
17610 alc663_two_hp_m7_speaker_automute(codec);
17612 case ALC880_MIC_EVENT:
17613 alc_mic_automute(codec);
17618 #define alc663_mode7_setup alc663_mode1_setup
17620 static void alc663_mode7_inithook(struct hda_codec *codec)
17622 alc663_two_hp_m7_speaker_automute(codec);
17623 alc_mic_automute(codec);
17626 /* ***************** Mode8 ******************************/
17627 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17630 switch (res >> 26) {
17631 case ALC880_HP_EVENT:
17632 alc663_two_hp_m8_speaker_automute(codec);
17634 case ALC880_MIC_EVENT:
17635 alc_mic_automute(codec);
17640 #define alc663_mode8_setup alc663_m51va_setup
17642 static void alc663_mode8_inithook(struct hda_codec *codec)
17644 alc663_two_hp_m8_speaker_automute(codec);
17645 alc_mic_automute(codec);
17648 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17650 unsigned int present;
17651 unsigned char bits;
17653 present = snd_hda_jack_detect(codec, 0x21);
17654 bits = present ? HDA_AMP_MUTE : 0;
17655 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17656 HDA_AMP_MUTE, bits);
17657 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17658 HDA_AMP_MUTE, bits);
17661 static void alc663_g71v_front_automute(struct hda_codec *codec)
17663 unsigned int present;
17664 unsigned char bits;
17666 present = snd_hda_jack_detect(codec, 0x15);
17667 bits = present ? HDA_AMP_MUTE : 0;
17668 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17669 HDA_AMP_MUTE, bits);
17672 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17675 switch (res >> 26) {
17676 case ALC880_HP_EVENT:
17677 alc663_g71v_hp_automute(codec);
17679 case ALC880_FRONT_EVENT:
17680 alc663_g71v_front_automute(codec);
17682 case ALC880_MIC_EVENT:
17683 alc_mic_automute(codec);
17688 #define alc663_g71v_setup alc663_m51va_setup
17690 static void alc663_g71v_inithook(struct hda_codec *codec)
17692 alc663_g71v_front_automute(codec);
17693 alc663_g71v_hp_automute(codec);
17694 alc_mic_automute(codec);
17697 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17700 switch (res >> 26) {
17701 case ALC880_HP_EVENT:
17702 alc663_m51va_speaker_automute(codec);
17704 case ALC880_MIC_EVENT:
17705 alc_mic_automute(codec);
17710 #define alc663_g50v_setup alc663_m51va_setup
17712 static void alc663_g50v_inithook(struct hda_codec *codec)
17714 alc663_m51va_speaker_automute(codec);
17715 alc_mic_automute(codec);
17718 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17719 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17720 ALC262_HIPPO_MASTER_SWITCH,
17722 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17723 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17724 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17726 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17727 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17728 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17732 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17733 /* Master Playback automatically created from Speaker and Headphone */
17734 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17735 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17736 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17737 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17739 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17740 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17741 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17743 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17744 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17745 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17749 #ifdef CONFIG_SND_HDA_POWER_SAVE
17750 #define alc662_loopbacks alc880_loopbacks
17754 /* pcm configuration: identical with ALC880 */
17755 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17756 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17757 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17758 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17761 * configuration and preset
17763 static const char *alc662_models[ALC662_MODEL_LAST] = {
17764 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17765 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17766 [ALC662_3ST_6ch] = "3stack-6ch",
17767 [ALC662_5ST_DIG] = "6stack-dig",
17768 [ALC662_LENOVO_101E] = "lenovo-101e",
17769 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17770 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17771 [ALC662_ECS] = "ecs",
17772 [ALC663_ASUS_M51VA] = "m51va",
17773 [ALC663_ASUS_G71V] = "g71v",
17774 [ALC663_ASUS_H13] = "h13",
17775 [ALC663_ASUS_G50V] = "g50v",
17776 [ALC663_ASUS_MODE1] = "asus-mode1",
17777 [ALC662_ASUS_MODE2] = "asus-mode2",
17778 [ALC663_ASUS_MODE3] = "asus-mode3",
17779 [ALC663_ASUS_MODE4] = "asus-mode4",
17780 [ALC663_ASUS_MODE5] = "asus-mode5",
17781 [ALC663_ASUS_MODE6] = "asus-mode6",
17782 [ALC663_ASUS_MODE7] = "asus-mode7",
17783 [ALC663_ASUS_MODE8] = "asus-mode8",
17784 [ALC272_DELL] = "dell",
17785 [ALC272_DELL_ZM1] = "dell-zm1",
17786 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17787 [ALC662_AUTO] = "auto",
17790 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17791 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17792 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17793 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17794 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17795 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17796 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17797 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17798 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17799 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17800 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17801 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17802 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17803 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17804 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17805 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17806 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17807 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17808 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17809 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17810 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17811 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17812 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17813 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17814 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17815 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17816 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17817 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17818 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17819 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17820 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17821 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17822 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17823 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17824 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17825 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17826 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17827 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17828 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17829 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17830 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17831 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17832 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17833 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17834 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17835 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17836 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17837 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17838 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17839 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17840 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17841 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17842 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17843 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17844 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17845 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17846 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17847 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17848 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17849 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17850 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17851 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17852 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17853 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17854 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17855 ALC662_3ST_6ch_DIG),
17856 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17857 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17858 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17859 ALC662_3ST_6ch_DIG),
17860 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17861 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17862 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17863 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17864 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17865 ALC662_3ST_6ch_DIG),
17866 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17868 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17872 static struct alc_config_preset alc662_presets[] = {
17873 [ALC662_3ST_2ch_DIG] = {
17874 .mixers = { alc662_3ST_2ch_mixer },
17875 .init_verbs = { alc662_init_verbs },
17876 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17877 .dac_nids = alc662_dac_nids,
17878 .dig_out_nid = ALC662_DIGOUT_NID,
17879 .dig_in_nid = ALC662_DIGIN_NID,
17880 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17881 .channel_mode = alc662_3ST_2ch_modes,
17882 .input_mux = &alc662_capture_source,
17884 [ALC662_3ST_6ch_DIG] = {
17885 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17886 .init_verbs = { alc662_init_verbs },
17887 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17888 .dac_nids = alc662_dac_nids,
17889 .dig_out_nid = ALC662_DIGOUT_NID,
17890 .dig_in_nid = ALC662_DIGIN_NID,
17891 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17892 .channel_mode = alc662_3ST_6ch_modes,
17894 .input_mux = &alc662_capture_source,
17896 [ALC662_3ST_6ch] = {
17897 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17898 .init_verbs = { alc662_init_verbs },
17899 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17900 .dac_nids = alc662_dac_nids,
17901 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17902 .channel_mode = alc662_3ST_6ch_modes,
17904 .input_mux = &alc662_capture_source,
17906 [ALC662_5ST_DIG] = {
17907 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17908 .init_verbs = { alc662_init_verbs },
17909 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17910 .dac_nids = alc662_dac_nids,
17911 .dig_out_nid = ALC662_DIGOUT_NID,
17912 .dig_in_nid = ALC662_DIGIN_NID,
17913 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17914 .channel_mode = alc662_5stack_modes,
17915 .input_mux = &alc662_capture_source,
17917 [ALC662_LENOVO_101E] = {
17918 .mixers = { alc662_lenovo_101e_mixer },
17919 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17920 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17921 .dac_nids = alc662_dac_nids,
17922 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17923 .channel_mode = alc662_3ST_2ch_modes,
17924 .input_mux = &alc662_lenovo_101e_capture_source,
17925 .unsol_event = alc662_lenovo_101e_unsol_event,
17926 .init_hook = alc662_lenovo_101e_all_automute,
17928 [ALC662_ASUS_EEEPC_P701] = {
17929 .mixers = { alc662_eeepc_p701_mixer },
17930 .init_verbs = { alc662_init_verbs,
17931 alc662_eeepc_sue_init_verbs },
17932 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17933 .dac_nids = alc662_dac_nids,
17934 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17935 .channel_mode = alc662_3ST_2ch_modes,
17936 .unsol_event = alc662_eeepc_unsol_event,
17937 .setup = alc662_eeepc_setup,
17938 .init_hook = alc662_eeepc_inithook,
17940 [ALC662_ASUS_EEEPC_EP20] = {
17941 .mixers = { alc662_eeepc_ep20_mixer,
17942 alc662_chmode_mixer },
17943 .init_verbs = { alc662_init_verbs,
17944 alc662_eeepc_ep20_sue_init_verbs },
17945 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17946 .dac_nids = alc662_dac_nids,
17947 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17948 .channel_mode = alc662_3ST_6ch_modes,
17949 .input_mux = &alc662_lenovo_101e_capture_source,
17950 .unsol_event = alc662_eeepc_unsol_event,
17951 .setup = alc662_eeepc_ep20_setup,
17952 .init_hook = alc662_eeepc_ep20_inithook,
17955 .mixers = { alc662_ecs_mixer },
17956 .init_verbs = { alc662_init_verbs,
17957 alc662_ecs_init_verbs },
17958 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17959 .dac_nids = alc662_dac_nids,
17960 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17961 .channel_mode = alc662_3ST_2ch_modes,
17962 .unsol_event = alc662_eeepc_unsol_event,
17963 .setup = alc662_eeepc_setup,
17964 .init_hook = alc662_eeepc_inithook,
17966 [ALC663_ASUS_M51VA] = {
17967 .mixers = { alc663_m51va_mixer },
17968 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17969 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17970 .dac_nids = alc662_dac_nids,
17971 .dig_out_nid = ALC662_DIGOUT_NID,
17972 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17973 .channel_mode = alc662_3ST_2ch_modes,
17974 .unsol_event = alc663_m51va_unsol_event,
17975 .setup = alc663_m51va_setup,
17976 .init_hook = alc663_m51va_inithook,
17978 [ALC663_ASUS_G71V] = {
17979 .mixers = { alc663_g71v_mixer },
17980 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17981 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17982 .dac_nids = alc662_dac_nids,
17983 .dig_out_nid = ALC662_DIGOUT_NID,
17984 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17985 .channel_mode = alc662_3ST_2ch_modes,
17986 .unsol_event = alc663_g71v_unsol_event,
17987 .setup = alc663_g71v_setup,
17988 .init_hook = alc663_g71v_inithook,
17990 [ALC663_ASUS_H13] = {
17991 .mixers = { alc663_m51va_mixer },
17992 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17993 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17994 .dac_nids = alc662_dac_nids,
17995 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17996 .channel_mode = alc662_3ST_2ch_modes,
17997 .unsol_event = alc663_m51va_unsol_event,
17998 .init_hook = alc663_m51va_inithook,
18000 [ALC663_ASUS_G50V] = {
18001 .mixers = { alc663_g50v_mixer },
18002 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18003 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18004 .dac_nids = alc662_dac_nids,
18005 .dig_out_nid = ALC662_DIGOUT_NID,
18006 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18007 .channel_mode = alc662_3ST_6ch_modes,
18008 .input_mux = &alc663_capture_source,
18009 .unsol_event = alc663_g50v_unsol_event,
18010 .setup = alc663_g50v_setup,
18011 .init_hook = alc663_g50v_inithook,
18013 [ALC663_ASUS_MODE1] = {
18014 .mixers = { alc663_m51va_mixer },
18015 .cap_mixer = alc662_auto_capture_mixer,
18016 .init_verbs = { alc662_init_verbs,
18017 alc663_21jd_amic_init_verbs },
18018 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18020 .dac_nids = alc662_dac_nids,
18021 .dig_out_nid = ALC662_DIGOUT_NID,
18022 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18023 .channel_mode = alc662_3ST_2ch_modes,
18024 .unsol_event = alc663_mode1_unsol_event,
18025 .setup = alc663_mode1_setup,
18026 .init_hook = alc663_mode1_inithook,
18028 [ALC662_ASUS_MODE2] = {
18029 .mixers = { alc662_1bjd_mixer },
18030 .cap_mixer = alc662_auto_capture_mixer,
18031 .init_verbs = { alc662_init_verbs,
18032 alc662_1bjd_amic_init_verbs },
18033 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18034 .dac_nids = alc662_dac_nids,
18035 .dig_out_nid = ALC662_DIGOUT_NID,
18036 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18037 .channel_mode = alc662_3ST_2ch_modes,
18038 .unsol_event = alc662_mode2_unsol_event,
18039 .setup = alc662_mode2_setup,
18040 .init_hook = alc662_mode2_inithook,
18042 [ALC663_ASUS_MODE3] = {
18043 .mixers = { alc663_two_hp_m1_mixer },
18044 .cap_mixer = alc662_auto_capture_mixer,
18045 .init_verbs = { alc662_init_verbs,
18046 alc663_two_hp_amic_m1_init_verbs },
18047 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18049 .dac_nids = alc662_dac_nids,
18050 .dig_out_nid = ALC662_DIGOUT_NID,
18051 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18052 .channel_mode = alc662_3ST_2ch_modes,
18053 .unsol_event = alc663_mode3_unsol_event,
18054 .setup = alc663_mode3_setup,
18055 .init_hook = alc663_mode3_inithook,
18057 [ALC663_ASUS_MODE4] = {
18058 .mixers = { alc663_asus_21jd_clfe_mixer },
18059 .cap_mixer = alc662_auto_capture_mixer,
18060 .init_verbs = { alc662_init_verbs,
18061 alc663_21jd_amic_init_verbs},
18062 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18064 .dac_nids = alc662_dac_nids,
18065 .dig_out_nid = ALC662_DIGOUT_NID,
18066 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18067 .channel_mode = alc662_3ST_2ch_modes,
18068 .unsol_event = alc663_mode4_unsol_event,
18069 .setup = alc663_mode4_setup,
18070 .init_hook = alc663_mode4_inithook,
18072 [ALC663_ASUS_MODE5] = {
18073 .mixers = { alc663_asus_15jd_clfe_mixer },
18074 .cap_mixer = alc662_auto_capture_mixer,
18075 .init_verbs = { alc662_init_verbs,
18076 alc663_15jd_amic_init_verbs },
18077 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18079 .dac_nids = alc662_dac_nids,
18080 .dig_out_nid = ALC662_DIGOUT_NID,
18081 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18082 .channel_mode = alc662_3ST_2ch_modes,
18083 .unsol_event = alc663_mode5_unsol_event,
18084 .setup = alc663_mode5_setup,
18085 .init_hook = alc663_mode5_inithook,
18087 [ALC663_ASUS_MODE6] = {
18088 .mixers = { alc663_two_hp_m2_mixer },
18089 .cap_mixer = alc662_auto_capture_mixer,
18090 .init_verbs = { alc662_init_verbs,
18091 alc663_two_hp_amic_m2_init_verbs },
18092 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18094 .dac_nids = alc662_dac_nids,
18095 .dig_out_nid = ALC662_DIGOUT_NID,
18096 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18097 .channel_mode = alc662_3ST_2ch_modes,
18098 .unsol_event = alc663_mode6_unsol_event,
18099 .setup = alc663_mode6_setup,
18100 .init_hook = alc663_mode6_inithook,
18102 [ALC663_ASUS_MODE7] = {
18103 .mixers = { alc663_mode7_mixer },
18104 .cap_mixer = alc662_auto_capture_mixer,
18105 .init_verbs = { alc662_init_verbs,
18106 alc663_mode7_init_verbs },
18107 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18109 .dac_nids = alc662_dac_nids,
18110 .dig_out_nid = ALC662_DIGOUT_NID,
18111 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18112 .channel_mode = alc662_3ST_2ch_modes,
18113 .unsol_event = alc663_mode7_unsol_event,
18114 .setup = alc663_mode7_setup,
18115 .init_hook = alc663_mode7_inithook,
18117 [ALC663_ASUS_MODE8] = {
18118 .mixers = { alc663_mode8_mixer },
18119 .cap_mixer = alc662_auto_capture_mixer,
18120 .init_verbs = { alc662_init_verbs,
18121 alc663_mode8_init_verbs },
18122 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18124 .dac_nids = alc662_dac_nids,
18125 .dig_out_nid = ALC662_DIGOUT_NID,
18126 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18127 .channel_mode = alc662_3ST_2ch_modes,
18128 .unsol_event = alc663_mode8_unsol_event,
18129 .setup = alc663_mode8_setup,
18130 .init_hook = alc663_mode8_inithook,
18133 .mixers = { alc663_m51va_mixer },
18134 .cap_mixer = alc272_auto_capture_mixer,
18135 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18136 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18137 .dac_nids = alc662_dac_nids,
18138 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18139 .adc_nids = alc272_adc_nids,
18140 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18141 .capsrc_nids = alc272_capsrc_nids,
18142 .channel_mode = alc662_3ST_2ch_modes,
18143 .unsol_event = alc663_m51va_unsol_event,
18144 .setup = alc663_m51va_setup,
18145 .init_hook = alc663_m51va_inithook,
18147 [ALC272_DELL_ZM1] = {
18148 .mixers = { alc663_m51va_mixer },
18149 .cap_mixer = alc662_auto_capture_mixer,
18150 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18151 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18152 .dac_nids = alc662_dac_nids,
18153 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18154 .adc_nids = alc662_adc_nids,
18156 .capsrc_nids = alc662_capsrc_nids,
18157 .channel_mode = alc662_3ST_2ch_modes,
18158 .unsol_event = alc663_m51va_unsol_event,
18159 .setup = alc663_m51va_setup,
18160 .init_hook = alc663_m51va_inithook,
18162 [ALC272_SAMSUNG_NC10] = {
18163 .mixers = { alc272_nc10_mixer },
18164 .init_verbs = { alc662_init_verbs,
18165 alc663_21jd_amic_init_verbs },
18166 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18167 .dac_nids = alc272_dac_nids,
18168 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18169 .channel_mode = alc662_3ST_2ch_modes,
18170 /*.input_mux = &alc272_nc10_capture_source,*/
18171 .unsol_event = alc663_mode4_unsol_event,
18172 .setup = alc663_mode4_setup,
18173 .init_hook = alc663_mode4_inithook,
18179 * BIOS auto configuration
18182 /* convert from MIX nid to DAC */
18183 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18187 else if (nid >= 0x0c && nid <= 0x0e)
18188 return nid - 0x0c + 0x02;
18193 /* get MIX nid connected to the given pin targeted to DAC */
18194 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18200 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18201 for (i = 0; i < num; i++) {
18202 if (alc662_mix_to_dac(mix[i]) == dac)
18208 /* look for an empty DAC slot */
18209 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18211 struct alc_spec *spec = codec->spec;
18215 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18218 for (i = 0; i < num; i++) {
18219 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18222 for (j = 0; j < spec->multiout.num_dacs; j++)
18223 if (spec->multiout.dac_nids[j] == nid)
18225 if (j >= spec->multiout.num_dacs)
18231 /* fill in the dac_nids table from the parsed pin configuration */
18232 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18233 const struct auto_pin_cfg *cfg)
18235 struct alc_spec *spec = codec->spec;
18239 spec->multiout.dac_nids = spec->private_dac_nids;
18240 for (i = 0; i < cfg->line_outs; i++) {
18241 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18244 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18249 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18250 hda_nid_t nid, unsigned int chs)
18252 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18253 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18256 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18257 hda_nid_t nid, unsigned int chs)
18259 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18260 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18263 #define alc662_add_stereo_vol(spec, pfx, nid) \
18264 alc662_add_vol_ctl(spec, pfx, nid, 3)
18265 #define alc662_add_stereo_sw(spec, pfx, nid) \
18266 alc662_add_sw_ctl(spec, pfx, nid, 3)
18268 /* add playback controls from the parsed DAC table */
18269 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18270 const struct auto_pin_cfg *cfg)
18272 struct alc_spec *spec = codec->spec;
18273 static const char *chname[4] = {
18274 "Front", "Surround", NULL /*CLFE*/, "Side"
18276 hda_nid_t nid, mix;
18279 for (i = 0; i < cfg->line_outs; i++) {
18280 nid = spec->multiout.dac_nids[i];
18283 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18288 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18291 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18294 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18297 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18302 if (cfg->line_outs == 1 &&
18303 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18310 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18313 if (cfg->line_outs == 1 &&
18314 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18316 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18324 /* add playback controls for speaker and HP outputs */
18325 /* return DAC nid if any new DAC is assigned */
18326 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18329 struct alc_spec *spec = codec->spec;
18330 hda_nid_t nid, mix;
18335 nid = alc662_look_for_dac(codec, pin);
18337 /* the corresponding DAC is already occupied */
18338 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18339 return 0; /* no way */
18340 /* create a switch only */
18341 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18342 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18345 mix = alc662_dac_to_mix(codec, pin, nid);
18348 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18351 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18357 /* create playback/capture controls for input pins */
18358 #define alc662_auto_create_input_ctls \
18359 alc882_auto_create_input_ctls
18361 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18362 hda_nid_t nid, int pin_type,
18368 alc_set_pin_output(codec, nid, pin_type);
18369 /* need the manual connection? */
18370 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18373 for (i = 0; i < num; i++) {
18374 if (alc662_mix_to_dac(srcs[i]) != dac)
18376 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18381 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18383 struct alc_spec *spec = codec->spec;
18384 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18387 for (i = 0; i <= HDA_SIDE; i++) {
18388 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18390 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18391 spec->multiout.dac_nids[i]);
18395 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18397 struct alc_spec *spec = codec->spec;
18400 pin = spec->autocfg.hp_pins[0];
18402 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18403 spec->multiout.hp_nid);
18404 pin = spec->autocfg.speaker_pins[0];
18406 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18407 spec->multiout.extra_out_nid[0]);
18410 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18412 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18414 struct alc_spec *spec = codec->spec;
18417 for (i = 0; i < AUTO_PIN_LAST; i++) {
18418 hda_nid_t nid = spec->autocfg.input_pins[i];
18419 if (alc_is_input_pin(codec, nid)) {
18420 alc_set_input_pin(codec, nid, i);
18421 if (nid != ALC662_PIN_CD_NID &&
18422 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18423 snd_hda_codec_write(codec, nid, 0,
18424 AC_VERB_SET_AMP_GAIN_MUTE,
18430 #define alc662_auto_init_input_src alc882_auto_init_input_src
18432 static int alc662_parse_auto_config(struct hda_codec *codec)
18434 struct alc_spec *spec = codec->spec;
18436 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18438 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18442 if (!spec->autocfg.line_outs)
18443 return 0; /* can't find valid BIOS pin config */
18445 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18448 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18451 err = alc662_auto_create_extra_out(codec,
18452 spec->autocfg.speaker_pins[0],
18457 spec->multiout.extra_out_nid[0] = err;
18458 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18463 spec->multiout.hp_nid = err;
18464 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18468 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18470 if (spec->autocfg.dig_outs)
18471 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18473 if (spec->kctls.list)
18474 add_mixer(spec, spec->kctls.list);
18476 spec->num_mux_defs = 1;
18477 spec->input_mux = &spec->private_imux[0];
18479 add_verb(spec, alc662_init_verbs);
18480 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18481 codec->vendor_id == 0x10ec0665)
18482 add_verb(spec, alc663_init_verbs);
18484 if (codec->vendor_id == 0x10ec0272)
18485 add_verb(spec, alc272_init_verbs);
18487 err = alc_auto_add_mic_boost(codec);
18491 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18492 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18493 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18495 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18500 /* additional initialization for auto-configuration model */
18501 static void alc662_auto_init(struct hda_codec *codec)
18503 struct alc_spec *spec = codec->spec;
18504 alc662_auto_init_multi_out(codec);
18505 alc662_auto_init_hp_out(codec);
18506 alc662_auto_init_analog_input(codec);
18507 alc662_auto_init_input_src(codec);
18508 if (spec->unsol_event)
18509 alc_inithook(codec);
18512 static int patch_alc662(struct hda_codec *codec)
18514 struct alc_spec *spec;
18515 int err, board_config;
18517 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18521 codec->spec = spec;
18523 alc_auto_parse_customize_define(codec);
18525 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18527 if (alc_read_coef_idx(codec, 0) == 0x8020)
18528 alc_codec_rename(codec, "ALC661");
18529 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18530 codec->bus->pci->subsystem_vendor == 0x1025 &&
18531 spec->cdefine.platform_type == 1)
18532 alc_codec_rename(codec, "ALC272X");
18534 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18537 if (board_config < 0) {
18538 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18540 board_config = ALC662_AUTO;
18543 if (board_config == ALC662_AUTO) {
18544 /* automatic parse from the BIOS config */
18545 err = alc662_parse_auto_config(codec);
18551 "hda_codec: Cannot set up configuration "
18552 "from BIOS. Using base mode...\n");
18553 board_config = ALC662_3ST_2ch_DIG;
18557 err = snd_hda_attach_beep_device(codec, 0x1);
18563 if (board_config != ALC662_AUTO)
18564 setup_preset(codec, &alc662_presets[board_config]);
18566 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18567 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18569 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18570 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18572 if (!spec->adc_nids) {
18573 spec->adc_nids = alc662_adc_nids;
18574 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18576 if (!spec->capsrc_nids)
18577 spec->capsrc_nids = alc662_capsrc_nids;
18579 if (!spec->cap_mixer)
18580 set_capture_mixer(codec);
18582 if (spec->cdefine.enable_pcbeep) {
18583 switch (codec->vendor_id) {
18585 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18590 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18593 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18597 spec->vmaster_nid = 0x02;
18599 codec->patch_ops = alc_patch_ops;
18600 if (board_config == ALC662_AUTO)
18601 spec->init_hook = alc662_auto_init;
18602 #ifdef CONFIG_SND_HDA_POWER_SAVE
18603 if (!spec->loopback.amplist)
18604 spec->loopback.amplist = alc662_loopbacks;
18610 static int patch_alc888(struct hda_codec *codec)
18612 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18613 kfree(codec->chip_name);
18614 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18615 if (!codec->chip_name) {
18619 return patch_alc662(codec);
18621 return patch_alc882(codec);
18627 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18628 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18629 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18630 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18631 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18632 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18633 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18634 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18635 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18636 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18637 .patch = patch_alc861 },
18638 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18639 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18640 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18641 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18642 .patch = patch_alc882 },
18643 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18644 .patch = patch_alc662 },
18645 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18646 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18647 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18648 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18649 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18650 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18651 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18652 .patch = patch_alc882 },
18653 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18654 .patch = patch_alc882 },
18655 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18656 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18657 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18658 .patch = patch_alc882 },
18659 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18660 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18661 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18662 {} /* terminator */
18665 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18667 MODULE_LICENSE("GPL");
18668 MODULE_DESCRIPTION("Realtek HD-audio codec");
18670 static struct hda_codec_preset_list realtek_list = {
18671 .preset = snd_hda_preset_realtek,
18672 .owner = THIS_MODULE,
18675 static int __init patch_realtek_init(void)
18677 return snd_hda_add_codec_preset(&realtek_list);
18680 static void __exit patch_realtek_exit(void)
18682 snd_hda_delete_codec_preset(&realtek_list);
18685 module_init(patch_realtek_init)
18686 module_exit(patch_realtek_exit)