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,
10196 /* set as output */
10197 struct alc_spec *spec = codec->spec;
10200 alc_set_pin_output(codec, nid, pin_type);
10201 if (dac_idx >= spec->multiout.num_dacs)
10203 if (spec->multiout.dac_nids[dac_idx] == 0x25)
10206 idx = spec->multiout.dac_nids[dac_idx] - 2;
10207 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,
10225 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10227 struct alc_spec *spec = codec->spec;
10230 pin = spec->autocfg.hp_pins[0];
10231 if (pin) /* connect to front */
10233 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10234 pin = spec->autocfg.speaker_pins[0];
10236 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10239 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10241 struct alc_spec *spec = codec->spec;
10244 for (i = 0; i < AUTO_PIN_LAST; i++) {
10245 hda_nid_t nid = spec->autocfg.input_pins[i];
10248 alc_set_input_pin(codec, nid, i);
10249 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10250 snd_hda_codec_write(codec, nid, 0,
10251 AC_VERB_SET_AMP_GAIN_MUTE,
10256 static void alc882_auto_init_input_src(struct hda_codec *codec)
10258 struct alc_spec *spec = codec->spec;
10261 for (c = 0; c < spec->num_adc_nids; c++) {
10262 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10263 hda_nid_t nid = spec->capsrc_nids[c];
10264 unsigned int mux_idx;
10265 const struct hda_input_mux *imux;
10266 int conns, mute, idx, item;
10268 conns = snd_hda_get_connections(codec, nid, conn_list,
10269 ARRAY_SIZE(conn_list));
10272 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10273 imux = &spec->input_mux[mux_idx];
10274 if (!imux->num_items && mux_idx > 0)
10275 imux = &spec->input_mux[0];
10276 for (idx = 0; idx < conns; idx++) {
10277 /* if the current connection is the selected one,
10278 * unmute it as default - otherwise mute it
10280 mute = AMP_IN_MUTE(idx);
10281 for (item = 0; item < imux->num_items; item++) {
10282 if (imux->items[item].index == idx) {
10283 if (spec->cur_mux[c] == item)
10284 mute = AMP_IN_UNMUTE(idx);
10288 /* check if we have a selector or mixer
10289 * we could check for the widget type instead, but
10290 * just check for Amp-In presence (in case of mixer
10291 * without amp-in there is something wrong, this
10292 * function shouldn't be used or capsrc nid is wrong)
10294 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10295 snd_hda_codec_write(codec, nid, 0,
10296 AC_VERB_SET_AMP_GAIN_MUTE,
10298 else if (mute != AMP_IN_MUTE(idx))
10299 snd_hda_codec_write(codec, nid, 0,
10300 AC_VERB_SET_CONNECT_SEL,
10306 /* add mic boosts if needed */
10307 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10309 struct alc_spec *spec = codec->spec;
10313 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10314 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10315 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10317 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10321 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10322 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10323 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10325 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10332 /* almost identical with ALC880 parser... */
10333 static int alc882_parse_auto_config(struct hda_codec *codec)
10335 struct alc_spec *spec = codec->spec;
10336 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10339 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10343 if (!spec->autocfg.line_outs)
10344 return 0; /* can't find valid BIOS pin config */
10346 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10349 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10352 err = alc880_auto_create_extra_out(spec,
10353 spec->autocfg.speaker_pins[0],
10357 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10361 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10365 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10367 /* check multiple SPDIF-out (for recent codecs) */
10368 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10370 err = snd_hda_get_connections(codec,
10371 spec->autocfg.dig_out_pins[i],
10376 spec->multiout.dig_out_nid = dig_nid;
10378 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10379 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10381 spec->slave_dig_outs[i - 1] = dig_nid;
10384 if (spec->autocfg.dig_in_pin)
10385 spec->dig_in_nid = ALC880_DIGIN_NID;
10387 if (spec->kctls.list)
10388 add_mixer(spec, spec->kctls.list);
10390 add_verb(spec, alc883_auto_init_verbs);
10391 /* if ADC 0x07 is available, initialize it, too */
10392 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10393 add_verb(spec, alc882_adc1_init_verbs);
10395 spec->num_mux_defs = 1;
10396 spec->input_mux = &spec->private_imux[0];
10398 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10400 err = alc_auto_add_mic_boost(codec);
10404 return 1; /* config found */
10407 /* additional initialization for auto-configuration model */
10408 static void alc882_auto_init(struct hda_codec *codec)
10410 struct alc_spec *spec = codec->spec;
10411 alc882_auto_init_multi_out(codec);
10412 alc882_auto_init_hp_out(codec);
10413 alc882_auto_init_analog_input(codec);
10414 alc882_auto_init_input_src(codec);
10415 if (spec->unsol_event)
10416 alc_inithook(codec);
10419 static int patch_alc882(struct hda_codec *codec)
10421 struct alc_spec *spec;
10422 int err, board_config;
10424 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10428 codec->spec = spec;
10430 alc_auto_parse_customize_define(codec);
10432 switch (codec->vendor_id) {
10437 /* ALC883 and variants */
10438 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10442 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10446 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10447 board_config = snd_hda_check_board_codec_sid_config(codec,
10448 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10450 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10451 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10453 board_config = ALC882_AUTO;
10456 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10458 if (board_config == ALC882_AUTO) {
10459 /* automatic parse from the BIOS config */
10460 err = alc882_parse_auto_config(codec);
10466 "hda_codec: Cannot set up configuration "
10467 "from BIOS. Using base mode...\n");
10468 board_config = ALC882_3ST_DIG;
10472 err = snd_hda_attach_beep_device(codec, 0x1);
10478 if (board_config != ALC882_AUTO)
10479 setup_preset(codec, &alc882_presets[board_config]);
10481 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10482 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10483 /* FIXME: setup DAC5 */
10484 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10485 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10487 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10488 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10490 if (codec->vendor_id == 0x10ec0888)
10491 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10493 if (!spec->adc_nids && spec->input_mux) {
10495 spec->num_adc_nids = 0;
10496 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10497 const struct hda_input_mux *imux = spec->input_mux;
10499 hda_nid_t items[16];
10500 hda_nid_t nid = alc882_adc_nids[i];
10501 unsigned int wcap = get_wcaps(codec, nid);
10503 wcap = get_wcaps_type(wcap);
10504 if (wcap != AC_WID_AUD_IN)
10506 spec->private_adc_nids[spec->num_adc_nids] = nid;
10507 err = snd_hda_get_connections(codec, nid, &cap, 1);
10510 err = snd_hda_get_connections(codec, cap, items,
10511 ARRAY_SIZE(items));
10514 for (j = 0; j < imux->num_items; j++)
10515 if (imux->items[j].index >= err)
10517 if (j < imux->num_items)
10519 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10520 spec->num_adc_nids++;
10522 spec->adc_nids = spec->private_adc_nids;
10523 spec->capsrc_nids = spec->private_capsrc_nids;
10526 set_capture_mixer(codec);
10528 if (spec->cdefine.enable_pcbeep)
10529 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10531 spec->vmaster_nid = 0x0c;
10533 codec->patch_ops = alc_patch_ops;
10534 if (board_config == ALC882_AUTO)
10535 spec->init_hook = alc882_auto_init;
10536 #ifdef CONFIG_SND_HDA_POWER_SAVE
10537 if (!spec->loopback.amplist)
10538 spec->loopback.amplist = alc882_loopbacks;
10549 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10550 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10552 #define alc262_dac_nids alc260_dac_nids
10553 #define alc262_adc_nids alc882_adc_nids
10554 #define alc262_adc_nids_alt alc882_adc_nids_alt
10555 #define alc262_capsrc_nids alc882_capsrc_nids
10556 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10558 #define alc262_modes alc260_modes
10559 #define alc262_capture_source alc882_capture_source
10561 static hda_nid_t alc262_dmic_adc_nids[1] = {
10566 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10568 static struct snd_kcontrol_new alc262_base_mixer[] = {
10569 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10570 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10571 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10572 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10573 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10574 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10577 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10578 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10579 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10580 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10581 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10582 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10583 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10584 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10588 /* update HP, line and mono-out pins according to the master switch */
10589 static void alc262_hp_master_update(struct hda_codec *codec)
10591 struct alc_spec *spec = codec->spec;
10592 int val = spec->master_sw;
10594 /* HP & line-out */
10595 snd_hda_codec_write_cache(codec, 0x1b, 0,
10596 AC_VERB_SET_PIN_WIDGET_CONTROL,
10598 snd_hda_codec_write_cache(codec, 0x15, 0,
10599 AC_VERB_SET_PIN_WIDGET_CONTROL,
10601 /* mono (speaker) depending on the HP jack sense */
10602 val = val && !spec->jack_present;
10603 snd_hda_codec_write_cache(codec, 0x16, 0,
10604 AC_VERB_SET_PIN_WIDGET_CONTROL,
10605 val ? PIN_OUT : 0);
10608 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10610 struct alc_spec *spec = codec->spec;
10612 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10613 alc262_hp_master_update(codec);
10616 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10618 if ((res >> 26) != ALC880_HP_EVENT)
10620 alc262_hp_bpc_automute(codec);
10623 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10625 struct alc_spec *spec = codec->spec;
10627 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10628 alc262_hp_master_update(codec);
10631 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10634 if ((res >> 26) != ALC880_HP_EVENT)
10636 alc262_hp_wildwest_automute(codec);
10639 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10641 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10642 struct snd_ctl_elem_value *ucontrol)
10644 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10645 struct alc_spec *spec = codec->spec;
10646 int val = !!*ucontrol->value.integer.value;
10648 if (val == spec->master_sw)
10650 spec->master_sw = val;
10651 alc262_hp_master_update(codec);
10655 #define ALC262_HP_MASTER_SWITCH \
10657 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10658 .name = "Master Playback Switch", \
10659 .info = snd_ctl_boolean_mono_info, \
10660 .get = alc262_hp_master_sw_get, \
10661 .put = alc262_hp_master_sw_put, \
10664 .iface = NID_MAPPING, \
10665 .name = "Master Playback Switch", \
10666 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10670 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10671 ALC262_HP_MASTER_SWITCH,
10672 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10673 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10674 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10675 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10677 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10681 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10682 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10683 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10684 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10685 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10686 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10687 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10688 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10689 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10690 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10694 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10695 ALC262_HP_MASTER_SWITCH,
10696 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10697 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10698 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10700 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10702 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10704 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10705 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10706 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10707 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10708 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10709 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10710 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10714 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10715 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10716 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10717 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10721 /* mute/unmute internal speaker according to the hp jack and mute state */
10722 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10724 struct alc_spec *spec = codec->spec;
10726 spec->autocfg.hp_pins[0] = 0x15;
10727 spec->autocfg.speaker_pins[0] = 0x14;
10730 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10731 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10732 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10733 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10734 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10737 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10741 static struct hda_verb alc262_hp_t5735_verbs[] = {
10742 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10745 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10749 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10750 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10751 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10752 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10753 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10754 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10755 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10759 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10760 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10761 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10762 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10763 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10765 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10767 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10768 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10773 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10780 /* bind hp and internal speaker mute (with plug check) as master switch */
10781 static void alc262_hippo_master_update(struct hda_codec *codec)
10783 struct alc_spec *spec = codec->spec;
10784 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10785 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10786 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10790 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10791 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10792 HDA_AMP_MUTE, mute);
10793 /* mute internal speaker per jack sense */
10794 if (spec->jack_present)
10795 mute = HDA_AMP_MUTE;
10797 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10798 HDA_AMP_MUTE, mute);
10799 if (speaker_nid && speaker_nid != line_nid)
10800 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10801 HDA_AMP_MUTE, mute);
10804 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10806 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10807 struct snd_ctl_elem_value *ucontrol)
10809 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10810 struct alc_spec *spec = codec->spec;
10811 int val = !!*ucontrol->value.integer.value;
10813 if (val == spec->master_sw)
10815 spec->master_sw = val;
10816 alc262_hippo_master_update(codec);
10820 #define ALC262_HIPPO_MASTER_SWITCH \
10822 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10823 .name = "Master Playback Switch", \
10824 .info = snd_ctl_boolean_mono_info, \
10825 .get = alc262_hippo_master_sw_get, \
10826 .put = alc262_hippo_master_sw_put, \
10829 .iface = NID_MAPPING, \
10830 .name = "Master Playback Switch", \
10831 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10832 (SUBDEV_SPEAKER(0) << 16), \
10835 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10836 ALC262_HIPPO_MASTER_SWITCH,
10837 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10838 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10839 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10840 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10841 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10844 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10845 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10846 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10847 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10848 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10852 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10853 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10854 ALC262_HIPPO_MASTER_SWITCH,
10855 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10856 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10857 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10858 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10861 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10862 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10863 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10864 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10868 /* mute/unmute internal speaker according to the hp jack and mute state */
10869 static void alc262_hippo_automute(struct hda_codec *codec)
10871 struct alc_spec *spec = codec->spec;
10872 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10874 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10875 alc262_hippo_master_update(codec);
10878 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10880 if ((res >> 26) != ALC880_HP_EVENT)
10882 alc262_hippo_automute(codec);
10885 static void alc262_hippo_setup(struct hda_codec *codec)
10887 struct alc_spec *spec = codec->spec;
10889 spec->autocfg.hp_pins[0] = 0x15;
10890 spec->autocfg.speaker_pins[0] = 0x14;
10893 static void alc262_hippo1_setup(struct hda_codec *codec)
10895 struct alc_spec *spec = codec->spec;
10897 spec->autocfg.hp_pins[0] = 0x1b;
10898 spec->autocfg.speaker_pins[0] = 0x14;
10902 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10903 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10904 ALC262_HIPPO_MASTER_SWITCH,
10905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10907 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10908 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10912 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10913 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10914 ALC262_HIPPO_MASTER_SWITCH,
10915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10917 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10918 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10919 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10923 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10924 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10925 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10926 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10927 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10928 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10929 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10931 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10932 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10933 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10934 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10935 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10939 static struct hda_verb alc262_tyan_verbs[] = {
10940 /* Headphone automute */
10941 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10942 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10943 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10945 /* P11 AUX_IN, white 4-pin connector */
10946 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10947 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10948 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10949 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10954 /* unsolicited event for HP jack sensing */
10955 static void alc262_tyan_setup(struct hda_codec *codec)
10957 struct alc_spec *spec = codec->spec;
10959 spec->autocfg.hp_pins[0] = 0x1b;
10960 spec->autocfg.speaker_pins[0] = 0x15;
10964 #define alc262_capture_mixer alc882_capture_mixer
10965 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10968 * generic initialization of ADC, input mixers and output mixers
10970 static struct hda_verb alc262_init_verbs[] = {
10972 * Unmute ADC0-2 and set the default input to mic-in
10974 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10975 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10976 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10977 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10978 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10979 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10981 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10983 * Note: PASD motherboards uses the Line In 2 as the input for
10984 * front panel mic (mic 2)
10986 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10990 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10991 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10994 * Set up output mixers (0x0c - 0x0e)
10996 /* set vol=0 to output mixers */
10997 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10998 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10999 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11000 /* set up input amps for analog loopback */
11001 /* Amp Indices: DAC = 0, mixer = 1 */
11002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11003 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11004 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11005 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11006 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11007 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11009 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11011 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11012 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11013 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11014 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11016 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11018 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11019 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11020 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11022 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11023 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11025 /* FIXME: use matrix-type input source selection */
11026 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11027 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11035 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11036 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11046 static struct hda_verb alc262_eapd_verbs[] = {
11047 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11048 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11052 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11053 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11054 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11055 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11057 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11058 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11062 static struct hda_verb alc262_sony_unsol_verbs[] = {
11063 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11064 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11065 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11067 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11068 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11072 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11073 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11074 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11075 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11076 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11077 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11081 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11082 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11083 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11084 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11085 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11086 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11087 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11088 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11089 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11093 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11095 struct alc_spec *spec = codec->spec;
11097 spec->autocfg.hp_pins[0] = 0x15;
11098 spec->autocfg.speaker_pins[0] = 0x14;
11099 spec->ext_mic.pin = 0x18;
11100 spec->ext_mic.mux_idx = 0;
11101 spec->int_mic.pin = 0x12;
11102 spec->int_mic.mux_idx = 9;
11103 spec->auto_mic = 1;
11109 * 0x16 = internal speaker
11110 * 0x18 = external mic
11113 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11114 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11115 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11118 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11121 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11122 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11126 static struct hda_verb alc262_nec_verbs[] = {
11127 /* Unmute Speaker */
11128 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11131 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11134 /* External mic to headphone */
11135 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11136 /* External mic to speaker */
11137 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11143 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11144 * 0x1b = port replicator headphone out
11147 #define ALC_HP_EVENT 0x37
11149 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11150 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11151 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11152 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11153 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11157 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11158 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11159 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11163 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11164 /* Front Mic pin: input vref at 50% */
11165 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11166 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11170 static struct hda_input_mux alc262_fujitsu_capture_source = {
11174 { "Int Mic", 0x1 },
11179 static struct hda_input_mux alc262_HP_capture_source = {
11183 { "Front Mic", 0x1 },
11190 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11194 { "Front Mic", 0x2 },
11200 /* mute/unmute internal speaker according to the hp jacks and mute state */
11201 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11203 struct alc_spec *spec = codec->spec;
11206 if (force || !spec->sense_updated) {
11207 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11208 snd_hda_jack_detect(codec, 0x1b);
11209 spec->sense_updated = 1;
11211 /* unmute internal speaker only if both HPs are unplugged and
11212 * master switch is on
11214 if (spec->jack_present)
11215 mute = HDA_AMP_MUTE;
11217 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11218 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11219 HDA_AMP_MUTE, mute);
11222 /* unsolicited event for HP jack sensing */
11223 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11226 if ((res >> 26) != ALC_HP_EVENT)
11228 alc262_fujitsu_automute(codec, 1);
11231 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11233 alc262_fujitsu_automute(codec, 1);
11236 /* bind volumes of both NID 0x0c and 0x0d */
11237 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11238 .ops = &snd_hda_bind_vol,
11240 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11241 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11246 /* mute/unmute internal speaker according to the hp jack and mute state */
11247 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11249 struct alc_spec *spec = codec->spec;
11252 if (force || !spec->sense_updated) {
11253 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11254 spec->sense_updated = 1;
11256 if (spec->jack_present) {
11257 /* mute internal speaker */
11258 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11259 HDA_AMP_MUTE, HDA_AMP_MUTE);
11260 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11261 HDA_AMP_MUTE, HDA_AMP_MUTE);
11263 /* unmute internal speaker if necessary */
11264 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11265 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11266 HDA_AMP_MUTE, mute);
11267 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11268 HDA_AMP_MUTE, mute);
11272 /* unsolicited event for HP jack sensing */
11273 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11276 if ((res >> 26) != ALC_HP_EVENT)
11278 alc262_lenovo_3000_automute(codec, 1);
11281 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11282 int dir, int idx, long *valp)
11286 for (i = 0; i < 2; i++, valp++)
11287 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11289 *valp ? 0 : HDA_AMP_MUTE);
11293 /* bind hp and internal speaker mute (with plug check) */
11294 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11295 struct snd_ctl_elem_value *ucontrol)
11297 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11298 long *valp = ucontrol->value.integer.value;
11301 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11302 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11304 alc262_fujitsu_automute(codec, 0);
11308 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11309 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11311 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11312 .name = "Master Playback Switch",
11313 .subdevice = HDA_SUBDEV_AMP_FLAG,
11314 .info = snd_hda_mixer_amp_switch_info,
11315 .get = snd_hda_mixer_amp_switch_get,
11316 .put = alc262_fujitsu_master_sw_put,
11317 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11320 .iface = NID_MAPPING,
11321 .name = "Master Playback Switch",
11322 .private_value = 0x1b,
11324 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11325 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11326 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11329 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11330 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11331 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11335 /* bind hp and internal speaker mute (with plug check) */
11336 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11337 struct snd_ctl_elem_value *ucontrol)
11339 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11340 long *valp = ucontrol->value.integer.value;
11343 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11345 alc262_lenovo_3000_automute(codec, 0);
11349 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11350 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11352 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11353 .name = "Master Playback Switch",
11354 .subdevice = HDA_SUBDEV_AMP_FLAG,
11355 .info = snd_hda_mixer_amp_switch_info,
11356 .get = snd_hda_mixer_amp_switch_get,
11357 .put = alc262_lenovo_3000_master_sw_put,
11358 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11360 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11361 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11362 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11363 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11365 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11366 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11367 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11371 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11372 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11373 ALC262_HIPPO_MASTER_SWITCH,
11374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11376 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11377 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11378 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11379 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11383 /* additional init verbs for Benq laptops */
11384 static struct hda_verb alc262_EAPD_verbs[] = {
11385 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11386 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11390 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11392 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11394 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11395 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11399 /* Samsung Q1 Ultra Vista model setup */
11400 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11401 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11402 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11403 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11404 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11405 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11406 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11410 static struct hda_verb alc262_ultra_verbs[] = {
11412 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11413 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11414 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11416 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11417 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11418 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11419 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11421 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11423 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11424 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11425 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11427 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11428 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11429 /* ADC, choose mic */
11430 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11431 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11432 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11434 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11443 /* mute/unmute internal speaker according to the hp jack and mute state */
11444 static void alc262_ultra_automute(struct hda_codec *codec)
11446 struct alc_spec *spec = codec->spec;
11450 /* auto-mute only when HP is used as HP */
11451 if (!spec->cur_mux[0]) {
11452 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11453 if (spec->jack_present)
11454 mute = HDA_AMP_MUTE;
11456 /* mute/unmute internal speaker */
11457 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11458 HDA_AMP_MUTE, mute);
11459 /* mute/unmute HP */
11460 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11461 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11464 /* unsolicited event for HP jack sensing */
11465 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11468 if ((res >> 26) != ALC880_HP_EVENT)
11470 alc262_ultra_automute(codec);
11473 static struct hda_input_mux alc262_ultra_capture_source = {
11477 { "Headphone", 0x7 },
11481 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11482 struct snd_ctl_elem_value *ucontrol)
11484 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11485 struct alc_spec *spec = codec->spec;
11488 ret = alc_mux_enum_put(kcontrol, ucontrol);
11491 /* reprogram the HP pin as mic or HP according to the input source */
11492 snd_hda_codec_write_cache(codec, 0x15, 0,
11493 AC_VERB_SET_PIN_WIDGET_CONTROL,
11494 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11495 alc262_ultra_automute(codec); /* mute/unmute HP */
11499 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11500 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11501 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11503 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11504 .name = "Capture Source",
11505 .info = alc_mux_enum_info,
11506 .get = alc_mux_enum_get,
11507 .put = alc262_ultra_mux_enum_put,
11510 .iface = NID_MAPPING,
11511 .name = "Capture Source",
11512 .private_value = 0x15,
11517 /* We use two mixers depending on the output pin; 0x16 is a mono output
11518 * and thus it's bound with a different mixer.
11519 * This function returns which mixer amp should be used.
11521 static int alc262_check_volbit(hda_nid_t nid)
11525 else if (nid == 0x16)
11531 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11532 const char *pfx, int *vbits)
11537 vbit = alc262_check_volbit(nid);
11540 if (*vbits & vbit) /* a volume control for this mixer already there */
11544 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11546 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11547 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11550 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11558 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11560 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11561 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11564 /* add playback controls from the parsed DAC table */
11565 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11566 const struct auto_pin_cfg *cfg)
11572 spec->multiout.num_dacs = 1; /* only use one dac */
11573 spec->multiout.dac_nids = spec->private_dac_nids;
11574 spec->multiout.dac_nids[0] = 2;
11576 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11578 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11582 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11585 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11588 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11592 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11593 alc262_check_volbit(cfg->speaker_pins[0]) |
11594 alc262_check_volbit(cfg->hp_pins[0]);
11595 if (vbits == 1 || vbits == 2)
11596 pfx = "Master"; /* only one mixer is used */
11597 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11602 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11605 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11609 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11616 #define alc262_auto_create_input_ctls \
11617 alc882_auto_create_input_ctls
11620 * generic initialization of ADC, input mixers and output mixers
11622 static struct hda_verb alc262_volume_init_verbs[] = {
11624 * Unmute ADC0-2 and set the default input to mic-in
11626 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11627 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11628 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11629 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11630 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11633 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11635 * Note: PASD motherboards uses the Line In 2 as the input for
11636 * front panel mic (mic 2)
11638 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11646 * Set up output mixers (0x0c - 0x0f)
11648 /* set vol=0 to output mixers */
11649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11650 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11651 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11653 /* set up input amps for analog loopback */
11654 /* Amp Indices: DAC = 0, mixer = 1 */
11655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11659 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11660 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11662 /* FIXME: use matrix-type input source selection */
11663 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11664 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11667 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11668 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11671 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11672 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11673 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11676 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11678 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11683 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11685 * Unmute ADC0-2 and set the default input to mic-in
11687 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11689 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11690 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11691 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11692 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11694 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11696 * Note: PASD motherboards uses the Line In 2 as the input for
11697 * front panel mic (mic 2)
11699 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11701 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11705 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11706 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11709 * Set up output mixers (0x0c - 0x0e)
11711 /* set vol=0 to output mixers */
11712 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11713 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11716 /* set up input amps for analog loopback */
11717 /* Amp Indices: DAC = 0, mixer = 1 */
11718 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11719 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11720 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11721 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11722 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11723 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11725 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11726 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11727 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11729 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11732 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11733 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11736 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11737 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11738 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11739 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11741 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11742 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11745 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11746 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11749 /* FIXME: use matrix-type input source selection */
11750 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11751 /* Input mixer1: only unmute Mic */
11752 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11753 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11754 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11755 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11756 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11757 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11758 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11762 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11763 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11764 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11768 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11782 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11787 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11789 * Unmute ADC0-2 and set the default input to mic-in
11791 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11792 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11793 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11794 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11795 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11796 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11798 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11800 * Note: PASD motherboards uses the Line In 2 as the input for front
11801 * panel mic (mic 2)
11803 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11804 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11805 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11806 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11807 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11808 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11809 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11810 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11811 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11813 * Set up output mixers (0x0c - 0x0e)
11815 /* set vol=0 to output mixers */
11816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11817 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11818 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11820 /* set up input amps for analog loopback */
11821 /* Amp Indices: DAC = 0, mixer = 1 */
11822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11825 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11826 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11827 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11830 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11831 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11832 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11833 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11834 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11835 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11836 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11838 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11841 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11844 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11845 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11846 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11847 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11848 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11849 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11851 /* FIXME: use matrix-type input source selection */
11852 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11853 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11854 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11855 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11859 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11865 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11867 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11868 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11874 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11875 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11878 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11883 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11886 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11887 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11889 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11890 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11891 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11892 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11894 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11895 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11896 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11901 #ifdef CONFIG_SND_HDA_POWER_SAVE
11902 #define alc262_loopbacks alc880_loopbacks
11905 /* pcm configuration: identical with ALC880 */
11906 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11907 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11908 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11909 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11912 * BIOS auto configuration
11914 static int alc262_parse_auto_config(struct hda_codec *codec)
11916 struct alc_spec *spec = codec->spec;
11918 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11920 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11924 if (!spec->autocfg.line_outs) {
11925 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11926 spec->multiout.max_channels = 2;
11927 spec->no_analog = 1;
11930 return 0; /* can't find valid BIOS pin config */
11932 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11935 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11939 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11942 if (spec->autocfg.dig_outs) {
11943 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11944 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11946 if (spec->autocfg.dig_in_pin)
11947 spec->dig_in_nid = ALC262_DIGIN_NID;
11949 if (spec->kctls.list)
11950 add_mixer(spec, spec->kctls.list);
11952 add_verb(spec, alc262_volume_init_verbs);
11953 spec->num_mux_defs = 1;
11954 spec->input_mux = &spec->private_imux[0];
11956 err = alc_auto_add_mic_boost(codec);
11960 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11965 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11966 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11967 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11968 #define alc262_auto_init_input_src alc882_auto_init_input_src
11971 /* init callback for auto-configuration model -- overriding the default init */
11972 static void alc262_auto_init(struct hda_codec *codec)
11974 struct alc_spec *spec = codec->spec;
11975 alc262_auto_init_multi_out(codec);
11976 alc262_auto_init_hp_out(codec);
11977 alc262_auto_init_analog_input(codec);
11978 alc262_auto_init_input_src(codec);
11979 if (spec->unsol_event)
11980 alc_inithook(codec);
11984 * configuration and preset
11986 static const char *alc262_models[ALC262_MODEL_LAST] = {
11987 [ALC262_BASIC] = "basic",
11988 [ALC262_HIPPO] = "hippo",
11989 [ALC262_HIPPO_1] = "hippo_1",
11990 [ALC262_FUJITSU] = "fujitsu",
11991 [ALC262_HP_BPC] = "hp-bpc",
11992 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11993 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11994 [ALC262_HP_RP5700] = "hp-rp5700",
11995 [ALC262_BENQ_ED8] = "benq",
11996 [ALC262_BENQ_T31] = "benq-t31",
11997 [ALC262_SONY_ASSAMD] = "sony-assamd",
11998 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11999 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12000 [ALC262_ULTRA] = "ultra",
12001 [ALC262_LENOVO_3000] = "lenovo-3000",
12002 [ALC262_NEC] = "nec",
12003 [ALC262_TYAN] = "tyan",
12004 [ALC262_AUTO] = "auto",
12007 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12008 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12009 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12010 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12012 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12014 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12016 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12017 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12018 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12019 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12020 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12021 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12022 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12023 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12024 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12025 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12026 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12027 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12028 ALC262_HP_TC_T5735),
12029 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12030 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12031 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12032 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12033 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12034 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12035 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12036 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12037 #if 0 /* disable the quirk since model=auto works better in recent versions */
12038 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12039 ALC262_SONY_ASSAMD),
12041 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12042 ALC262_TOSHIBA_RX1),
12043 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12044 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12045 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12046 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12047 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12049 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12050 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12051 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12052 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12053 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12057 static struct alc_config_preset alc262_presets[] = {
12059 .mixers = { alc262_base_mixer },
12060 .init_verbs = { alc262_init_verbs },
12061 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12062 .dac_nids = alc262_dac_nids,
12064 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12065 .channel_mode = alc262_modes,
12066 .input_mux = &alc262_capture_source,
12069 .mixers = { alc262_hippo_mixer },
12070 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12071 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12072 .dac_nids = alc262_dac_nids,
12074 .dig_out_nid = ALC262_DIGOUT_NID,
12075 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12076 .channel_mode = alc262_modes,
12077 .input_mux = &alc262_capture_source,
12078 .unsol_event = alc262_hippo_unsol_event,
12079 .setup = alc262_hippo_setup,
12080 .init_hook = alc262_hippo_automute,
12082 [ALC262_HIPPO_1] = {
12083 .mixers = { alc262_hippo1_mixer },
12084 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12085 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12086 .dac_nids = alc262_dac_nids,
12088 .dig_out_nid = ALC262_DIGOUT_NID,
12089 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12090 .channel_mode = alc262_modes,
12091 .input_mux = &alc262_capture_source,
12092 .unsol_event = alc262_hippo_unsol_event,
12093 .setup = alc262_hippo1_setup,
12094 .init_hook = alc262_hippo_automute,
12096 [ALC262_FUJITSU] = {
12097 .mixers = { alc262_fujitsu_mixer },
12098 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12099 alc262_fujitsu_unsol_verbs },
12100 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12101 .dac_nids = alc262_dac_nids,
12103 .dig_out_nid = ALC262_DIGOUT_NID,
12104 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12105 .channel_mode = alc262_modes,
12106 .input_mux = &alc262_fujitsu_capture_source,
12107 .unsol_event = alc262_fujitsu_unsol_event,
12108 .init_hook = alc262_fujitsu_init_hook,
12110 [ALC262_HP_BPC] = {
12111 .mixers = { alc262_HP_BPC_mixer },
12112 .init_verbs = { alc262_HP_BPC_init_verbs },
12113 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12114 .dac_nids = alc262_dac_nids,
12116 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12117 .channel_mode = alc262_modes,
12118 .input_mux = &alc262_HP_capture_source,
12119 .unsol_event = alc262_hp_bpc_unsol_event,
12120 .init_hook = alc262_hp_bpc_automute,
12122 [ALC262_HP_BPC_D7000_WF] = {
12123 .mixers = { alc262_HP_BPC_WildWest_mixer },
12124 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12125 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12126 .dac_nids = alc262_dac_nids,
12128 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12129 .channel_mode = alc262_modes,
12130 .input_mux = &alc262_HP_D7000_capture_source,
12131 .unsol_event = alc262_hp_wildwest_unsol_event,
12132 .init_hook = alc262_hp_wildwest_automute,
12134 [ALC262_HP_BPC_D7000_WL] = {
12135 .mixers = { alc262_HP_BPC_WildWest_mixer,
12136 alc262_HP_BPC_WildWest_option_mixer },
12137 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12138 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12139 .dac_nids = alc262_dac_nids,
12141 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12142 .channel_mode = alc262_modes,
12143 .input_mux = &alc262_HP_D7000_capture_source,
12144 .unsol_event = alc262_hp_wildwest_unsol_event,
12145 .init_hook = alc262_hp_wildwest_automute,
12147 [ALC262_HP_TC_T5735] = {
12148 .mixers = { alc262_hp_t5735_mixer },
12149 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12150 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12151 .dac_nids = alc262_dac_nids,
12153 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12154 .channel_mode = alc262_modes,
12155 .input_mux = &alc262_capture_source,
12156 .unsol_event = alc_sku_unsol_event,
12157 .setup = alc262_hp_t5735_setup,
12158 .init_hook = alc_inithook,
12160 [ALC262_HP_RP5700] = {
12161 .mixers = { alc262_hp_rp5700_mixer },
12162 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12163 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12164 .dac_nids = alc262_dac_nids,
12165 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12166 .channel_mode = alc262_modes,
12167 .input_mux = &alc262_hp_rp5700_capture_source,
12169 [ALC262_BENQ_ED8] = {
12170 .mixers = { alc262_base_mixer },
12171 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12172 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12173 .dac_nids = alc262_dac_nids,
12175 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12176 .channel_mode = alc262_modes,
12177 .input_mux = &alc262_capture_source,
12179 [ALC262_SONY_ASSAMD] = {
12180 .mixers = { alc262_sony_mixer },
12181 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12182 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12183 .dac_nids = alc262_dac_nids,
12185 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12186 .channel_mode = alc262_modes,
12187 .input_mux = &alc262_capture_source,
12188 .unsol_event = alc262_hippo_unsol_event,
12189 .setup = alc262_hippo_setup,
12190 .init_hook = alc262_hippo_automute,
12192 [ALC262_BENQ_T31] = {
12193 .mixers = { alc262_benq_t31_mixer },
12194 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12195 alc_hp15_unsol_verbs },
12196 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12197 .dac_nids = alc262_dac_nids,
12199 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12200 .channel_mode = alc262_modes,
12201 .input_mux = &alc262_capture_source,
12202 .unsol_event = alc262_hippo_unsol_event,
12203 .setup = alc262_hippo_setup,
12204 .init_hook = alc262_hippo_automute,
12207 .mixers = { alc262_ultra_mixer },
12208 .cap_mixer = alc262_ultra_capture_mixer,
12209 .init_verbs = { alc262_ultra_verbs },
12210 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12211 .dac_nids = alc262_dac_nids,
12212 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12213 .channel_mode = alc262_modes,
12214 .input_mux = &alc262_ultra_capture_source,
12215 .adc_nids = alc262_adc_nids, /* ADC0 */
12216 .capsrc_nids = alc262_capsrc_nids,
12217 .num_adc_nids = 1, /* single ADC */
12218 .unsol_event = alc262_ultra_unsol_event,
12219 .init_hook = alc262_ultra_automute,
12221 [ALC262_LENOVO_3000] = {
12222 .mixers = { alc262_lenovo_3000_mixer },
12223 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12224 alc262_lenovo_3000_unsol_verbs,
12225 alc262_lenovo_3000_init_verbs },
12226 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12227 .dac_nids = alc262_dac_nids,
12229 .dig_out_nid = ALC262_DIGOUT_NID,
12230 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12231 .channel_mode = alc262_modes,
12232 .input_mux = &alc262_fujitsu_capture_source,
12233 .unsol_event = alc262_lenovo_3000_unsol_event,
12236 .mixers = { alc262_nec_mixer },
12237 .init_verbs = { alc262_nec_verbs },
12238 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12239 .dac_nids = alc262_dac_nids,
12241 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12242 .channel_mode = alc262_modes,
12243 .input_mux = &alc262_capture_source,
12245 [ALC262_TOSHIBA_S06] = {
12246 .mixers = { alc262_toshiba_s06_mixer },
12247 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12248 alc262_eapd_verbs },
12249 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12250 .capsrc_nids = alc262_dmic_capsrc_nids,
12251 .dac_nids = alc262_dac_nids,
12252 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12253 .num_adc_nids = 1, /* single ADC */
12254 .dig_out_nid = ALC262_DIGOUT_NID,
12255 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12256 .channel_mode = alc262_modes,
12257 .unsol_event = alc_sku_unsol_event,
12258 .setup = alc262_toshiba_s06_setup,
12259 .init_hook = alc_inithook,
12261 [ALC262_TOSHIBA_RX1] = {
12262 .mixers = { alc262_toshiba_rx1_mixer },
12263 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12264 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12265 .dac_nids = alc262_dac_nids,
12267 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12268 .channel_mode = alc262_modes,
12269 .input_mux = &alc262_capture_source,
12270 .unsol_event = alc262_hippo_unsol_event,
12271 .setup = alc262_hippo_setup,
12272 .init_hook = alc262_hippo_automute,
12275 .mixers = { alc262_tyan_mixer },
12276 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12277 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12278 .dac_nids = alc262_dac_nids,
12280 .dig_out_nid = ALC262_DIGOUT_NID,
12281 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12282 .channel_mode = alc262_modes,
12283 .input_mux = &alc262_capture_source,
12284 .unsol_event = alc_automute_amp_unsol_event,
12285 .setup = alc262_tyan_setup,
12286 .init_hook = alc_automute_amp,
12290 static int patch_alc262(struct hda_codec *codec)
12292 struct alc_spec *spec;
12296 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12300 codec->spec = spec;
12302 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12307 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12308 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12309 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12310 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12313 alc_auto_parse_customize_define(codec);
12315 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12317 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12321 if (board_config < 0) {
12322 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12324 board_config = ALC262_AUTO;
12327 if (board_config == ALC262_AUTO) {
12328 /* automatic parse from the BIOS config */
12329 err = alc262_parse_auto_config(codec);
12335 "hda_codec: Cannot set up configuration "
12336 "from BIOS. Using base mode...\n");
12337 board_config = ALC262_BASIC;
12341 if (!spec->no_analog) {
12342 err = snd_hda_attach_beep_device(codec, 0x1);
12349 if (board_config != ALC262_AUTO)
12350 setup_preset(codec, &alc262_presets[board_config]);
12352 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12353 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12355 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12356 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12358 if (!spec->adc_nids && spec->input_mux) {
12360 /* check whether the digital-mic has to be supported */
12361 for (i = 0; i < spec->input_mux->num_items; i++) {
12362 if (spec->input_mux->items[i].index >= 9)
12365 if (i < spec->input_mux->num_items) {
12366 /* use only ADC0 */
12367 spec->adc_nids = alc262_dmic_adc_nids;
12368 spec->num_adc_nids = 1;
12369 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12371 /* all analog inputs */
12372 /* check whether NID 0x07 is valid */
12373 unsigned int wcap = get_wcaps(codec, 0x07);
12376 wcap = get_wcaps_type(wcap);
12377 if (wcap != AC_WID_AUD_IN) {
12378 spec->adc_nids = alc262_adc_nids_alt;
12379 spec->num_adc_nids =
12380 ARRAY_SIZE(alc262_adc_nids_alt);
12381 spec->capsrc_nids = alc262_capsrc_nids_alt;
12383 spec->adc_nids = alc262_adc_nids;
12384 spec->num_adc_nids =
12385 ARRAY_SIZE(alc262_adc_nids);
12386 spec->capsrc_nids = alc262_capsrc_nids;
12390 if (!spec->cap_mixer && !spec->no_analog)
12391 set_capture_mixer(codec);
12392 if (!spec->no_analog && spec->cdefine.enable_pcbeep)
12393 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12395 spec->vmaster_nid = 0x0c;
12397 codec->patch_ops = alc_patch_ops;
12398 if (board_config == ALC262_AUTO)
12399 spec->init_hook = alc262_auto_init;
12400 #ifdef CONFIG_SND_HDA_POWER_SAVE
12401 if (!spec->loopback.amplist)
12402 spec->loopback.amplist = alc262_loopbacks;
12409 * ALC268 channel source setting (2 channel)
12411 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12412 #define alc268_modes alc260_modes
12414 static hda_nid_t alc268_dac_nids[2] = {
12419 static hda_nid_t alc268_adc_nids[2] = {
12424 static hda_nid_t alc268_adc_nids_alt[1] = {
12429 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12431 static struct snd_kcontrol_new alc268_base_mixer[] = {
12432 /* output mixer control */
12433 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12434 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12435 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12436 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12437 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12438 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12439 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12443 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12444 /* output mixer control */
12445 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12446 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12447 ALC262_HIPPO_MASTER_SWITCH,
12448 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12449 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12450 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12454 /* bind Beep switches of both NID 0x0f and 0x10 */
12455 static struct hda_bind_ctls alc268_bind_beep_sw = {
12456 .ops = &snd_hda_bind_sw,
12458 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12459 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12464 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12465 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12466 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12470 static struct hda_verb alc268_eapd_verbs[] = {
12471 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12472 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12476 /* Toshiba specific */
12477 static struct hda_verb alc268_toshiba_verbs[] = {
12478 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12482 /* Acer specific */
12483 /* bind volumes of both NID 0x02 and 0x03 */
12484 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12485 .ops = &snd_hda_bind_vol,
12487 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12488 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12493 /* mute/unmute internal speaker according to the hp jack and mute state */
12494 static void alc268_acer_automute(struct hda_codec *codec, int force)
12496 struct alc_spec *spec = codec->spec;
12499 if (force || !spec->sense_updated) {
12500 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12501 spec->sense_updated = 1;
12503 if (spec->jack_present)
12504 mute = HDA_AMP_MUTE; /* mute internal speaker */
12505 else /* unmute internal speaker if necessary */
12506 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12507 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12508 HDA_AMP_MUTE, mute);
12512 /* bind hp and internal speaker mute (with plug check) */
12513 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12514 struct snd_ctl_elem_value *ucontrol)
12516 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12517 long *valp = ucontrol->value.integer.value;
12520 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12522 alc268_acer_automute(codec, 0);
12526 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12527 /* output mixer control */
12528 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12530 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12531 .name = "Master Playback Switch",
12532 .subdevice = HDA_SUBDEV_AMP_FLAG,
12533 .info = snd_hda_mixer_amp_switch_info,
12534 .get = snd_hda_mixer_amp_switch_get,
12535 .put = alc268_acer_master_sw_put,
12536 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12538 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12542 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12543 /* output mixer control */
12544 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12546 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12547 .name = "Master Playback Switch",
12548 .subdevice = HDA_SUBDEV_AMP_FLAG,
12549 .info = snd_hda_mixer_amp_switch_info,
12550 .get = snd_hda_mixer_amp_switch_get,
12551 .put = alc268_acer_master_sw_put,
12552 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12554 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12555 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12556 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12560 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12561 /* output mixer control */
12562 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12564 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12565 .name = "Master Playback Switch",
12566 .subdevice = HDA_SUBDEV_AMP_FLAG,
12567 .info = snd_hda_mixer_amp_switch_info,
12568 .get = snd_hda_mixer_amp_switch_get,
12569 .put = alc268_acer_master_sw_put,
12570 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12572 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12573 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12577 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12578 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12579 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12580 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12581 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12582 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12583 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12587 static struct hda_verb alc268_acer_verbs[] = {
12588 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12589 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12590 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12591 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12592 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12593 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12594 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12598 /* unsolicited event for HP jack sensing */
12599 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12600 #define alc268_toshiba_setup alc262_hippo_setup
12601 #define alc268_toshiba_automute alc262_hippo_automute
12603 static void alc268_acer_unsol_event(struct hda_codec *codec,
12606 if ((res >> 26) != ALC880_HP_EVENT)
12608 alc268_acer_automute(codec, 1);
12611 static void alc268_acer_init_hook(struct hda_codec *codec)
12613 alc268_acer_automute(codec, 1);
12616 /* toggle speaker-output according to the hp-jack state */
12617 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12619 unsigned int present;
12620 unsigned char bits;
12622 present = snd_hda_jack_detect(codec, 0x15);
12623 bits = present ? HDA_AMP_MUTE : 0;
12624 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12625 HDA_AMP_MUTE, bits);
12626 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12627 HDA_AMP_MUTE, bits);
12630 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12633 switch (res >> 26) {
12634 case ALC880_HP_EVENT:
12635 alc268_aspire_one_speaker_automute(codec);
12637 case ALC880_MIC_EVENT:
12638 alc_mic_automute(codec);
12643 static void alc268_acer_lc_setup(struct hda_codec *codec)
12645 struct alc_spec *spec = codec->spec;
12646 spec->ext_mic.pin = 0x18;
12647 spec->ext_mic.mux_idx = 0;
12648 spec->int_mic.pin = 0x12;
12649 spec->int_mic.mux_idx = 6;
12650 spec->auto_mic = 1;
12653 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12655 alc268_aspire_one_speaker_automute(codec);
12656 alc_mic_automute(codec);
12659 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12660 /* output mixer control */
12661 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12662 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12663 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12665 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12666 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12670 static struct hda_verb alc268_dell_verbs[] = {
12671 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12672 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12673 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12674 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12678 /* mute/unmute internal speaker according to the hp jack and mute state */
12679 static void alc268_dell_setup(struct hda_codec *codec)
12681 struct alc_spec *spec = codec->spec;
12683 spec->autocfg.hp_pins[0] = 0x15;
12684 spec->autocfg.speaker_pins[0] = 0x14;
12685 spec->ext_mic.pin = 0x18;
12686 spec->ext_mic.mux_idx = 0;
12687 spec->int_mic.pin = 0x19;
12688 spec->int_mic.mux_idx = 1;
12689 spec->auto_mic = 1;
12692 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12693 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12694 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12695 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12696 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12697 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12698 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12699 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12700 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12704 static struct hda_verb alc267_quanta_il1_verbs[] = {
12705 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12706 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12710 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12712 struct alc_spec *spec = codec->spec;
12713 spec->autocfg.hp_pins[0] = 0x15;
12714 spec->autocfg.speaker_pins[0] = 0x14;
12715 spec->ext_mic.pin = 0x18;
12716 spec->ext_mic.mux_idx = 0;
12717 spec->int_mic.pin = 0x19;
12718 spec->int_mic.mux_idx = 1;
12719 spec->auto_mic = 1;
12723 * generic initialization of ADC, input mixers and output mixers
12725 static struct hda_verb alc268_base_init_verbs[] = {
12726 /* Unmute DAC0-1 and set vol = 0 */
12727 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12728 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12731 * Set up output mixers (0x0c - 0x0e)
12733 /* set vol=0 to output mixers */
12734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12735 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12738 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12740 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12741 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12742 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12743 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12744 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12745 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12746 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12747 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12749 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12751 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12752 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12755 /* set PCBEEP vol = 0, mute connections */
12756 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12757 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12758 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12760 /* Unmute Selector 23h,24h and set the default input to mic-in */
12762 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12763 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12764 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12765 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12771 * generic initialization of ADC, input mixers and output mixers
12773 static struct hda_verb alc268_volume_init_verbs[] = {
12774 /* set output DAC */
12775 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12776 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12778 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12779 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12780 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12781 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12782 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12784 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12785 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12786 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12788 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12789 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12791 /* set PCBEEP vol = 0, mute connections */
12792 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12793 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12794 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12799 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12800 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12801 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12805 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12806 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12807 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12812 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12813 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12814 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12815 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12816 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12821 static struct hda_input_mux alc268_capture_source = {
12825 { "Front Mic", 0x1 },
12831 static struct hda_input_mux alc268_acer_capture_source = {
12835 { "Internal Mic", 0x1 },
12840 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12844 { "Internal Mic", 0x6 },
12849 #ifdef CONFIG_SND_DEBUG
12850 static struct snd_kcontrol_new alc268_test_mixer[] = {
12851 /* Volume widgets */
12852 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12853 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12854 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12855 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12856 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12857 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12858 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12859 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12860 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12861 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12862 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12863 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12864 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12865 /* The below appears problematic on some hardwares */
12866 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12867 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12868 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12869 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12870 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12872 /* Modes for retasking pin widgets */
12873 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12874 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12875 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12876 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12878 /* Controls for GPIO pins, assuming they are configured as outputs */
12879 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12880 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12881 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12882 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12884 /* Switches to allow the digital SPDIF output pin to be enabled.
12885 * The ALC268 does not have an SPDIF input.
12887 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12889 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12890 * this output to turn on an external amplifier.
12892 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12893 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12899 /* create input playback/capture controls for the given pin */
12900 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12901 const char *ctlname, int idx)
12917 if (spec->multiout.dac_nids[0] != dac &&
12918 spec->multiout.dac_nids[1] != dac) {
12919 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12920 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12924 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12928 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12929 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12931 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12932 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12938 /* add playback controls from the parsed DAC table */
12939 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12940 const struct auto_pin_cfg *cfg)
12945 spec->multiout.dac_nids = spec->private_dac_nids;
12947 nid = cfg->line_out_pins[0];
12950 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12954 err = alc268_new_analog_output(spec, nid, name, 0);
12959 nid = cfg->speaker_pins[0];
12961 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12962 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12966 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12970 nid = cfg->hp_pins[0];
12972 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12977 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12979 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12980 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12987 /* create playback/capture controls for input pins */
12988 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12989 const struct auto_pin_cfg *cfg)
12991 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12994 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12995 hda_nid_t nid, int pin_type)
12999 alc_set_pin_output(codec, nid, pin_type);
13000 if (nid == 0x14 || nid == 0x16)
13004 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13007 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13009 struct alc_spec *spec = codec->spec;
13010 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13012 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13013 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13017 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13019 struct alc_spec *spec = codec->spec;
13022 pin = spec->autocfg.hp_pins[0];
13024 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13025 pin = spec->autocfg.speaker_pins[0];
13027 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13030 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13032 struct alc_spec *spec = codec->spec;
13033 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13034 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13035 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13036 unsigned int dac_vol1, dac_vol2;
13038 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13039 snd_hda_codec_write(codec, speaker_nid, 0,
13040 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13041 /* mute mixer inputs from 0x1d */
13042 snd_hda_codec_write(codec, 0x0f, 0,
13043 AC_VERB_SET_AMP_GAIN_MUTE,
13045 snd_hda_codec_write(codec, 0x10, 0,
13046 AC_VERB_SET_AMP_GAIN_MUTE,
13049 /* unmute mixer inputs from 0x1d */
13050 snd_hda_codec_write(codec, 0x0f, 0,
13051 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13052 snd_hda_codec_write(codec, 0x10, 0,
13053 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13056 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13057 if (line_nid == 0x14)
13058 dac_vol2 = AMP_OUT_ZERO;
13059 else if (line_nid == 0x15)
13060 dac_vol1 = AMP_OUT_ZERO;
13061 if (hp_nid == 0x14)
13062 dac_vol2 = AMP_OUT_ZERO;
13063 else if (hp_nid == 0x15)
13064 dac_vol1 = AMP_OUT_ZERO;
13065 if (line_nid != 0x16 || hp_nid != 0x16 ||
13066 spec->autocfg.line_out_pins[1] != 0x16 ||
13067 spec->autocfg.line_out_pins[2] != 0x16)
13068 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13070 snd_hda_codec_write(codec, 0x02, 0,
13071 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13072 snd_hda_codec_write(codec, 0x03, 0,
13073 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13076 /* pcm configuration: identical with ALC880 */
13077 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13078 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13079 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13080 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13083 * BIOS auto configuration
13085 static int alc268_parse_auto_config(struct hda_codec *codec)
13087 struct alc_spec *spec = codec->spec;
13089 static hda_nid_t alc268_ignore[] = { 0 };
13091 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13095 if (!spec->autocfg.line_outs) {
13096 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13097 spec->multiout.max_channels = 2;
13098 spec->no_analog = 1;
13101 return 0; /* can't find valid BIOS pin config */
13103 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13106 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13110 spec->multiout.max_channels = 2;
13113 /* digital only support output */
13114 if (spec->autocfg.dig_outs) {
13115 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13116 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13118 if (spec->kctls.list)
13119 add_mixer(spec, spec->kctls.list);
13121 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13122 add_mixer(spec, alc268_beep_mixer);
13124 add_verb(spec, alc268_volume_init_verbs);
13125 spec->num_mux_defs = 2;
13126 spec->input_mux = &spec->private_imux[0];
13128 err = alc_auto_add_mic_boost(codec);
13132 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13137 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13139 /* init callback for auto-configuration model -- overriding the default init */
13140 static void alc268_auto_init(struct hda_codec *codec)
13142 struct alc_spec *spec = codec->spec;
13143 alc268_auto_init_multi_out(codec);
13144 alc268_auto_init_hp_out(codec);
13145 alc268_auto_init_mono_speaker_out(codec);
13146 alc268_auto_init_analog_input(codec);
13147 if (spec->unsol_event)
13148 alc_inithook(codec);
13152 * configuration and preset
13154 static const char *alc268_models[ALC268_MODEL_LAST] = {
13155 [ALC267_QUANTA_IL1] = "quanta-il1",
13156 [ALC268_3ST] = "3stack",
13157 [ALC268_TOSHIBA] = "toshiba",
13158 [ALC268_ACER] = "acer",
13159 [ALC268_ACER_DMIC] = "acer-dmic",
13160 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13161 [ALC268_DELL] = "dell",
13162 [ALC268_ZEPTO] = "zepto",
13163 #ifdef CONFIG_SND_DEBUG
13164 [ALC268_TEST] = "test",
13166 [ALC268_AUTO] = "auto",
13169 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13170 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13171 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13172 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13173 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13174 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13175 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13176 ALC268_ACER_ASPIRE_ONE),
13177 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13178 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13179 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13180 /* almost compatible with toshiba but with optional digital outs;
13181 * auto-probing seems working fine
13183 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13185 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13186 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13187 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13188 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13189 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13190 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13194 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13195 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13196 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13197 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13198 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13203 static struct alc_config_preset alc268_presets[] = {
13204 [ALC267_QUANTA_IL1] = {
13205 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13206 alc268_capture_nosrc_mixer },
13207 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13208 alc267_quanta_il1_verbs },
13209 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13210 .dac_nids = alc268_dac_nids,
13211 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13212 .adc_nids = alc268_adc_nids_alt,
13214 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13215 .channel_mode = alc268_modes,
13216 .unsol_event = alc_sku_unsol_event,
13217 .setup = alc267_quanta_il1_setup,
13218 .init_hook = alc_inithook,
13221 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13222 alc268_beep_mixer },
13223 .init_verbs = { alc268_base_init_verbs },
13224 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13225 .dac_nids = alc268_dac_nids,
13226 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13227 .adc_nids = alc268_adc_nids_alt,
13228 .capsrc_nids = alc268_capsrc_nids,
13230 .dig_out_nid = ALC268_DIGOUT_NID,
13231 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13232 .channel_mode = alc268_modes,
13233 .input_mux = &alc268_capture_source,
13235 [ALC268_TOSHIBA] = {
13236 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13237 alc268_beep_mixer },
13238 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13239 alc268_toshiba_verbs },
13240 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13241 .dac_nids = alc268_dac_nids,
13242 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13243 .adc_nids = alc268_adc_nids_alt,
13244 .capsrc_nids = alc268_capsrc_nids,
13246 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13247 .channel_mode = alc268_modes,
13248 .input_mux = &alc268_capture_source,
13249 .unsol_event = alc268_toshiba_unsol_event,
13250 .setup = alc268_toshiba_setup,
13251 .init_hook = alc268_toshiba_automute,
13254 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13255 alc268_beep_mixer },
13256 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13257 alc268_acer_verbs },
13258 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13259 .dac_nids = alc268_dac_nids,
13260 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13261 .adc_nids = alc268_adc_nids_alt,
13262 .capsrc_nids = alc268_capsrc_nids,
13264 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13265 .channel_mode = alc268_modes,
13266 .input_mux = &alc268_acer_capture_source,
13267 .unsol_event = alc268_acer_unsol_event,
13268 .init_hook = alc268_acer_init_hook,
13270 [ALC268_ACER_DMIC] = {
13271 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13272 alc268_beep_mixer },
13273 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13274 alc268_acer_verbs },
13275 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13276 .dac_nids = alc268_dac_nids,
13277 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13278 .adc_nids = alc268_adc_nids_alt,
13279 .capsrc_nids = alc268_capsrc_nids,
13281 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13282 .channel_mode = alc268_modes,
13283 .input_mux = &alc268_acer_dmic_capture_source,
13284 .unsol_event = alc268_acer_unsol_event,
13285 .init_hook = alc268_acer_init_hook,
13287 [ALC268_ACER_ASPIRE_ONE] = {
13288 .mixers = { alc268_acer_aspire_one_mixer,
13290 alc268_capture_nosrc_mixer },
13291 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13292 alc268_acer_aspire_one_verbs },
13293 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13294 .dac_nids = alc268_dac_nids,
13295 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13296 .adc_nids = alc268_adc_nids_alt,
13297 .capsrc_nids = alc268_capsrc_nids,
13299 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13300 .channel_mode = alc268_modes,
13301 .unsol_event = alc268_acer_lc_unsol_event,
13302 .setup = alc268_acer_lc_setup,
13303 .init_hook = alc268_acer_lc_init_hook,
13306 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13307 alc268_capture_nosrc_mixer },
13308 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13309 alc268_dell_verbs },
13310 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13311 .dac_nids = alc268_dac_nids,
13312 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13313 .adc_nids = alc268_adc_nids_alt,
13314 .capsrc_nids = alc268_capsrc_nids,
13316 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13317 .channel_mode = alc268_modes,
13318 .unsol_event = alc_sku_unsol_event,
13319 .setup = alc268_dell_setup,
13320 .init_hook = alc_inithook,
13323 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13324 alc268_beep_mixer },
13325 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13326 alc268_toshiba_verbs },
13327 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13328 .dac_nids = alc268_dac_nids,
13329 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13330 .adc_nids = alc268_adc_nids_alt,
13331 .capsrc_nids = alc268_capsrc_nids,
13333 .dig_out_nid = ALC268_DIGOUT_NID,
13334 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13335 .channel_mode = alc268_modes,
13336 .input_mux = &alc268_capture_source,
13337 .setup = alc268_toshiba_setup,
13338 .init_hook = alc268_toshiba_automute,
13340 #ifdef CONFIG_SND_DEBUG
13342 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13343 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13344 alc268_volume_init_verbs },
13345 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13346 .dac_nids = alc268_dac_nids,
13347 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13348 .adc_nids = alc268_adc_nids_alt,
13349 .capsrc_nids = alc268_capsrc_nids,
13351 .dig_out_nid = ALC268_DIGOUT_NID,
13352 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13353 .channel_mode = alc268_modes,
13354 .input_mux = &alc268_capture_source,
13359 static int patch_alc268(struct hda_codec *codec)
13361 struct alc_spec *spec;
13363 int i, has_beep, err;
13365 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13369 codec->spec = spec;
13371 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13375 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13376 board_config = snd_hda_check_board_codec_sid_config(codec,
13377 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13379 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13380 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13382 board_config = ALC268_AUTO;
13385 if (board_config == ALC268_AUTO) {
13386 /* automatic parse from the BIOS config */
13387 err = alc268_parse_auto_config(codec);
13393 "hda_codec: Cannot set up configuration "
13394 "from BIOS. Using base mode...\n");
13395 board_config = ALC268_3ST;
13399 if (board_config != ALC268_AUTO)
13400 setup_preset(codec, &alc268_presets[board_config]);
13402 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13403 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13404 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13406 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13409 for (i = 0; i < spec->num_mixers; i++) {
13410 if (spec->mixers[i] == alc268_beep_mixer) {
13417 err = snd_hda_attach_beep_device(codec, 0x1);
13422 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13423 /* override the amp caps for beep generator */
13424 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13425 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13426 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13427 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13428 (0 << AC_AMPCAP_MUTE_SHIFT));
13431 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13432 /* check whether NID 0x07 is valid */
13433 unsigned int wcap = get_wcaps(codec, 0x07);
13436 spec->capsrc_nids = alc268_capsrc_nids;
13438 wcap = get_wcaps_type(wcap);
13439 if (spec->auto_mic ||
13440 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13441 spec->adc_nids = alc268_adc_nids_alt;
13442 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13443 if (spec->auto_mic)
13444 fixup_automic_adc(codec);
13445 if (spec->auto_mic || spec->input_mux->num_items == 1)
13446 add_mixer(spec, alc268_capture_nosrc_mixer);
13448 add_mixer(spec, alc268_capture_alt_mixer);
13450 spec->adc_nids = alc268_adc_nids;
13451 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13452 add_mixer(spec, alc268_capture_mixer);
13454 /* set default input source */
13455 for (i = 0; i < spec->num_adc_nids; i++)
13456 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13457 0, AC_VERB_SET_CONNECT_SEL,
13458 i < spec->num_mux_defs ?
13459 spec->input_mux[i].items[0].index :
13460 spec->input_mux->items[0].index);
13463 spec->vmaster_nid = 0x02;
13465 codec->patch_ops = alc_patch_ops;
13466 if (board_config == ALC268_AUTO)
13467 spec->init_hook = alc268_auto_init;
13473 * ALC269 channel source setting (2 channel)
13475 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13477 #define alc269_dac_nids alc260_dac_nids
13479 static hda_nid_t alc269_adc_nids[1] = {
13484 static hda_nid_t alc269_capsrc_nids[1] = {
13488 static hda_nid_t alc269vb_adc_nids[1] = {
13493 static hda_nid_t alc269vb_capsrc_nids[1] = {
13497 static hda_nid_t alc269_adc_candidates[] = {
13501 #define alc269_modes alc260_modes
13502 #define alc269_capture_source alc880_lg_lw_capture_source
13504 static struct snd_kcontrol_new alc269_base_mixer[] = {
13505 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13506 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13507 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13508 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13510 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13511 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13512 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13513 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13514 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13516 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13520 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13521 /* output mixer control */
13522 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13524 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13525 .name = "Master Playback Switch",
13526 .subdevice = HDA_SUBDEV_AMP_FLAG,
13527 .info = snd_hda_mixer_amp_switch_info,
13528 .get = snd_hda_mixer_amp_switch_get,
13529 .put = alc268_acer_master_sw_put,
13530 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13533 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13534 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13535 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13536 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13537 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13541 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13542 /* output mixer control */
13543 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13545 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13546 .name = "Master Playback Switch",
13547 .subdevice = HDA_SUBDEV_AMP_FLAG,
13548 .info = snd_hda_mixer_amp_switch_info,
13549 .get = snd_hda_mixer_amp_switch_get,
13550 .put = alc268_acer_master_sw_put,
13551 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13553 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13554 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13555 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13556 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13557 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13558 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13559 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13560 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13561 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13565 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13566 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13567 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13568 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13569 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13573 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13574 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13575 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13576 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13577 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13581 /* capture mixer elements */
13582 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13583 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13584 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13585 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13586 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13590 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13591 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13592 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13593 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13597 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13598 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13599 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13600 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13601 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13605 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13606 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13607 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13608 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13613 #define alc269_fujitsu_mixer alc269_laptop_mixer
13615 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13616 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13617 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13618 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13619 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13620 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13621 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13625 static struct hda_verb alc269_lifebook_verbs[] = {
13626 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13627 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13628 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13629 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13630 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13631 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13632 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13633 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13634 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13635 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13639 /* toggle speaker-output according to the hp-jack state */
13640 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13642 unsigned int present;
13643 unsigned char bits;
13645 present = snd_hda_jack_detect(codec, 0x15);
13646 bits = present ? HDA_AMP_MUTE : 0;
13647 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13648 HDA_AMP_MUTE, bits);
13649 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13650 HDA_AMP_MUTE, bits);
13652 snd_hda_codec_write(codec, 0x20, 0,
13653 AC_VERB_SET_COEF_INDEX, 0x0c);
13654 snd_hda_codec_write(codec, 0x20, 0,
13655 AC_VERB_SET_PROC_COEF, 0x680);
13657 snd_hda_codec_write(codec, 0x20, 0,
13658 AC_VERB_SET_COEF_INDEX, 0x0c);
13659 snd_hda_codec_write(codec, 0x20, 0,
13660 AC_VERB_SET_PROC_COEF, 0x480);
13663 /* toggle speaker-output according to the hp-jacks state */
13664 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13666 unsigned int present;
13667 unsigned char bits;
13669 /* Check laptop headphone socket */
13670 present = snd_hda_jack_detect(codec, 0x15);
13672 /* Check port replicator headphone socket */
13673 present |= snd_hda_jack_detect(codec, 0x1a);
13675 bits = present ? HDA_AMP_MUTE : 0;
13676 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13677 HDA_AMP_MUTE, bits);
13678 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13679 HDA_AMP_MUTE, bits);
13681 snd_hda_codec_write(codec, 0x20, 0,
13682 AC_VERB_SET_COEF_INDEX, 0x0c);
13683 snd_hda_codec_write(codec, 0x20, 0,
13684 AC_VERB_SET_PROC_COEF, 0x680);
13686 snd_hda_codec_write(codec, 0x20, 0,
13687 AC_VERB_SET_COEF_INDEX, 0x0c);
13688 snd_hda_codec_write(codec, 0x20, 0,
13689 AC_VERB_SET_PROC_COEF, 0x480);
13692 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13694 unsigned int present_laptop;
13695 unsigned int present_dock;
13697 present_laptop = snd_hda_jack_detect(codec, 0x18);
13698 present_dock = snd_hda_jack_detect(codec, 0x1b);
13700 /* Laptop mic port overrides dock mic port, design decision */
13702 snd_hda_codec_write(codec, 0x23, 0,
13703 AC_VERB_SET_CONNECT_SEL, 0x3);
13704 if (present_laptop)
13705 snd_hda_codec_write(codec, 0x23, 0,
13706 AC_VERB_SET_CONNECT_SEL, 0x0);
13707 if (!present_dock && !present_laptop)
13708 snd_hda_codec_write(codec, 0x23, 0,
13709 AC_VERB_SET_CONNECT_SEL, 0x1);
13712 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13715 switch (res >> 26) {
13716 case ALC880_HP_EVENT:
13717 alc269_quanta_fl1_speaker_automute(codec);
13719 case ALC880_MIC_EVENT:
13720 alc_mic_automute(codec);
13725 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13728 if ((res >> 26) == ALC880_HP_EVENT)
13729 alc269_lifebook_speaker_automute(codec);
13730 if ((res >> 26) == ALC880_MIC_EVENT)
13731 alc269_lifebook_mic_autoswitch(codec);
13734 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13736 struct alc_spec *spec = codec->spec;
13737 spec->autocfg.hp_pins[0] = 0x15;
13738 spec->autocfg.speaker_pins[0] = 0x14;
13739 spec->ext_mic.pin = 0x18;
13740 spec->ext_mic.mux_idx = 0;
13741 spec->int_mic.pin = 0x19;
13742 spec->int_mic.mux_idx = 1;
13743 spec->auto_mic = 1;
13746 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13748 alc269_quanta_fl1_speaker_automute(codec);
13749 alc_mic_automute(codec);
13752 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13754 alc269_lifebook_speaker_automute(codec);
13755 alc269_lifebook_mic_autoswitch(codec);
13758 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13759 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13760 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13761 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13762 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13763 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13764 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13765 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13769 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13770 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13771 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13772 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13773 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13774 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13775 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13779 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13780 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13781 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13782 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13783 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13784 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13785 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13786 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13790 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13791 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13792 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13793 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13794 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13795 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13796 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13797 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13801 /* toggle speaker-output according to the hp-jack state */
13802 static void alc269_speaker_automute(struct hda_codec *codec)
13804 struct alc_spec *spec = codec->spec;
13805 unsigned int nid = spec->autocfg.hp_pins[0];
13806 unsigned int present;
13807 unsigned char bits;
13809 present = snd_hda_jack_detect(codec, nid);
13810 bits = present ? HDA_AMP_MUTE : 0;
13811 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13812 HDA_AMP_MUTE, bits);
13813 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13814 HDA_AMP_MUTE, bits);
13817 /* unsolicited event for HP jack sensing */
13818 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13821 switch (res >> 26) {
13822 case ALC880_HP_EVENT:
13823 alc269_speaker_automute(codec);
13825 case ALC880_MIC_EVENT:
13826 alc_mic_automute(codec);
13831 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13833 struct alc_spec *spec = codec->spec;
13834 spec->autocfg.hp_pins[0] = 0x15;
13835 spec->autocfg.speaker_pins[0] = 0x14;
13836 spec->ext_mic.pin = 0x18;
13837 spec->ext_mic.mux_idx = 0;
13838 spec->int_mic.pin = 0x12;
13839 spec->int_mic.mux_idx = 5;
13840 spec->auto_mic = 1;
13843 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13845 struct alc_spec *spec = codec->spec;
13846 spec->autocfg.hp_pins[0] = 0x15;
13847 spec->autocfg.speaker_pins[0] = 0x14;
13848 spec->ext_mic.pin = 0x18;
13849 spec->ext_mic.mux_idx = 0;
13850 spec->int_mic.pin = 0x12;
13851 spec->int_mic.mux_idx = 6;
13852 spec->auto_mic = 1;
13855 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13857 struct alc_spec *spec = codec->spec;
13858 spec->autocfg.hp_pins[0] = 0x15;
13859 spec->autocfg.speaker_pins[0] = 0x14;
13860 spec->ext_mic.pin = 0x18;
13861 spec->ext_mic.mux_idx = 0;
13862 spec->int_mic.pin = 0x19;
13863 spec->int_mic.mux_idx = 1;
13864 spec->auto_mic = 1;
13867 static void alc269_laptop_inithook(struct hda_codec *codec)
13869 alc269_speaker_automute(codec);
13870 alc_mic_automute(codec);
13874 * generic initialization of ADC, input mixers and output mixers
13876 static struct hda_verb alc269_init_verbs[] = {
13878 * Unmute ADC0 and set the default input to mic-in
13880 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13883 * Set up output mixers (0x02 - 0x03)
13885 /* set vol=0 to output mixers */
13886 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13887 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13889 /* set up input amps for analog loopback */
13890 /* Amp Indices: DAC = 0, mixer = 1 */
13891 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13892 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13893 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13894 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13895 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13896 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13898 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13899 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13900 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13901 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13902 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13903 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13904 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13906 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13907 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13909 /* FIXME: use Mux-type input source selection */
13910 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13911 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13912 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13915 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13919 static struct hda_verb alc269vb_init_verbs[] = {
13921 * Unmute ADC0 and set the default input to mic-in
13923 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13926 * Set up output mixers (0x02 - 0x03)
13928 /* set vol=0 to output mixers */
13929 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13930 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13932 /* set up input amps for analog loopback */
13933 /* Amp Indices: DAC = 0, mixer = 1 */
13934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13936 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13937 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13938 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13939 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13941 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13942 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13943 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13944 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13947 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13950 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13952 /* FIXME: use Mux-type input source selection */
13953 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13954 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13955 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13958 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13962 #define alc269_auto_create_multi_out_ctls \
13963 alc268_auto_create_multi_out_ctls
13964 #define alc269_auto_create_input_ctls \
13965 alc268_auto_create_input_ctls
13967 #ifdef CONFIG_SND_HDA_POWER_SAVE
13968 #define alc269_loopbacks alc880_loopbacks
13971 /* pcm configuration: identical with ALC880 */
13972 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13973 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13974 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13975 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13977 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13981 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13982 /* NID is set in alc_build_pcms */
13984 .open = alc880_playback_pcm_open,
13985 .prepare = alc880_playback_pcm_prepare,
13986 .cleanup = alc880_playback_pcm_cleanup
13990 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13994 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13995 /* NID is set in alc_build_pcms */
13998 #ifdef CONFIG_SND_HDA_POWER_SAVE
13999 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14001 switch (codec->subsystem_id) {
14008 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14010 /* update mute-LED according to the speaker mute state */
14011 if (nid == 0x01 || nid == 0x14) {
14013 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14018 /* mic2 vref pin is used for mute LED control */
14019 snd_hda_codec_update_cache(codec, 0x19, 0,
14020 AC_VERB_SET_PIN_WIDGET_CONTROL,
14023 return alc_check_power_status(codec, nid);
14025 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14028 * BIOS auto configuration
14030 static int alc269_parse_auto_config(struct hda_codec *codec)
14032 struct alc_spec *spec = codec->spec;
14034 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14036 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14041 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14044 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14048 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14050 if (spec->autocfg.dig_outs)
14051 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
14053 if (spec->kctls.list)
14054 add_mixer(spec, spec->kctls.list);
14056 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14057 add_verb(spec, alc269vb_init_verbs);
14058 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14060 add_verb(spec, alc269_init_verbs);
14061 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14064 spec->num_mux_defs = 1;
14065 spec->input_mux = &spec->private_imux[0];
14066 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14067 sizeof(alc269_adc_candidates));
14069 /* set default input source */
14070 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14071 0, AC_VERB_SET_CONNECT_SEL,
14072 spec->input_mux->items[0].index);
14074 err = alc_auto_add_mic_boost(codec);
14078 if (!spec->cap_mixer && !spec->no_analog)
14079 set_capture_mixer(codec);
14084 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14085 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14086 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14089 /* init callback for auto-configuration model -- overriding the default init */
14090 static void alc269_auto_init(struct hda_codec *codec)
14092 struct alc_spec *spec = codec->spec;
14093 alc269_auto_init_multi_out(codec);
14094 alc269_auto_init_hp_out(codec);
14095 alc269_auto_init_analog_input(codec);
14096 if (spec->unsol_event)
14097 alc_inithook(codec);
14101 * configuration and preset
14103 static const char *alc269_models[ALC269_MODEL_LAST] = {
14104 [ALC269_BASIC] = "basic",
14105 [ALC269_QUANTA_FL1] = "quanta",
14106 [ALC269_AMIC] = "laptop-amic",
14107 [ALC269_DMIC] = "laptop-dmic",
14108 [ALC269_FUJITSU] = "fujitsu",
14109 [ALC269_LIFEBOOK] = "lifebook",
14110 [ALC269_AUTO] = "auto",
14113 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14114 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14115 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14117 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14118 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14119 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14120 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14121 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14122 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14123 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14124 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14125 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14126 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14127 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14128 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14129 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14130 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14131 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14132 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14133 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14134 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14135 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14136 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14137 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14138 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14139 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14140 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14141 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14142 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14143 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14144 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14145 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14146 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14147 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14148 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14149 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14150 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14151 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14152 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14153 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14155 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14157 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14158 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14159 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
14160 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14161 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14162 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14163 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14164 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14165 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14166 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14170 static struct alc_config_preset alc269_presets[] = {
14172 .mixers = { alc269_base_mixer },
14173 .init_verbs = { alc269_init_verbs },
14174 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14175 .dac_nids = alc269_dac_nids,
14177 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14178 .channel_mode = alc269_modes,
14179 .input_mux = &alc269_capture_source,
14181 [ALC269_QUANTA_FL1] = {
14182 .mixers = { alc269_quanta_fl1_mixer },
14183 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14184 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14185 .dac_nids = alc269_dac_nids,
14187 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14188 .channel_mode = alc269_modes,
14189 .input_mux = &alc269_capture_source,
14190 .unsol_event = alc269_quanta_fl1_unsol_event,
14191 .setup = alc269_quanta_fl1_setup,
14192 .init_hook = alc269_quanta_fl1_init_hook,
14195 .mixers = { alc269_laptop_mixer },
14196 .cap_mixer = alc269_laptop_analog_capture_mixer,
14197 .init_verbs = { alc269_init_verbs,
14198 alc269_laptop_amic_init_verbs },
14199 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14200 .dac_nids = alc269_dac_nids,
14202 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14203 .channel_mode = alc269_modes,
14204 .unsol_event = alc269_laptop_unsol_event,
14205 .setup = alc269_laptop_amic_setup,
14206 .init_hook = alc269_laptop_inithook,
14209 .mixers = { alc269_laptop_mixer },
14210 .cap_mixer = alc269_laptop_digital_capture_mixer,
14211 .init_verbs = { alc269_init_verbs,
14212 alc269_laptop_dmic_init_verbs },
14213 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14214 .dac_nids = alc269_dac_nids,
14216 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14217 .channel_mode = alc269_modes,
14218 .unsol_event = alc269_laptop_unsol_event,
14219 .setup = alc269_laptop_dmic_setup,
14220 .init_hook = alc269_laptop_inithook,
14222 [ALC269VB_AMIC] = {
14223 .mixers = { alc269vb_laptop_mixer },
14224 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14225 .init_verbs = { alc269vb_init_verbs,
14226 alc269vb_laptop_amic_init_verbs },
14227 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14228 .dac_nids = alc269_dac_nids,
14230 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14231 .channel_mode = alc269_modes,
14232 .unsol_event = alc269_laptop_unsol_event,
14233 .setup = alc269_laptop_amic_setup,
14234 .init_hook = alc269_laptop_inithook,
14236 [ALC269VB_DMIC] = {
14237 .mixers = { alc269vb_laptop_mixer },
14238 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14239 .init_verbs = { alc269vb_init_verbs,
14240 alc269vb_laptop_dmic_init_verbs },
14241 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14242 .dac_nids = alc269_dac_nids,
14244 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14245 .channel_mode = alc269_modes,
14246 .unsol_event = alc269_laptop_unsol_event,
14247 .setup = alc269vb_laptop_dmic_setup,
14248 .init_hook = alc269_laptop_inithook,
14250 [ALC269_FUJITSU] = {
14251 .mixers = { alc269_fujitsu_mixer },
14252 .cap_mixer = alc269_laptop_digital_capture_mixer,
14253 .init_verbs = { alc269_init_verbs,
14254 alc269_laptop_dmic_init_verbs },
14255 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14256 .dac_nids = alc269_dac_nids,
14258 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14259 .channel_mode = alc269_modes,
14260 .unsol_event = alc269_laptop_unsol_event,
14261 .setup = alc269_laptop_dmic_setup,
14262 .init_hook = alc269_laptop_inithook,
14264 [ALC269_LIFEBOOK] = {
14265 .mixers = { alc269_lifebook_mixer },
14266 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14267 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14268 .dac_nids = alc269_dac_nids,
14270 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14271 .channel_mode = alc269_modes,
14272 .input_mux = &alc269_capture_source,
14273 .unsol_event = alc269_lifebook_unsol_event,
14274 .init_hook = alc269_lifebook_init_hook,
14278 static int patch_alc269(struct hda_codec *codec)
14280 struct alc_spec *spec;
14283 int is_alc269vb = 0;
14285 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14289 codec->spec = spec;
14291 alc_auto_parse_customize_define(codec);
14293 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14294 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14295 spec->cdefine.platform_type == 1)
14296 alc_codec_rename(codec, "ALC271X");
14298 alc_codec_rename(codec, "ALC259");
14301 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14303 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14307 if (board_config < 0) {
14308 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14310 board_config = ALC269_AUTO;
14313 if (board_config == ALC269_AUTO) {
14314 /* automatic parse from the BIOS config */
14315 err = alc269_parse_auto_config(codec);
14321 "hda_codec: Cannot set up configuration "
14322 "from BIOS. Using base mode...\n");
14323 board_config = ALC269_BASIC;
14327 err = snd_hda_attach_beep_device(codec, 0x1);
14333 if (board_config != ALC269_AUTO)
14334 setup_preset(codec, &alc269_presets[board_config]);
14336 if (board_config == ALC269_QUANTA_FL1) {
14337 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14338 * fix the sample rate of analog I/O to 44.1kHz
14340 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14341 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14343 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14344 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14346 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14347 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14349 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14350 if (!is_alc269vb) {
14351 spec->adc_nids = alc269_adc_nids;
14352 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14353 spec->capsrc_nids = alc269_capsrc_nids;
14355 spec->adc_nids = alc269vb_adc_nids;
14356 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14357 spec->capsrc_nids = alc269vb_capsrc_nids;
14361 if (!spec->cap_mixer)
14362 set_capture_mixer(codec);
14363 if (spec->cdefine.enable_pcbeep)
14364 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14366 spec->vmaster_nid = 0x02;
14368 codec->patch_ops = alc_patch_ops;
14369 if (board_config == ALC269_AUTO)
14370 spec->init_hook = alc269_auto_init;
14371 #ifdef CONFIG_SND_HDA_POWER_SAVE
14372 if (!spec->loopback.amplist)
14373 spec->loopback.amplist = alc269_loopbacks;
14374 if (alc269_mic2_for_mute_led(codec))
14375 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14382 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14386 * set the path ways for 2 channel output
14387 * need to set the codec line out and mic 1 pin widgets to inputs
14389 static struct hda_verb alc861_threestack_ch2_init[] = {
14390 /* set pin widget 1Ah (line in) for input */
14391 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14392 /* set pin widget 18h (mic1/2) for input, for mic also enable
14395 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14397 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14399 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14400 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14406 * need to set the codec line out and mic 1 pin widgets to outputs
14408 static struct hda_verb alc861_threestack_ch6_init[] = {
14409 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14410 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14411 /* set pin widget 18h (mic1) for output (CLFE)*/
14412 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14414 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14415 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14417 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14419 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14420 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14425 static struct hda_channel_mode alc861_threestack_modes[2] = {
14426 { 2, alc861_threestack_ch2_init },
14427 { 6, alc861_threestack_ch6_init },
14429 /* Set mic1 as input and unmute the mixer */
14430 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14431 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14432 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14435 /* Set mic1 as output and mute mixer */
14436 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14437 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14438 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14442 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14443 { 2, alc861_uniwill_m31_ch2_init },
14444 { 4, alc861_uniwill_m31_ch4_init },
14447 /* Set mic1 and line-in as input and unmute the mixer */
14448 static struct hda_verb alc861_asus_ch2_init[] = {
14449 /* set pin widget 1Ah (line in) for input */
14450 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14451 /* set pin widget 18h (mic1/2) for input, for mic also enable
14454 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14456 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14458 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14459 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14463 /* Set mic1 nad line-in as output and mute mixer */
14464 static struct hda_verb alc861_asus_ch6_init[] = {
14465 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14466 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14467 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14468 /* set pin widget 18h (mic1) for output (CLFE)*/
14469 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14470 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14471 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14472 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14474 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14476 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14477 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14482 static struct hda_channel_mode alc861_asus_modes[2] = {
14483 { 2, alc861_asus_ch2_init },
14484 { 6, alc861_asus_ch6_init },
14489 static struct snd_kcontrol_new alc861_base_mixer[] = {
14490 /* output mixer control */
14491 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14492 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14493 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14494 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14495 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14497 /*Input mixer control */
14498 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14499 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14500 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14501 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14502 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14503 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14505 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14506 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14507 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14512 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14513 /* output mixer control */
14514 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14515 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14516 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14517 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14518 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14520 /* Input mixer control */
14521 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14522 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14523 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14524 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14525 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14526 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14527 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14528 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14529 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14530 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14533 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14534 .name = "Channel Mode",
14535 .info = alc_ch_mode_info,
14536 .get = alc_ch_mode_get,
14537 .put = alc_ch_mode_put,
14538 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14543 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14544 /* output mixer control */
14545 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14546 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14547 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14552 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14553 /* output mixer control */
14554 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14555 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14556 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14557 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14558 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14560 /* Input mixer control */
14561 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14562 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14563 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14564 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14565 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14566 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14567 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14568 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14569 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14570 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14573 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14574 .name = "Channel Mode",
14575 .info = alc_ch_mode_info,
14576 .get = alc_ch_mode_get,
14577 .put = alc_ch_mode_put,
14578 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14583 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14584 /* output mixer control */
14585 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14586 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14587 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14588 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14589 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14591 /* Input mixer control */
14592 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14593 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14594 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14595 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14596 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14597 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14598 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14599 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14600 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14601 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14604 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14605 .name = "Channel Mode",
14606 .info = alc_ch_mode_info,
14607 .get = alc_ch_mode_get,
14608 .put = alc_ch_mode_put,
14609 .private_value = ARRAY_SIZE(alc861_asus_modes),
14614 /* additional mixer */
14615 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14616 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14617 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14622 * generic initialization of ADC, input mixers and output mixers
14624 static struct hda_verb alc861_base_init_verbs[] = {
14626 * Unmute ADC0 and set the default input to mic-in
14628 /* port-A for surround (rear panel) */
14629 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14630 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14631 /* port-B for mic-in (rear panel) with vref */
14632 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14633 /* port-C for line-in (rear panel) */
14634 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14635 /* port-D for Front */
14636 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14637 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14638 /* port-E for HP out (front panel) */
14639 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14640 /* route front PCM to HP */
14641 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14642 /* port-F for mic-in (front panel) with vref */
14643 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14644 /* port-G for CLFE (rear panel) */
14645 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14646 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14647 /* port-H for side (rear panel) */
14648 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14649 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14651 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14652 /* route front mic to ADC1*/
14653 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14654 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14656 /* Unmute DAC0~3 & spdif out*/
14657 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14658 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14659 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14660 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14661 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14663 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14664 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14665 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14666 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14667 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14669 /* Unmute Stereo Mixer 15 */
14670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14671 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14672 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14673 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14675 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14676 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14677 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14678 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14679 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14680 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14681 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14682 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14683 /* hp used DAC 3 (Front) */
14684 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14685 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14690 static struct hda_verb alc861_threestack_init_verbs[] = {
14692 * Unmute ADC0 and set the default input to mic-in
14694 /* port-A for surround (rear panel) */
14695 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14696 /* port-B for mic-in (rear panel) with vref */
14697 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14698 /* port-C for line-in (rear panel) */
14699 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14700 /* port-D for Front */
14701 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14702 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14703 /* port-E for HP out (front panel) */
14704 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14705 /* route front PCM to HP */
14706 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14707 /* port-F for mic-in (front panel) with vref */
14708 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14709 /* port-G for CLFE (rear panel) */
14710 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14711 /* port-H for side (rear panel) */
14712 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14714 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14715 /* route front mic to ADC1*/
14716 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14717 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14718 /* Unmute DAC0~3 & spdif out*/
14719 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14721 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14722 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14725 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14726 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14727 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14728 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14729 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14731 /* Unmute Stereo Mixer 15 */
14732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14734 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14735 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14737 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14738 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14739 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14740 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14741 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14742 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14744 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14745 /* hp used DAC 3 (Front) */
14746 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14747 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14751 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14753 * Unmute ADC0 and set the default input to mic-in
14755 /* port-A for surround (rear panel) */
14756 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14757 /* port-B for mic-in (rear panel) with vref */
14758 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14759 /* port-C for line-in (rear panel) */
14760 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14761 /* port-D for Front */
14762 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14763 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14764 /* port-E for HP out (front panel) */
14765 /* this has to be set to VREF80 */
14766 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14767 /* route front PCM to HP */
14768 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14769 /* port-F for mic-in (front panel) with vref */
14770 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14771 /* port-G for CLFE (rear panel) */
14772 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14773 /* port-H for side (rear panel) */
14774 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14776 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14777 /* route front mic to ADC1*/
14778 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14779 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14780 /* Unmute DAC0~3 & spdif out*/
14781 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14782 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14783 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14784 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14787 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14788 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14789 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14790 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14791 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14793 /* Unmute Stereo Mixer 15 */
14794 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14795 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14796 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14797 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14799 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14800 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14801 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14802 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14803 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14804 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14805 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14806 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14807 /* hp used DAC 3 (Front) */
14808 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14809 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14813 static struct hda_verb alc861_asus_init_verbs[] = {
14815 * Unmute ADC0 and set the default input to mic-in
14817 /* port-A for surround (rear panel)
14818 * according to codec#0 this is the HP jack
14820 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14821 /* route front PCM to HP */
14822 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14823 /* port-B for mic-in (rear panel) with vref */
14824 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14825 /* port-C for line-in (rear panel) */
14826 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14827 /* port-D for Front */
14828 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14829 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14830 /* port-E for HP out (front panel) */
14831 /* this has to be set to VREF80 */
14832 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14833 /* route front PCM to HP */
14834 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14835 /* port-F for mic-in (front panel) with vref */
14836 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14837 /* port-G for CLFE (rear panel) */
14838 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14839 /* port-H for side (rear panel) */
14840 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14842 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14843 /* route front mic to ADC1*/
14844 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14845 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14846 /* Unmute DAC0~3 & spdif out*/
14847 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14848 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14849 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14850 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14852 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14853 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14854 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14855 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14856 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14858 /* Unmute Stereo Mixer 15 */
14859 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14860 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14861 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14862 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14864 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14865 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14866 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14867 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14868 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14869 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14870 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14871 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14872 /* hp used DAC 3 (Front) */
14873 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14874 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14878 /* additional init verbs for ASUS laptops */
14879 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14880 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14881 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14886 * generic initialization of ADC, input mixers and output mixers
14888 static struct hda_verb alc861_auto_init_verbs[] = {
14890 * Unmute ADC0 and set the default input to mic-in
14892 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14893 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14895 /* Unmute DAC0~3 & spdif out*/
14896 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14897 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14898 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14899 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14902 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14903 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14904 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14905 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14906 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14908 /* Unmute Stereo Mixer 15 */
14909 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14910 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14911 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14912 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14914 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14915 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14916 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14917 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14918 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14919 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14920 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14921 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14923 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14924 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14925 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14926 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14927 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14928 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14929 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14930 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14932 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14937 static struct hda_verb alc861_toshiba_init_verbs[] = {
14938 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14943 /* toggle speaker-output according to the hp-jack state */
14944 static void alc861_toshiba_automute(struct hda_codec *codec)
14946 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14948 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14949 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14950 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14951 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14954 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14957 if ((res >> 26) == ALC880_HP_EVENT)
14958 alc861_toshiba_automute(codec);
14961 /* pcm configuration: identical with ALC880 */
14962 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14963 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14964 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14965 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14968 #define ALC861_DIGOUT_NID 0x07
14970 static struct hda_channel_mode alc861_8ch_modes[1] = {
14974 static hda_nid_t alc861_dac_nids[4] = {
14975 /* front, surround, clfe, side */
14976 0x03, 0x06, 0x05, 0x04
14979 static hda_nid_t alc660_dac_nids[3] = {
14980 /* front, clfe, surround */
14984 static hda_nid_t alc861_adc_nids[1] = {
14989 static struct hda_input_mux alc861_capture_source = {
14993 { "Front Mic", 0x3 },
15000 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15002 struct alc_spec *spec = codec->spec;
15003 hda_nid_t mix, srcs[5];
15006 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15008 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15011 for (i = 0; i < num; i++) {
15013 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15014 if (type != AC_WID_AUD_OUT)
15016 for (j = 0; j < spec->multiout.num_dacs; j++)
15017 if (spec->multiout.dac_nids[j] == srcs[i])
15019 if (j >= spec->multiout.num_dacs)
15025 /* fill in the dac_nids table from the parsed pin configuration */
15026 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15027 const struct auto_pin_cfg *cfg)
15029 struct alc_spec *spec = codec->spec;
15031 hda_nid_t nid, dac;
15033 spec->multiout.dac_nids = spec->private_dac_nids;
15034 for (i = 0; i < cfg->line_outs; i++) {
15035 nid = cfg->line_out_pins[i];
15036 dac = alc861_look_for_dac(codec, nid);
15039 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15044 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15045 hda_nid_t nid, unsigned int chs)
15047 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15048 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15051 /* add playback controls from the parsed DAC table */
15052 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15053 const struct auto_pin_cfg *cfg)
15055 struct alc_spec *spec = codec->spec;
15056 static const char *chname[4] = {
15057 "Front", "Surround", NULL /*CLFE*/, "Side"
15062 if (cfg->line_outs == 1) {
15063 const char *pfx = NULL;
15066 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15069 nid = spec->multiout.dac_nids[0];
15070 return alc861_create_out_sw(codec, pfx, nid, 3);
15074 for (i = 0; i < cfg->line_outs; i++) {
15075 nid = spec->multiout.dac_nids[i];
15080 err = alc861_create_out_sw(codec, "Center", nid, 1);
15083 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15087 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15095 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15097 struct alc_spec *spec = codec->spec;
15104 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15105 nid = alc861_look_for_dac(codec, pin);
15107 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15110 spec->multiout.hp_nid = nid;
15116 /* create playback/capture controls for input pins */
15117 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15118 const struct auto_pin_cfg *cfg)
15120 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15123 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15125 int pin_type, hda_nid_t dac)
15127 hda_nid_t mix, srcs[5];
15130 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15132 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15134 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15136 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15139 for (i = 0; i < num; i++) {
15141 if (srcs[i] == dac || srcs[i] == 0x15)
15142 mute = AMP_IN_UNMUTE(i);
15144 mute = AMP_IN_MUTE(i);
15145 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15150 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15152 struct alc_spec *spec = codec->spec;
15155 for (i = 0; i < spec->autocfg.line_outs; i++) {
15156 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15157 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15159 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15160 spec->multiout.dac_nids[i]);
15164 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15166 struct alc_spec *spec = codec->spec;
15168 if (spec->autocfg.hp_outs)
15169 alc861_auto_set_output_and_unmute(codec,
15170 spec->autocfg.hp_pins[0],
15172 spec->multiout.hp_nid);
15173 if (spec->autocfg.speaker_outs)
15174 alc861_auto_set_output_and_unmute(codec,
15175 spec->autocfg.speaker_pins[0],
15177 spec->multiout.dac_nids[0]);
15180 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15182 struct alc_spec *spec = codec->spec;
15185 for (i = 0; i < AUTO_PIN_LAST; i++) {
15186 hda_nid_t nid = spec->autocfg.input_pins[i];
15187 if (nid >= 0x0c && nid <= 0x11)
15188 alc_set_input_pin(codec, nid, i);
15192 /* parse the BIOS configuration and set up the alc_spec */
15193 /* return 1 if successful, 0 if the proper config is not found,
15194 * or a negative error code
15196 static int alc861_parse_auto_config(struct hda_codec *codec)
15198 struct alc_spec *spec = codec->spec;
15200 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15202 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15206 if (!spec->autocfg.line_outs)
15207 return 0; /* can't find valid BIOS pin config */
15209 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15212 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15215 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15218 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15222 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15224 if (spec->autocfg.dig_outs)
15225 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15227 if (spec->kctls.list)
15228 add_mixer(spec, spec->kctls.list);
15230 add_verb(spec, alc861_auto_init_verbs);
15232 spec->num_mux_defs = 1;
15233 spec->input_mux = &spec->private_imux[0];
15235 spec->adc_nids = alc861_adc_nids;
15236 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15237 set_capture_mixer(codec);
15239 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15244 /* additional initialization for auto-configuration model */
15245 static void alc861_auto_init(struct hda_codec *codec)
15247 struct alc_spec *spec = codec->spec;
15248 alc861_auto_init_multi_out(codec);
15249 alc861_auto_init_hp_out(codec);
15250 alc861_auto_init_analog_input(codec);
15251 if (spec->unsol_event)
15252 alc_inithook(codec);
15255 #ifdef CONFIG_SND_HDA_POWER_SAVE
15256 static struct hda_amp_list alc861_loopbacks[] = {
15257 { 0x15, HDA_INPUT, 0 },
15258 { 0x15, HDA_INPUT, 1 },
15259 { 0x15, HDA_INPUT, 2 },
15260 { 0x15, HDA_INPUT, 3 },
15267 * configuration and preset
15269 static const char *alc861_models[ALC861_MODEL_LAST] = {
15270 [ALC861_3ST] = "3stack",
15271 [ALC660_3ST] = "3stack-660",
15272 [ALC861_3ST_DIG] = "3stack-dig",
15273 [ALC861_6ST_DIG] = "6stack-dig",
15274 [ALC861_UNIWILL_M31] = "uniwill-m31",
15275 [ALC861_TOSHIBA] = "toshiba",
15276 [ALC861_ASUS] = "asus",
15277 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15278 [ALC861_AUTO] = "auto",
15281 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15282 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15283 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15284 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15285 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15286 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15287 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15288 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15289 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15290 * Any other models that need this preset?
15292 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15293 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15294 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15295 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15296 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15297 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15298 /* FIXME: the below seems conflict */
15299 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15300 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15301 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15305 static struct alc_config_preset alc861_presets[] = {
15307 .mixers = { alc861_3ST_mixer },
15308 .init_verbs = { alc861_threestack_init_verbs },
15309 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15310 .dac_nids = alc861_dac_nids,
15311 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15312 .channel_mode = alc861_threestack_modes,
15314 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15315 .adc_nids = alc861_adc_nids,
15316 .input_mux = &alc861_capture_source,
15318 [ALC861_3ST_DIG] = {
15319 .mixers = { alc861_base_mixer },
15320 .init_verbs = { alc861_threestack_init_verbs },
15321 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15322 .dac_nids = alc861_dac_nids,
15323 .dig_out_nid = ALC861_DIGOUT_NID,
15324 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15325 .channel_mode = alc861_threestack_modes,
15327 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15328 .adc_nids = alc861_adc_nids,
15329 .input_mux = &alc861_capture_source,
15331 [ALC861_6ST_DIG] = {
15332 .mixers = { alc861_base_mixer },
15333 .init_verbs = { alc861_base_init_verbs },
15334 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15335 .dac_nids = alc861_dac_nids,
15336 .dig_out_nid = ALC861_DIGOUT_NID,
15337 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15338 .channel_mode = alc861_8ch_modes,
15339 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15340 .adc_nids = alc861_adc_nids,
15341 .input_mux = &alc861_capture_source,
15344 .mixers = { alc861_3ST_mixer },
15345 .init_verbs = { alc861_threestack_init_verbs },
15346 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15347 .dac_nids = alc660_dac_nids,
15348 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15349 .channel_mode = alc861_threestack_modes,
15351 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15352 .adc_nids = alc861_adc_nids,
15353 .input_mux = &alc861_capture_source,
15355 [ALC861_UNIWILL_M31] = {
15356 .mixers = { alc861_uniwill_m31_mixer },
15357 .init_verbs = { alc861_uniwill_m31_init_verbs },
15358 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15359 .dac_nids = alc861_dac_nids,
15360 .dig_out_nid = ALC861_DIGOUT_NID,
15361 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15362 .channel_mode = alc861_uniwill_m31_modes,
15364 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15365 .adc_nids = alc861_adc_nids,
15366 .input_mux = &alc861_capture_source,
15368 [ALC861_TOSHIBA] = {
15369 .mixers = { alc861_toshiba_mixer },
15370 .init_verbs = { alc861_base_init_verbs,
15371 alc861_toshiba_init_verbs },
15372 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15373 .dac_nids = alc861_dac_nids,
15374 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15375 .channel_mode = alc883_3ST_2ch_modes,
15376 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15377 .adc_nids = alc861_adc_nids,
15378 .input_mux = &alc861_capture_source,
15379 .unsol_event = alc861_toshiba_unsol_event,
15380 .init_hook = alc861_toshiba_automute,
15383 .mixers = { alc861_asus_mixer },
15384 .init_verbs = { alc861_asus_init_verbs },
15385 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15386 .dac_nids = alc861_dac_nids,
15387 .dig_out_nid = ALC861_DIGOUT_NID,
15388 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15389 .channel_mode = alc861_asus_modes,
15392 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15393 .adc_nids = alc861_adc_nids,
15394 .input_mux = &alc861_capture_source,
15396 [ALC861_ASUS_LAPTOP] = {
15397 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15398 .init_verbs = { alc861_asus_init_verbs,
15399 alc861_asus_laptop_init_verbs },
15400 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15401 .dac_nids = alc861_dac_nids,
15402 .dig_out_nid = ALC861_DIGOUT_NID,
15403 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15404 .channel_mode = alc883_3ST_2ch_modes,
15406 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15407 .adc_nids = alc861_adc_nids,
15408 .input_mux = &alc861_capture_source,
15412 /* Pin config fixes */
15414 PINFIX_FSC_AMILO_PI1505,
15417 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15418 { 0x0b, 0x0221101f }, /* HP */
15419 { 0x0f, 0x90170310 }, /* speaker */
15423 static const struct alc_fixup alc861_fixups[] = {
15424 [PINFIX_FSC_AMILO_PI1505] = {
15425 .pins = alc861_fsc_amilo_pi1505_pinfix
15429 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15430 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15434 static int patch_alc861(struct hda_codec *codec)
15436 struct alc_spec *spec;
15440 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15444 codec->spec = spec;
15446 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15450 if (board_config < 0) {
15451 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15453 board_config = ALC861_AUTO;
15456 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15458 if (board_config == ALC861_AUTO) {
15459 /* automatic parse from the BIOS config */
15460 err = alc861_parse_auto_config(codec);
15466 "hda_codec: Cannot set up configuration "
15467 "from BIOS. Using base mode...\n");
15468 board_config = ALC861_3ST_DIG;
15472 err = snd_hda_attach_beep_device(codec, 0x23);
15478 if (board_config != ALC861_AUTO)
15479 setup_preset(codec, &alc861_presets[board_config]);
15481 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15482 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15484 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15485 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15487 if (!spec->cap_mixer)
15488 set_capture_mixer(codec);
15489 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15491 spec->vmaster_nid = 0x03;
15493 codec->patch_ops = alc_patch_ops;
15494 if (board_config == ALC861_AUTO) {
15495 spec->init_hook = alc861_auto_init;
15496 #ifdef CONFIG_SND_HDA_POWER_SAVE
15497 spec->power_hook = alc_power_eapd;
15500 #ifdef CONFIG_SND_HDA_POWER_SAVE
15501 if (!spec->loopback.amplist)
15502 spec->loopback.amplist = alc861_loopbacks;
15509 * ALC861-VD support
15513 * In addition, an independent DAC
15515 #define ALC861VD_DIGOUT_NID 0x06
15517 static hda_nid_t alc861vd_dac_nids[4] = {
15518 /* front, surr, clfe, side surr */
15519 0x02, 0x03, 0x04, 0x05
15522 /* dac_nids for ALC660vd are in a different order - according to
15523 * Realtek's driver.
15524 * This should probably result in a different mixer for 6stack models
15525 * of ALC660vd codecs, but for now there is only 3stack mixer
15526 * - and it is the same as in 861vd.
15527 * adc_nids in ALC660vd are (is) the same as in 861vd
15529 static hda_nid_t alc660vd_dac_nids[3] = {
15530 /* front, rear, clfe, rear_surr */
15534 static hda_nid_t alc861vd_adc_nids[1] = {
15539 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15542 /* FIXME: should be a matrix-type input source selection */
15543 static struct hda_input_mux alc861vd_capture_source = {
15547 { "Front Mic", 0x1 },
15553 static struct hda_input_mux alc861vd_dallas_capture_source = {
15556 { "Ext Mic", 0x0 },
15557 { "Int Mic", 0x1 },
15561 static struct hda_input_mux alc861vd_hp_capture_source = {
15564 { "Front Mic", 0x0 },
15565 { "ATAPI Mic", 0x1 },
15572 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15579 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15580 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15581 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15582 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15583 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15590 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15591 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15592 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15593 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15594 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15598 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15599 { 6, alc861vd_6stack_ch6_init },
15600 { 8, alc861vd_6stack_ch8_init },
15603 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15605 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15606 .name = "Channel Mode",
15607 .info = alc_ch_mode_info,
15608 .get = alc_ch_mode_get,
15609 .put = alc_ch_mode_put,
15614 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15615 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15617 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15618 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15619 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15621 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15622 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15624 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15626 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15628 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15629 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15631 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15632 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15636 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15640 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15641 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15642 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15644 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15645 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15647 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15648 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15653 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15654 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15655 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15659 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15660 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15661 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15663 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15664 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15665 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15667 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15668 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15670 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15671 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15676 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15677 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15678 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15679 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15684 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15685 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15687 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15688 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15689 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15691 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15692 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15697 /* Pin assignment: Speaker=0x14, HP = 0x15,
15698 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15700 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15701 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15702 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15703 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15704 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15705 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15706 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15707 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15708 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15709 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15710 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15714 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15715 * Front Mic=0x18, ATAPI Mic = 0x19,
15717 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15718 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15719 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15720 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15721 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15722 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15723 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15724 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15725 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15731 * generic initialization of ADC, input mixers and output mixers
15733 static struct hda_verb alc861vd_volume_init_verbs[] = {
15735 * Unmute ADC0 and set the default input to mic-in
15737 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15738 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15740 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15741 * the analog-loopback mixer widget
15743 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15744 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15745 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15746 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15747 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15748 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15750 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15751 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15752 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15753 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15754 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15757 * Set up output mixers (0x02 - 0x05)
15759 /* set vol=0 to output mixers */
15760 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15761 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15762 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15763 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15765 /* set up input amps for analog loopback */
15766 /* Amp Indices: DAC = 0, mixer = 1 */
15767 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15768 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15769 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15770 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15771 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15772 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15773 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15774 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15780 * 3-stack pin configuration:
15781 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15783 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15785 * Set pin mode and muting
15787 /* set front pin widgets 0x14 for output */
15788 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15789 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15790 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15792 /* Mic (rear) pin: input vref at 80% */
15793 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15794 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15795 /* Front Mic pin: input vref at 80% */
15796 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15797 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15798 /* Line In pin: input */
15799 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15800 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15801 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15802 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15803 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15804 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15805 /* CD pin widget for input */
15806 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15812 * 6-stack pin configuration:
15814 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15816 * Set pin mode and muting
15818 /* set front pin widgets 0x14 for output */
15819 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15820 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15821 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15823 /* Rear Pin: output 1 (0x0d) */
15824 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15825 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15826 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15827 /* CLFE Pin: output 2 (0x0e) */
15828 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15829 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15830 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15831 /* Side Pin: output 3 (0x0f) */
15832 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15833 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15834 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15836 /* Mic (rear) pin: input vref at 80% */
15837 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15838 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15839 /* Front Mic pin: input vref at 80% */
15840 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15841 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15842 /* Line In pin: input */
15843 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15844 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15845 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15846 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15847 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15848 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15849 /* CD pin widget for input */
15850 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15855 static struct hda_verb alc861vd_eapd_verbs[] = {
15856 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15860 static struct hda_verb alc660vd_eapd_verbs[] = {
15861 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15862 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15866 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15867 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15868 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15869 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15870 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15871 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15875 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15877 unsigned int present;
15878 unsigned char bits;
15880 present = snd_hda_jack_detect(codec, 0x18);
15881 bits = present ? HDA_AMP_MUTE : 0;
15883 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15884 HDA_AMP_MUTE, bits);
15887 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15889 struct alc_spec *spec = codec->spec;
15890 spec->autocfg.hp_pins[0] = 0x1b;
15891 spec->autocfg.speaker_pins[0] = 0x14;
15894 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15896 alc_automute_amp(codec);
15897 alc861vd_lenovo_mic_automute(codec);
15900 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15903 switch (res >> 26) {
15904 case ALC880_MIC_EVENT:
15905 alc861vd_lenovo_mic_automute(codec);
15908 alc_automute_amp_unsol_event(codec, res);
15913 static struct hda_verb alc861vd_dallas_verbs[] = {
15914 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15915 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15916 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15917 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15920 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15921 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15922 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15923 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15924 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15925 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15926 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15928 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15929 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15930 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15932 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15933 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15934 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15935 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15937 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15938 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15939 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15940 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15941 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15942 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15943 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15944 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15946 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15947 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15948 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15949 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15951 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15952 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15953 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15958 /* toggle speaker-output according to the hp-jack state */
15959 static void alc861vd_dallas_setup(struct hda_codec *codec)
15961 struct alc_spec *spec = codec->spec;
15963 spec->autocfg.hp_pins[0] = 0x15;
15964 spec->autocfg.speaker_pins[0] = 0x14;
15967 #ifdef CONFIG_SND_HDA_POWER_SAVE
15968 #define alc861vd_loopbacks alc880_loopbacks
15971 /* pcm configuration: identical with ALC880 */
15972 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15973 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15974 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15975 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15978 * configuration and preset
15980 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15981 [ALC660VD_3ST] = "3stack-660",
15982 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15983 [ALC660VD_ASUS_V1S] = "asus-v1s",
15984 [ALC861VD_3ST] = "3stack",
15985 [ALC861VD_3ST_DIG] = "3stack-digout",
15986 [ALC861VD_6ST_DIG] = "6stack-digout",
15987 [ALC861VD_LENOVO] = "lenovo",
15988 [ALC861VD_DALLAS] = "dallas",
15989 [ALC861VD_HP] = "hp",
15990 [ALC861VD_AUTO] = "auto",
15993 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15994 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15995 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15996 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15997 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15998 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15999 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16000 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16001 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16002 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16003 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16004 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16005 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16006 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16007 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16008 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16012 static struct alc_config_preset alc861vd_presets[] = {
16014 .mixers = { alc861vd_3st_mixer },
16015 .init_verbs = { alc861vd_volume_init_verbs,
16016 alc861vd_3stack_init_verbs },
16017 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16018 .dac_nids = alc660vd_dac_nids,
16019 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16020 .channel_mode = alc861vd_3stack_2ch_modes,
16021 .input_mux = &alc861vd_capture_source,
16023 [ALC660VD_3ST_DIG] = {
16024 .mixers = { alc861vd_3st_mixer },
16025 .init_verbs = { alc861vd_volume_init_verbs,
16026 alc861vd_3stack_init_verbs },
16027 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16028 .dac_nids = alc660vd_dac_nids,
16029 .dig_out_nid = ALC861VD_DIGOUT_NID,
16030 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16031 .channel_mode = alc861vd_3stack_2ch_modes,
16032 .input_mux = &alc861vd_capture_source,
16035 .mixers = { alc861vd_3st_mixer },
16036 .init_verbs = { alc861vd_volume_init_verbs,
16037 alc861vd_3stack_init_verbs },
16038 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16039 .dac_nids = alc861vd_dac_nids,
16040 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16041 .channel_mode = alc861vd_3stack_2ch_modes,
16042 .input_mux = &alc861vd_capture_source,
16044 [ALC861VD_3ST_DIG] = {
16045 .mixers = { alc861vd_3st_mixer },
16046 .init_verbs = { alc861vd_volume_init_verbs,
16047 alc861vd_3stack_init_verbs },
16048 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16049 .dac_nids = alc861vd_dac_nids,
16050 .dig_out_nid = ALC861VD_DIGOUT_NID,
16051 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16052 .channel_mode = alc861vd_3stack_2ch_modes,
16053 .input_mux = &alc861vd_capture_source,
16055 [ALC861VD_6ST_DIG] = {
16056 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16057 .init_verbs = { alc861vd_volume_init_verbs,
16058 alc861vd_6stack_init_verbs },
16059 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16060 .dac_nids = alc861vd_dac_nids,
16061 .dig_out_nid = ALC861VD_DIGOUT_NID,
16062 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16063 .channel_mode = alc861vd_6stack_modes,
16064 .input_mux = &alc861vd_capture_source,
16066 [ALC861VD_LENOVO] = {
16067 .mixers = { alc861vd_lenovo_mixer },
16068 .init_verbs = { alc861vd_volume_init_verbs,
16069 alc861vd_3stack_init_verbs,
16070 alc861vd_eapd_verbs,
16071 alc861vd_lenovo_unsol_verbs },
16072 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16073 .dac_nids = alc660vd_dac_nids,
16074 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16075 .channel_mode = alc861vd_3stack_2ch_modes,
16076 .input_mux = &alc861vd_capture_source,
16077 .unsol_event = alc861vd_lenovo_unsol_event,
16078 .setup = alc861vd_lenovo_setup,
16079 .init_hook = alc861vd_lenovo_init_hook,
16081 [ALC861VD_DALLAS] = {
16082 .mixers = { alc861vd_dallas_mixer },
16083 .init_verbs = { alc861vd_dallas_verbs },
16084 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16085 .dac_nids = alc861vd_dac_nids,
16086 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16087 .channel_mode = alc861vd_3stack_2ch_modes,
16088 .input_mux = &alc861vd_dallas_capture_source,
16089 .unsol_event = alc_automute_amp_unsol_event,
16090 .setup = alc861vd_dallas_setup,
16091 .init_hook = alc_automute_amp,
16094 .mixers = { alc861vd_hp_mixer },
16095 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16096 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16097 .dac_nids = alc861vd_dac_nids,
16098 .dig_out_nid = ALC861VD_DIGOUT_NID,
16099 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16100 .channel_mode = alc861vd_3stack_2ch_modes,
16101 .input_mux = &alc861vd_hp_capture_source,
16102 .unsol_event = alc_automute_amp_unsol_event,
16103 .setup = alc861vd_dallas_setup,
16104 .init_hook = alc_automute_amp,
16106 [ALC660VD_ASUS_V1S] = {
16107 .mixers = { alc861vd_lenovo_mixer },
16108 .init_verbs = { alc861vd_volume_init_verbs,
16109 alc861vd_3stack_init_verbs,
16110 alc861vd_eapd_verbs,
16111 alc861vd_lenovo_unsol_verbs },
16112 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16113 .dac_nids = alc660vd_dac_nids,
16114 .dig_out_nid = ALC861VD_DIGOUT_NID,
16115 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16116 .channel_mode = alc861vd_3stack_2ch_modes,
16117 .input_mux = &alc861vd_capture_source,
16118 .unsol_event = alc861vd_lenovo_unsol_event,
16119 .setup = alc861vd_lenovo_setup,
16120 .init_hook = alc861vd_lenovo_init_hook,
16125 * BIOS auto configuration
16127 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16128 const struct auto_pin_cfg *cfg)
16130 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16134 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16135 hda_nid_t nid, int pin_type, int dac_idx)
16137 alc_set_pin_output(codec, nid, pin_type);
16140 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16142 struct alc_spec *spec = codec->spec;
16145 for (i = 0; i <= HDA_SIDE; i++) {
16146 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16147 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16149 alc861vd_auto_set_output_and_unmute(codec, nid,
16155 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16157 struct alc_spec *spec = codec->spec;
16160 pin = spec->autocfg.hp_pins[0];
16161 if (pin) /* connect to front and use dac 0 */
16162 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16163 pin = spec->autocfg.speaker_pins[0];
16165 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16168 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16170 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16172 struct alc_spec *spec = codec->spec;
16175 for (i = 0; i < AUTO_PIN_LAST; i++) {
16176 hda_nid_t nid = spec->autocfg.input_pins[i];
16177 if (alc_is_input_pin(codec, nid)) {
16178 alc_set_input_pin(codec, nid, i);
16179 if (nid != ALC861VD_PIN_CD_NID &&
16180 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16181 snd_hda_codec_write(codec, nid, 0,
16182 AC_VERB_SET_AMP_GAIN_MUTE,
16188 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16190 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16191 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16193 /* add playback controls from the parsed DAC table */
16194 /* Based on ALC880 version. But ALC861VD has separate,
16195 * different NIDs for mute/unmute switch and volume control */
16196 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16197 const struct auto_pin_cfg *cfg)
16199 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16200 hda_nid_t nid_v, nid_s;
16203 for (i = 0; i < cfg->line_outs; i++) {
16204 if (!spec->multiout.dac_nids[i])
16206 nid_v = alc861vd_idx_to_mixer_vol(
16208 spec->multiout.dac_nids[i]));
16209 nid_s = alc861vd_idx_to_mixer_switch(
16211 spec->multiout.dac_nids[i]));
16215 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16217 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16221 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16223 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16227 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16229 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16233 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16235 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16241 if (cfg->line_outs == 1 &&
16242 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16249 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16250 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16254 if (cfg->line_outs == 1 &&
16255 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16257 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16258 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16267 /* add playback controls for speaker and HP outputs */
16268 /* Based on ALC880 version. But ALC861VD has separate,
16269 * different NIDs for mute/unmute switch and volume control */
16270 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16271 hda_nid_t pin, const char *pfx)
16273 hda_nid_t nid_v, nid_s;
16279 if (alc880_is_fixed_pin(pin)) {
16280 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16281 /* specify the DAC as the extra output */
16282 if (!spec->multiout.hp_nid)
16283 spec->multiout.hp_nid = nid_v;
16285 spec->multiout.extra_out_nid[0] = nid_v;
16286 /* control HP volume/switch on the output mixer amp */
16287 nid_v = alc861vd_idx_to_mixer_vol(
16288 alc880_fixed_pin_idx(pin));
16289 nid_s = alc861vd_idx_to_mixer_switch(
16290 alc880_fixed_pin_idx(pin));
16292 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16293 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16296 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16297 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16300 } else if (alc880_is_multi_pin(pin)) {
16301 /* set manual connection */
16302 /* we have only a switch on HP-out PIN */
16303 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16304 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16311 /* parse the BIOS configuration and set up the alc_spec
16312 * return 1 if successful, 0 if the proper config is not found,
16313 * or a negative error code
16314 * Based on ALC880 version - had to change it to override
16315 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16316 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16318 struct alc_spec *spec = codec->spec;
16320 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16322 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16326 if (!spec->autocfg.line_outs)
16327 return 0; /* can't find valid BIOS pin config */
16329 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16332 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16335 err = alc861vd_auto_create_extra_out(spec,
16336 spec->autocfg.speaker_pins[0],
16340 err = alc861vd_auto_create_extra_out(spec,
16341 spec->autocfg.hp_pins[0],
16345 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16349 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16351 if (spec->autocfg.dig_outs)
16352 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16354 if (spec->kctls.list)
16355 add_mixer(spec, spec->kctls.list);
16357 add_verb(spec, alc861vd_volume_init_verbs);
16359 spec->num_mux_defs = 1;
16360 spec->input_mux = &spec->private_imux[0];
16362 err = alc_auto_add_mic_boost(codec);
16366 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16371 /* additional initialization for auto-configuration model */
16372 static void alc861vd_auto_init(struct hda_codec *codec)
16374 struct alc_spec *spec = codec->spec;
16375 alc861vd_auto_init_multi_out(codec);
16376 alc861vd_auto_init_hp_out(codec);
16377 alc861vd_auto_init_analog_input(codec);
16378 alc861vd_auto_init_input_src(codec);
16379 if (spec->unsol_event)
16380 alc_inithook(codec);
16384 ALC660VD_FIX_ASUS_GPIO1
16388 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16389 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16390 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16391 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16395 static const struct alc_fixup alc861vd_fixups[] = {
16396 [ALC660VD_FIX_ASUS_GPIO1] = {
16397 .verbs = alc660vd_fix_asus_gpio1_verbs,
16401 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16402 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16406 static int patch_alc861vd(struct hda_codec *codec)
16408 struct alc_spec *spec;
16409 int err, board_config;
16411 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16415 codec->spec = spec;
16417 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16421 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16422 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16424 board_config = ALC861VD_AUTO;
16427 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16429 if (board_config == ALC861VD_AUTO) {
16430 /* automatic parse from the BIOS config */
16431 err = alc861vd_parse_auto_config(codec);
16437 "hda_codec: Cannot set up configuration "
16438 "from BIOS. Using base mode...\n");
16439 board_config = ALC861VD_3ST;
16443 err = snd_hda_attach_beep_device(codec, 0x23);
16449 if (board_config != ALC861VD_AUTO)
16450 setup_preset(codec, &alc861vd_presets[board_config]);
16452 if (codec->vendor_id == 0x10ec0660) {
16453 /* always turn on EAPD */
16454 add_verb(spec, alc660vd_eapd_verbs);
16457 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16458 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16460 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16461 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16463 if (!spec->adc_nids) {
16464 spec->adc_nids = alc861vd_adc_nids;
16465 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16467 if (!spec->capsrc_nids)
16468 spec->capsrc_nids = alc861vd_capsrc_nids;
16470 set_capture_mixer(codec);
16471 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16473 spec->vmaster_nid = 0x02;
16475 codec->patch_ops = alc_patch_ops;
16477 if (board_config == ALC861VD_AUTO)
16478 spec->init_hook = alc861vd_auto_init;
16479 #ifdef CONFIG_SND_HDA_POWER_SAVE
16480 if (!spec->loopback.amplist)
16481 spec->loopback.amplist = alc861vd_loopbacks;
16490 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16491 * configuration. Each pin widget can choose any input DACs and a mixer.
16492 * Each ADC is connected from a mixer of all inputs. This makes possible
16493 * 6-channel independent captures.
16495 * In addition, an independent DAC for the multi-playback (not used in this
16498 #define ALC662_DIGOUT_NID 0x06
16499 #define ALC662_DIGIN_NID 0x0a
16501 static hda_nid_t alc662_dac_nids[4] = {
16502 /* front, rear, clfe, rear_surr */
16506 static hda_nid_t alc272_dac_nids[2] = {
16510 static hda_nid_t alc662_adc_nids[2] = {
16515 static hda_nid_t alc272_adc_nids[1] = {
16520 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16521 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16525 /* FIXME: should be a matrix-type input source selection */
16526 static struct hda_input_mux alc662_capture_source = {
16530 { "Front Mic", 0x1 },
16536 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16544 static struct hda_input_mux alc663_capture_source = {
16548 { "Front Mic", 0x1 },
16553 #if 0 /* set to 1 for testing other input sources below */
16554 static struct hda_input_mux alc272_nc10_capture_source = {
16557 { "Autoselect Mic", 0x0 },
16558 { "Internal Mic", 0x1 },
16559 { "In-0x02", 0x2 },
16560 { "In-0x03", 0x3 },
16561 { "In-0x04", 0x4 },
16562 { "In-0x05", 0x5 },
16563 { "In-0x06", 0x6 },
16564 { "In-0x07", 0x7 },
16565 { "In-0x08", 0x8 },
16566 { "In-0x09", 0x9 },
16567 { "In-0x0a", 0x0a },
16568 { "In-0x0b", 0x0b },
16569 { "In-0x0c", 0x0c },
16570 { "In-0x0d", 0x0d },
16571 { "In-0x0e", 0x0e },
16572 { "In-0x0f", 0x0f },
16580 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16587 static struct hda_verb alc662_3ST_ch2_init[] = {
16588 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16589 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16590 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16591 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16598 static struct hda_verb alc662_3ST_ch6_init[] = {
16599 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16600 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16601 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16602 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16603 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16604 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16608 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16609 { 2, alc662_3ST_ch2_init },
16610 { 6, alc662_3ST_ch6_init },
16616 static struct hda_verb alc662_sixstack_ch6_init[] = {
16617 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16618 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16619 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16626 static struct hda_verb alc662_sixstack_ch8_init[] = {
16627 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16628 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16629 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16633 static struct hda_channel_mode alc662_5stack_modes[2] = {
16634 { 2, alc662_sixstack_ch6_init },
16635 { 6, alc662_sixstack_ch8_init },
16638 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16639 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16642 static struct snd_kcontrol_new alc662_base_mixer[] = {
16643 /* output mixer control */
16644 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16645 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16646 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16647 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16648 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16649 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16650 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16651 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16654 /*Input mixer control */
16655 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16656 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16657 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16658 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16659 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16660 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16661 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16662 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16666 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16667 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16668 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16670 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16671 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16672 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16673 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16674 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16675 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16676 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16677 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16681 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16682 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16683 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16684 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16685 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16686 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16687 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16688 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16689 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16691 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16692 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16693 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16694 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16697 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16698 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16702 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16703 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16704 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16705 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16706 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16707 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16708 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16709 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16710 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16711 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16715 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16716 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16717 ALC262_HIPPO_MASTER_SWITCH,
16719 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16720 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16721 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16723 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16724 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16725 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16729 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16730 ALC262_HIPPO_MASTER_SWITCH,
16731 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16732 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16733 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16734 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16735 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16736 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16737 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16739 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16743 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16744 .ops = &snd_hda_bind_vol,
16746 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16747 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16752 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16753 .ops = &snd_hda_bind_sw,
16755 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16756 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16761 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16762 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16763 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16765 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16769 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16770 .ops = &snd_hda_bind_sw,
16772 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16773 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16774 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16779 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16780 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16781 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16783 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16784 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16785 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16790 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16791 .ops = &snd_hda_bind_sw,
16793 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16794 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16795 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16800 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16801 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16802 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16805 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16806 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16810 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16811 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16812 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16816 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16817 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16821 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16822 .ops = &snd_hda_bind_vol,
16824 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16825 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16830 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16831 .ops = &snd_hda_bind_sw,
16833 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16834 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16839 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16840 HDA_BIND_VOL("Master Playback Volume",
16841 &alc663_asus_two_bind_master_vol),
16842 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16843 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16850 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16851 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16852 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16853 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16856 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16860 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16861 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16862 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16863 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16864 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16865 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16869 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16870 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16874 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16875 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16876 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16881 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16882 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16883 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16884 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16888 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16889 .ops = &snd_hda_bind_sw,
16891 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16892 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16893 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16894 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16895 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16900 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16901 .ops = &snd_hda_bind_sw,
16903 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16904 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16909 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16910 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16911 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16912 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16913 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16914 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16915 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16916 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16922 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16923 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16924 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16925 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16926 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16927 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16934 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16937 .name = "Channel Mode",
16938 .info = alc_ch_mode_info,
16939 .get = alc_ch_mode_get,
16940 .put = alc_ch_mode_put,
16945 static struct hda_verb alc662_init_verbs[] = {
16946 /* ADC: mute amp left and right */
16947 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16948 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16953 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16954 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16957 /* Front Pin: output 0 (0x0c) */
16958 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16959 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16961 /* Rear Pin: output 1 (0x0d) */
16962 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16963 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16965 /* CLFE Pin: output 2 (0x0e) */
16966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16967 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16969 /* Mic (rear) pin: input vref at 80% */
16970 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16971 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16972 /* Front Mic pin: input vref at 80% */
16973 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16975 /* Line In pin: input */
16976 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16977 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16978 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16979 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16980 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16981 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16982 /* CD pin widget for input */
16983 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16985 /* FIXME: use matrix-type input source selection */
16986 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16989 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16991 /* always trun on EAPD */
16992 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16993 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16998 static struct hda_verb alc663_init_verbs[] = {
16999 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17000 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17001 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17002 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17003 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17004 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17008 static struct hda_verb alc272_init_verbs[] = {
17009 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17010 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17011 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17012 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17013 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17014 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17016 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17020 static struct hda_verb alc662_sue_init_verbs[] = {
17021 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17022 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17026 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17027 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17028 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17032 /* Set Unsolicited Event*/
17033 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17034 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17035 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17039 static struct hda_verb alc663_m51va_init_verbs[] = {
17040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17041 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17042 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17043 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17044 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17045 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17046 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17047 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17048 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17052 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17053 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17054 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17055 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17058 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17059 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17063 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17064 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17065 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17066 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17067 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17070 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17071 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17075 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17076 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17078 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17081 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17082 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17086 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17087 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17088 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17089 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17090 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17091 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17093 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17095 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17096 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17097 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17098 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17102 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17103 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17104 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17105 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17106 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17107 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17109 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17112 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17113 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17114 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17118 static struct hda_verb alc663_g71v_init_verbs[] = {
17119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17120 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17121 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17123 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17124 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17125 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17127 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17128 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17129 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17133 static struct hda_verb alc663_g50v_init_verbs[] = {
17134 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17135 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17136 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17138 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17139 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17143 static struct hda_verb alc662_ecs_init_verbs[] = {
17144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17145 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17146 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17147 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17151 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17152 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17153 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17154 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17155 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17156 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17157 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17158 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17159 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17160 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17161 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17162 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17166 static struct hda_verb alc272_dell_init_verbs[] = {
17167 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17168 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17170 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17171 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17172 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17173 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17176 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17177 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17181 static struct hda_verb alc663_mode7_init_verbs[] = {
17182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17183 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17184 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17185 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17186 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17187 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17188 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17189 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17190 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17191 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17194 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17195 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17196 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17200 static struct hda_verb alc663_mode8_init_verbs[] = {
17201 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17202 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17204 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17205 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17206 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17207 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17208 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17209 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17210 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17211 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17212 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17213 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17214 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17215 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17216 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17220 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17221 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17222 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17226 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17227 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17228 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17232 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17234 unsigned int present;
17235 unsigned char bits;
17237 present = snd_hda_jack_detect(codec, 0x14);
17238 bits = present ? HDA_AMP_MUTE : 0;
17240 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17241 HDA_AMP_MUTE, bits);
17244 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17246 unsigned int present;
17247 unsigned char bits;
17249 present = snd_hda_jack_detect(codec, 0x1b);
17250 bits = present ? HDA_AMP_MUTE : 0;
17252 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17253 HDA_AMP_MUTE, bits);
17254 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17255 HDA_AMP_MUTE, bits);
17258 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17261 if ((res >> 26) == ALC880_HP_EVENT)
17262 alc662_lenovo_101e_all_automute(codec);
17263 if ((res >> 26) == ALC880_FRONT_EVENT)
17264 alc662_lenovo_101e_ispeaker_automute(codec);
17267 /* unsolicited event for HP jack sensing */
17268 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17271 if ((res >> 26) == ALC880_MIC_EVENT)
17272 alc_mic_automute(codec);
17274 alc262_hippo_unsol_event(codec, res);
17277 static void alc662_eeepc_setup(struct hda_codec *codec)
17279 struct alc_spec *spec = codec->spec;
17281 alc262_hippo1_setup(codec);
17282 spec->ext_mic.pin = 0x18;
17283 spec->ext_mic.mux_idx = 0;
17284 spec->int_mic.pin = 0x19;
17285 spec->int_mic.mux_idx = 1;
17286 spec->auto_mic = 1;
17289 static void alc662_eeepc_inithook(struct hda_codec *codec)
17291 alc262_hippo_automute(codec);
17292 alc_mic_automute(codec);
17295 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17297 struct alc_spec *spec = codec->spec;
17299 spec->autocfg.hp_pins[0] = 0x14;
17300 spec->autocfg.speaker_pins[0] = 0x1b;
17303 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17305 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17307 unsigned int present;
17308 unsigned char bits;
17310 present = snd_hda_jack_detect(codec, 0x21);
17311 bits = present ? HDA_AMP_MUTE : 0;
17312 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17313 HDA_AMP_MUTE, bits);
17314 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17315 HDA_AMP_MUTE, bits);
17318 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17320 unsigned int present;
17321 unsigned char bits;
17323 present = snd_hda_jack_detect(codec, 0x21);
17324 bits = present ? HDA_AMP_MUTE : 0;
17325 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17326 HDA_AMP_MUTE, bits);
17327 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17328 HDA_AMP_MUTE, bits);
17329 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17330 HDA_AMP_MUTE, bits);
17331 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17332 HDA_AMP_MUTE, bits);
17335 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17337 unsigned int present;
17338 unsigned char bits;
17340 present = snd_hda_jack_detect(codec, 0x15);
17341 bits = present ? HDA_AMP_MUTE : 0;
17342 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17343 HDA_AMP_MUTE, bits);
17344 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17345 HDA_AMP_MUTE, bits);
17346 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17347 HDA_AMP_MUTE, bits);
17348 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17349 HDA_AMP_MUTE, bits);
17352 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17354 unsigned int present;
17355 unsigned char bits;
17357 present = snd_hda_jack_detect(codec, 0x1b);
17358 bits = present ? 0 : PIN_OUT;
17359 snd_hda_codec_write(codec, 0x14, 0,
17360 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17363 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17365 unsigned int present1, present2;
17367 present1 = snd_hda_jack_detect(codec, 0x21);
17368 present2 = snd_hda_jack_detect(codec, 0x15);
17370 if (present1 || present2) {
17371 snd_hda_codec_write_cache(codec, 0x14, 0,
17372 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17374 snd_hda_codec_write_cache(codec, 0x14, 0,
17375 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17379 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17381 unsigned int present1, present2;
17383 present1 = snd_hda_jack_detect(codec, 0x1b);
17384 present2 = snd_hda_jack_detect(codec, 0x15);
17386 if (present1 || present2) {
17387 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17388 HDA_AMP_MUTE, HDA_AMP_MUTE);
17389 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17390 HDA_AMP_MUTE, HDA_AMP_MUTE);
17392 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17394 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17399 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17401 unsigned int present1, present2;
17403 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17404 AC_VERB_GET_PIN_SENSE, 0)
17405 & AC_PINSENSE_PRESENCE;
17406 present2 = snd_hda_codec_read(codec, 0x21, 0,
17407 AC_VERB_GET_PIN_SENSE, 0)
17408 & AC_PINSENSE_PRESENCE;
17410 if (present1 || present2) {
17411 snd_hda_codec_write_cache(codec, 0x14, 0,
17412 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17413 snd_hda_codec_write_cache(codec, 0x17, 0,
17414 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17416 snd_hda_codec_write_cache(codec, 0x14, 0,
17417 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17418 snd_hda_codec_write_cache(codec, 0x17, 0,
17419 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17423 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17425 unsigned int present1, present2;
17427 present1 = snd_hda_codec_read(codec, 0x21, 0,
17428 AC_VERB_GET_PIN_SENSE, 0)
17429 & AC_PINSENSE_PRESENCE;
17430 present2 = snd_hda_codec_read(codec, 0x15, 0,
17431 AC_VERB_GET_PIN_SENSE, 0)
17432 & AC_PINSENSE_PRESENCE;
17434 if (present1 || present2) {
17435 snd_hda_codec_write_cache(codec, 0x14, 0,
17436 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17437 snd_hda_codec_write_cache(codec, 0x17, 0,
17438 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17440 snd_hda_codec_write_cache(codec, 0x14, 0,
17441 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17442 snd_hda_codec_write_cache(codec, 0x17, 0,
17443 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17447 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17450 switch (res >> 26) {
17451 case ALC880_HP_EVENT:
17452 alc663_m51va_speaker_automute(codec);
17454 case ALC880_MIC_EVENT:
17455 alc_mic_automute(codec);
17460 static void alc663_m51va_setup(struct hda_codec *codec)
17462 struct alc_spec *spec = codec->spec;
17463 spec->ext_mic.pin = 0x18;
17464 spec->ext_mic.mux_idx = 0;
17465 spec->int_mic.pin = 0x12;
17466 spec->int_mic.mux_idx = 9;
17467 spec->auto_mic = 1;
17470 static void alc663_m51va_inithook(struct hda_codec *codec)
17472 alc663_m51va_speaker_automute(codec);
17473 alc_mic_automute(codec);
17476 /* ***************** Mode1 ******************************/
17477 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17479 static void alc663_mode1_setup(struct hda_codec *codec)
17481 struct alc_spec *spec = codec->spec;
17482 spec->ext_mic.pin = 0x18;
17483 spec->ext_mic.mux_idx = 0;
17484 spec->int_mic.pin = 0x19;
17485 spec->int_mic.mux_idx = 1;
17486 spec->auto_mic = 1;
17489 #define alc663_mode1_inithook alc663_m51va_inithook
17491 /* ***************** Mode2 ******************************/
17492 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17495 switch (res >> 26) {
17496 case ALC880_HP_EVENT:
17497 alc662_f5z_speaker_automute(codec);
17499 case ALC880_MIC_EVENT:
17500 alc_mic_automute(codec);
17505 #define alc662_mode2_setup alc663_mode1_setup
17507 static void alc662_mode2_inithook(struct hda_codec *codec)
17509 alc662_f5z_speaker_automute(codec);
17510 alc_mic_automute(codec);
17512 /* ***************** Mode3 ******************************/
17513 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17516 switch (res >> 26) {
17517 case ALC880_HP_EVENT:
17518 alc663_two_hp_m1_speaker_automute(codec);
17520 case ALC880_MIC_EVENT:
17521 alc_mic_automute(codec);
17526 #define alc663_mode3_setup alc663_mode1_setup
17528 static void alc663_mode3_inithook(struct hda_codec *codec)
17530 alc663_two_hp_m1_speaker_automute(codec);
17531 alc_mic_automute(codec);
17533 /* ***************** Mode4 ******************************/
17534 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17537 switch (res >> 26) {
17538 case ALC880_HP_EVENT:
17539 alc663_21jd_two_speaker_automute(codec);
17541 case ALC880_MIC_EVENT:
17542 alc_mic_automute(codec);
17547 #define alc663_mode4_setup alc663_mode1_setup
17549 static void alc663_mode4_inithook(struct hda_codec *codec)
17551 alc663_21jd_two_speaker_automute(codec);
17552 alc_mic_automute(codec);
17554 /* ***************** Mode5 ******************************/
17555 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17558 switch (res >> 26) {
17559 case ALC880_HP_EVENT:
17560 alc663_15jd_two_speaker_automute(codec);
17562 case ALC880_MIC_EVENT:
17563 alc_mic_automute(codec);
17568 #define alc663_mode5_setup alc663_mode1_setup
17570 static void alc663_mode5_inithook(struct hda_codec *codec)
17572 alc663_15jd_two_speaker_automute(codec);
17573 alc_mic_automute(codec);
17575 /* ***************** Mode6 ******************************/
17576 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17579 switch (res >> 26) {
17580 case ALC880_HP_EVENT:
17581 alc663_two_hp_m2_speaker_automute(codec);
17583 case ALC880_MIC_EVENT:
17584 alc_mic_automute(codec);
17589 #define alc663_mode6_setup alc663_mode1_setup
17591 static void alc663_mode6_inithook(struct hda_codec *codec)
17593 alc663_two_hp_m2_speaker_automute(codec);
17594 alc_mic_automute(codec);
17597 /* ***************** Mode7 ******************************/
17598 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17601 switch (res >> 26) {
17602 case ALC880_HP_EVENT:
17603 alc663_two_hp_m7_speaker_automute(codec);
17605 case ALC880_MIC_EVENT:
17606 alc_mic_automute(codec);
17611 #define alc663_mode7_setup alc663_mode1_setup
17613 static void alc663_mode7_inithook(struct hda_codec *codec)
17615 alc663_two_hp_m7_speaker_automute(codec);
17616 alc_mic_automute(codec);
17619 /* ***************** Mode8 ******************************/
17620 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17623 switch (res >> 26) {
17624 case ALC880_HP_EVENT:
17625 alc663_two_hp_m8_speaker_automute(codec);
17627 case ALC880_MIC_EVENT:
17628 alc_mic_automute(codec);
17633 #define alc663_mode8_setup alc663_m51va_setup
17635 static void alc663_mode8_inithook(struct hda_codec *codec)
17637 alc663_two_hp_m8_speaker_automute(codec);
17638 alc_mic_automute(codec);
17641 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17643 unsigned int present;
17644 unsigned char bits;
17646 present = snd_hda_jack_detect(codec, 0x21);
17647 bits = present ? HDA_AMP_MUTE : 0;
17648 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17649 HDA_AMP_MUTE, bits);
17650 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17651 HDA_AMP_MUTE, bits);
17654 static void alc663_g71v_front_automute(struct hda_codec *codec)
17656 unsigned int present;
17657 unsigned char bits;
17659 present = snd_hda_jack_detect(codec, 0x15);
17660 bits = present ? HDA_AMP_MUTE : 0;
17661 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17662 HDA_AMP_MUTE, bits);
17665 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17668 switch (res >> 26) {
17669 case ALC880_HP_EVENT:
17670 alc663_g71v_hp_automute(codec);
17672 case ALC880_FRONT_EVENT:
17673 alc663_g71v_front_automute(codec);
17675 case ALC880_MIC_EVENT:
17676 alc_mic_automute(codec);
17681 #define alc663_g71v_setup alc663_m51va_setup
17683 static void alc663_g71v_inithook(struct hda_codec *codec)
17685 alc663_g71v_front_automute(codec);
17686 alc663_g71v_hp_automute(codec);
17687 alc_mic_automute(codec);
17690 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17693 switch (res >> 26) {
17694 case ALC880_HP_EVENT:
17695 alc663_m51va_speaker_automute(codec);
17697 case ALC880_MIC_EVENT:
17698 alc_mic_automute(codec);
17703 #define alc663_g50v_setup alc663_m51va_setup
17705 static void alc663_g50v_inithook(struct hda_codec *codec)
17707 alc663_m51va_speaker_automute(codec);
17708 alc_mic_automute(codec);
17711 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17712 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17713 ALC262_HIPPO_MASTER_SWITCH,
17715 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17716 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17717 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17719 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17720 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17721 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17725 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17726 /* Master Playback automatically created from Speaker and Headphone */
17727 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17728 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17729 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17730 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17732 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17733 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17734 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17736 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17737 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17738 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17742 #ifdef CONFIG_SND_HDA_POWER_SAVE
17743 #define alc662_loopbacks alc880_loopbacks
17747 /* pcm configuration: identical with ALC880 */
17748 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17749 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17750 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17751 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17754 * configuration and preset
17756 static const char *alc662_models[ALC662_MODEL_LAST] = {
17757 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17758 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17759 [ALC662_3ST_6ch] = "3stack-6ch",
17760 [ALC662_5ST_DIG] = "6stack-dig",
17761 [ALC662_LENOVO_101E] = "lenovo-101e",
17762 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17763 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17764 [ALC662_ECS] = "ecs",
17765 [ALC663_ASUS_M51VA] = "m51va",
17766 [ALC663_ASUS_G71V] = "g71v",
17767 [ALC663_ASUS_H13] = "h13",
17768 [ALC663_ASUS_G50V] = "g50v",
17769 [ALC663_ASUS_MODE1] = "asus-mode1",
17770 [ALC662_ASUS_MODE2] = "asus-mode2",
17771 [ALC663_ASUS_MODE3] = "asus-mode3",
17772 [ALC663_ASUS_MODE4] = "asus-mode4",
17773 [ALC663_ASUS_MODE5] = "asus-mode5",
17774 [ALC663_ASUS_MODE6] = "asus-mode6",
17775 [ALC663_ASUS_MODE7] = "asus-mode7",
17776 [ALC663_ASUS_MODE8] = "asus-mode8",
17777 [ALC272_DELL] = "dell",
17778 [ALC272_DELL_ZM1] = "dell-zm1",
17779 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17780 [ALC662_AUTO] = "auto",
17783 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17784 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17785 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17786 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17787 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17788 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17789 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17790 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17791 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17792 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17793 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17794 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17795 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17796 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17797 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17798 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17799 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17800 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17801 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17802 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17803 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17804 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17805 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17806 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17807 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17808 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17809 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17810 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17811 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17812 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17813 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17814 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17815 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17816 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17817 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17818 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17819 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17820 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17821 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17822 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17823 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17824 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17825 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17826 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17827 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17828 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17829 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17830 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17831 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17832 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17833 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17834 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17835 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17836 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17837 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17838 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17839 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17840 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17841 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17842 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17843 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17844 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17845 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17846 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17847 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17848 ALC662_3ST_6ch_DIG),
17849 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17850 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17851 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17852 ALC662_3ST_6ch_DIG),
17853 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17854 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17855 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17856 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17857 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17858 ALC662_3ST_6ch_DIG),
17859 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17861 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17865 static struct alc_config_preset alc662_presets[] = {
17866 [ALC662_3ST_2ch_DIG] = {
17867 .mixers = { alc662_3ST_2ch_mixer },
17868 .init_verbs = { alc662_init_verbs },
17869 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17870 .dac_nids = alc662_dac_nids,
17871 .dig_out_nid = ALC662_DIGOUT_NID,
17872 .dig_in_nid = ALC662_DIGIN_NID,
17873 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17874 .channel_mode = alc662_3ST_2ch_modes,
17875 .input_mux = &alc662_capture_source,
17877 [ALC662_3ST_6ch_DIG] = {
17878 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17879 .init_verbs = { alc662_init_verbs },
17880 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17881 .dac_nids = alc662_dac_nids,
17882 .dig_out_nid = ALC662_DIGOUT_NID,
17883 .dig_in_nid = ALC662_DIGIN_NID,
17884 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17885 .channel_mode = alc662_3ST_6ch_modes,
17887 .input_mux = &alc662_capture_source,
17889 [ALC662_3ST_6ch] = {
17890 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17891 .init_verbs = { alc662_init_verbs },
17892 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17893 .dac_nids = alc662_dac_nids,
17894 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17895 .channel_mode = alc662_3ST_6ch_modes,
17897 .input_mux = &alc662_capture_source,
17899 [ALC662_5ST_DIG] = {
17900 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17901 .init_verbs = { alc662_init_verbs },
17902 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17903 .dac_nids = alc662_dac_nids,
17904 .dig_out_nid = ALC662_DIGOUT_NID,
17905 .dig_in_nid = ALC662_DIGIN_NID,
17906 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17907 .channel_mode = alc662_5stack_modes,
17908 .input_mux = &alc662_capture_source,
17910 [ALC662_LENOVO_101E] = {
17911 .mixers = { alc662_lenovo_101e_mixer },
17912 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17913 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17914 .dac_nids = alc662_dac_nids,
17915 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17916 .channel_mode = alc662_3ST_2ch_modes,
17917 .input_mux = &alc662_lenovo_101e_capture_source,
17918 .unsol_event = alc662_lenovo_101e_unsol_event,
17919 .init_hook = alc662_lenovo_101e_all_automute,
17921 [ALC662_ASUS_EEEPC_P701] = {
17922 .mixers = { alc662_eeepc_p701_mixer },
17923 .init_verbs = { alc662_init_verbs,
17924 alc662_eeepc_sue_init_verbs },
17925 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17926 .dac_nids = alc662_dac_nids,
17927 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17928 .channel_mode = alc662_3ST_2ch_modes,
17929 .unsol_event = alc662_eeepc_unsol_event,
17930 .setup = alc662_eeepc_setup,
17931 .init_hook = alc662_eeepc_inithook,
17933 [ALC662_ASUS_EEEPC_EP20] = {
17934 .mixers = { alc662_eeepc_ep20_mixer,
17935 alc662_chmode_mixer },
17936 .init_verbs = { alc662_init_verbs,
17937 alc662_eeepc_ep20_sue_init_verbs },
17938 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17939 .dac_nids = alc662_dac_nids,
17940 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17941 .channel_mode = alc662_3ST_6ch_modes,
17942 .input_mux = &alc662_lenovo_101e_capture_source,
17943 .unsol_event = alc662_eeepc_unsol_event,
17944 .setup = alc662_eeepc_ep20_setup,
17945 .init_hook = alc662_eeepc_ep20_inithook,
17948 .mixers = { alc662_ecs_mixer },
17949 .init_verbs = { alc662_init_verbs,
17950 alc662_ecs_init_verbs },
17951 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17952 .dac_nids = alc662_dac_nids,
17953 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17954 .channel_mode = alc662_3ST_2ch_modes,
17955 .unsol_event = alc662_eeepc_unsol_event,
17956 .setup = alc662_eeepc_setup,
17957 .init_hook = alc662_eeepc_inithook,
17959 [ALC663_ASUS_M51VA] = {
17960 .mixers = { alc663_m51va_mixer },
17961 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17962 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17963 .dac_nids = alc662_dac_nids,
17964 .dig_out_nid = ALC662_DIGOUT_NID,
17965 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17966 .channel_mode = alc662_3ST_2ch_modes,
17967 .unsol_event = alc663_m51va_unsol_event,
17968 .setup = alc663_m51va_setup,
17969 .init_hook = alc663_m51va_inithook,
17971 [ALC663_ASUS_G71V] = {
17972 .mixers = { alc663_g71v_mixer },
17973 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17974 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17975 .dac_nids = alc662_dac_nids,
17976 .dig_out_nid = ALC662_DIGOUT_NID,
17977 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17978 .channel_mode = alc662_3ST_2ch_modes,
17979 .unsol_event = alc663_g71v_unsol_event,
17980 .setup = alc663_g71v_setup,
17981 .init_hook = alc663_g71v_inithook,
17983 [ALC663_ASUS_H13] = {
17984 .mixers = { alc663_m51va_mixer },
17985 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17986 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17987 .dac_nids = alc662_dac_nids,
17988 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17989 .channel_mode = alc662_3ST_2ch_modes,
17990 .unsol_event = alc663_m51va_unsol_event,
17991 .init_hook = alc663_m51va_inithook,
17993 [ALC663_ASUS_G50V] = {
17994 .mixers = { alc663_g50v_mixer },
17995 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17996 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17997 .dac_nids = alc662_dac_nids,
17998 .dig_out_nid = ALC662_DIGOUT_NID,
17999 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18000 .channel_mode = alc662_3ST_6ch_modes,
18001 .input_mux = &alc663_capture_source,
18002 .unsol_event = alc663_g50v_unsol_event,
18003 .setup = alc663_g50v_setup,
18004 .init_hook = alc663_g50v_inithook,
18006 [ALC663_ASUS_MODE1] = {
18007 .mixers = { alc663_m51va_mixer },
18008 .cap_mixer = alc662_auto_capture_mixer,
18009 .init_verbs = { alc662_init_verbs,
18010 alc663_21jd_amic_init_verbs },
18011 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18013 .dac_nids = alc662_dac_nids,
18014 .dig_out_nid = ALC662_DIGOUT_NID,
18015 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18016 .channel_mode = alc662_3ST_2ch_modes,
18017 .unsol_event = alc663_mode1_unsol_event,
18018 .setup = alc663_mode1_setup,
18019 .init_hook = alc663_mode1_inithook,
18021 [ALC662_ASUS_MODE2] = {
18022 .mixers = { alc662_1bjd_mixer },
18023 .cap_mixer = alc662_auto_capture_mixer,
18024 .init_verbs = { alc662_init_verbs,
18025 alc662_1bjd_amic_init_verbs },
18026 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18027 .dac_nids = alc662_dac_nids,
18028 .dig_out_nid = ALC662_DIGOUT_NID,
18029 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18030 .channel_mode = alc662_3ST_2ch_modes,
18031 .unsol_event = alc662_mode2_unsol_event,
18032 .setup = alc662_mode2_setup,
18033 .init_hook = alc662_mode2_inithook,
18035 [ALC663_ASUS_MODE3] = {
18036 .mixers = { alc663_two_hp_m1_mixer },
18037 .cap_mixer = alc662_auto_capture_mixer,
18038 .init_verbs = { alc662_init_verbs,
18039 alc663_two_hp_amic_m1_init_verbs },
18040 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18042 .dac_nids = alc662_dac_nids,
18043 .dig_out_nid = ALC662_DIGOUT_NID,
18044 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18045 .channel_mode = alc662_3ST_2ch_modes,
18046 .unsol_event = alc663_mode3_unsol_event,
18047 .setup = alc663_mode3_setup,
18048 .init_hook = alc663_mode3_inithook,
18050 [ALC663_ASUS_MODE4] = {
18051 .mixers = { alc663_asus_21jd_clfe_mixer },
18052 .cap_mixer = alc662_auto_capture_mixer,
18053 .init_verbs = { alc662_init_verbs,
18054 alc663_21jd_amic_init_verbs},
18055 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18057 .dac_nids = alc662_dac_nids,
18058 .dig_out_nid = ALC662_DIGOUT_NID,
18059 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18060 .channel_mode = alc662_3ST_2ch_modes,
18061 .unsol_event = alc663_mode4_unsol_event,
18062 .setup = alc663_mode4_setup,
18063 .init_hook = alc663_mode4_inithook,
18065 [ALC663_ASUS_MODE5] = {
18066 .mixers = { alc663_asus_15jd_clfe_mixer },
18067 .cap_mixer = alc662_auto_capture_mixer,
18068 .init_verbs = { alc662_init_verbs,
18069 alc663_15jd_amic_init_verbs },
18070 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18072 .dac_nids = alc662_dac_nids,
18073 .dig_out_nid = ALC662_DIGOUT_NID,
18074 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18075 .channel_mode = alc662_3ST_2ch_modes,
18076 .unsol_event = alc663_mode5_unsol_event,
18077 .setup = alc663_mode5_setup,
18078 .init_hook = alc663_mode5_inithook,
18080 [ALC663_ASUS_MODE6] = {
18081 .mixers = { alc663_two_hp_m2_mixer },
18082 .cap_mixer = alc662_auto_capture_mixer,
18083 .init_verbs = { alc662_init_verbs,
18084 alc663_two_hp_amic_m2_init_verbs },
18085 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18087 .dac_nids = alc662_dac_nids,
18088 .dig_out_nid = ALC662_DIGOUT_NID,
18089 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18090 .channel_mode = alc662_3ST_2ch_modes,
18091 .unsol_event = alc663_mode6_unsol_event,
18092 .setup = alc663_mode6_setup,
18093 .init_hook = alc663_mode6_inithook,
18095 [ALC663_ASUS_MODE7] = {
18096 .mixers = { alc663_mode7_mixer },
18097 .cap_mixer = alc662_auto_capture_mixer,
18098 .init_verbs = { alc662_init_verbs,
18099 alc663_mode7_init_verbs },
18100 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18102 .dac_nids = alc662_dac_nids,
18103 .dig_out_nid = ALC662_DIGOUT_NID,
18104 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18105 .channel_mode = alc662_3ST_2ch_modes,
18106 .unsol_event = alc663_mode7_unsol_event,
18107 .setup = alc663_mode7_setup,
18108 .init_hook = alc663_mode7_inithook,
18110 [ALC663_ASUS_MODE8] = {
18111 .mixers = { alc663_mode8_mixer },
18112 .cap_mixer = alc662_auto_capture_mixer,
18113 .init_verbs = { alc662_init_verbs,
18114 alc663_mode8_init_verbs },
18115 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18117 .dac_nids = alc662_dac_nids,
18118 .dig_out_nid = ALC662_DIGOUT_NID,
18119 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18120 .channel_mode = alc662_3ST_2ch_modes,
18121 .unsol_event = alc663_mode8_unsol_event,
18122 .setup = alc663_mode8_setup,
18123 .init_hook = alc663_mode8_inithook,
18126 .mixers = { alc663_m51va_mixer },
18127 .cap_mixer = alc272_auto_capture_mixer,
18128 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18129 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18130 .dac_nids = alc662_dac_nids,
18131 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18132 .adc_nids = alc272_adc_nids,
18133 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18134 .capsrc_nids = alc272_capsrc_nids,
18135 .channel_mode = alc662_3ST_2ch_modes,
18136 .unsol_event = alc663_m51va_unsol_event,
18137 .setup = alc663_m51va_setup,
18138 .init_hook = alc663_m51va_inithook,
18140 [ALC272_DELL_ZM1] = {
18141 .mixers = { alc663_m51va_mixer },
18142 .cap_mixer = alc662_auto_capture_mixer,
18143 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18144 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18145 .dac_nids = alc662_dac_nids,
18146 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18147 .adc_nids = alc662_adc_nids,
18149 .capsrc_nids = alc662_capsrc_nids,
18150 .channel_mode = alc662_3ST_2ch_modes,
18151 .unsol_event = alc663_m51va_unsol_event,
18152 .setup = alc663_m51va_setup,
18153 .init_hook = alc663_m51va_inithook,
18155 [ALC272_SAMSUNG_NC10] = {
18156 .mixers = { alc272_nc10_mixer },
18157 .init_verbs = { alc662_init_verbs,
18158 alc663_21jd_amic_init_verbs },
18159 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18160 .dac_nids = alc272_dac_nids,
18161 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18162 .channel_mode = alc662_3ST_2ch_modes,
18163 /*.input_mux = &alc272_nc10_capture_source,*/
18164 .unsol_event = alc663_mode4_unsol_event,
18165 .setup = alc663_mode4_setup,
18166 .init_hook = alc663_mode4_inithook,
18172 * BIOS auto configuration
18175 /* convert from MIX nid to DAC */
18176 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18180 else if (nid >= 0x0c && nid <= 0x0e)
18181 return nid - 0x0c + 0x02;
18186 /* get MIX nid connected to the given pin targeted to DAC */
18187 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18193 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18194 for (i = 0; i < num; i++) {
18195 if (alc662_mix_to_dac(mix[i]) == dac)
18201 /* look for an empty DAC slot */
18202 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18204 struct alc_spec *spec = codec->spec;
18208 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18211 for (i = 0; i < num; i++) {
18212 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18215 for (j = 0; j < spec->multiout.num_dacs; j++)
18216 if (spec->multiout.dac_nids[j] == nid)
18218 if (j >= spec->multiout.num_dacs)
18224 /* fill in the dac_nids table from the parsed pin configuration */
18225 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18226 const struct auto_pin_cfg *cfg)
18228 struct alc_spec *spec = codec->spec;
18232 spec->multiout.dac_nids = spec->private_dac_nids;
18233 for (i = 0; i < cfg->line_outs; i++) {
18234 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18237 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18242 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18243 hda_nid_t nid, unsigned int chs)
18245 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18246 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18249 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18250 hda_nid_t nid, unsigned int chs)
18252 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18253 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18256 #define alc662_add_stereo_vol(spec, pfx, nid) \
18257 alc662_add_vol_ctl(spec, pfx, nid, 3)
18258 #define alc662_add_stereo_sw(spec, pfx, nid) \
18259 alc662_add_sw_ctl(spec, pfx, nid, 3)
18261 /* add playback controls from the parsed DAC table */
18262 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18263 const struct auto_pin_cfg *cfg)
18265 struct alc_spec *spec = codec->spec;
18266 static const char *chname[4] = {
18267 "Front", "Surround", NULL /*CLFE*/, "Side"
18269 hda_nid_t nid, mix;
18272 for (i = 0; i < cfg->line_outs; i++) {
18273 nid = spec->multiout.dac_nids[i];
18276 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18281 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18284 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18287 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18290 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18295 if (cfg->line_outs == 1 &&
18296 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18303 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18306 if (cfg->line_outs == 1 &&
18307 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18309 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18317 /* add playback controls for speaker and HP outputs */
18318 /* return DAC nid if any new DAC is assigned */
18319 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18322 struct alc_spec *spec = codec->spec;
18323 hda_nid_t nid, mix;
18328 nid = alc662_look_for_dac(codec, pin);
18330 /* the corresponding DAC is already occupied */
18331 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18332 return 0; /* no way */
18333 /* create a switch only */
18334 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18335 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18338 mix = alc662_dac_to_mix(codec, pin, nid);
18341 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18344 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18350 /* create playback/capture controls for input pins */
18351 #define alc662_auto_create_input_ctls \
18352 alc882_auto_create_input_ctls
18354 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18355 hda_nid_t nid, int pin_type,
18361 alc_set_pin_output(codec, nid, pin_type);
18362 /* need the manual connection? */
18363 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18366 for (i = 0; i < num; i++) {
18367 if (alc662_mix_to_dac(srcs[i]) != dac)
18369 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18374 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18376 struct alc_spec *spec = codec->spec;
18377 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18380 for (i = 0; i <= HDA_SIDE; i++) {
18381 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18383 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18384 spec->multiout.dac_nids[i]);
18388 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18390 struct alc_spec *spec = codec->spec;
18393 pin = spec->autocfg.hp_pins[0];
18395 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18396 spec->multiout.hp_nid);
18397 pin = spec->autocfg.speaker_pins[0];
18399 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18400 spec->multiout.extra_out_nid[0]);
18403 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18405 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18407 struct alc_spec *spec = codec->spec;
18410 for (i = 0; i < AUTO_PIN_LAST; i++) {
18411 hda_nid_t nid = spec->autocfg.input_pins[i];
18412 if (alc_is_input_pin(codec, nid)) {
18413 alc_set_input_pin(codec, nid, i);
18414 if (nid != ALC662_PIN_CD_NID &&
18415 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18416 snd_hda_codec_write(codec, nid, 0,
18417 AC_VERB_SET_AMP_GAIN_MUTE,
18423 #define alc662_auto_init_input_src alc882_auto_init_input_src
18425 static int alc662_parse_auto_config(struct hda_codec *codec)
18427 struct alc_spec *spec = codec->spec;
18429 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18431 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18435 if (!spec->autocfg.line_outs)
18436 return 0; /* can't find valid BIOS pin config */
18438 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18441 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18444 err = alc662_auto_create_extra_out(codec,
18445 spec->autocfg.speaker_pins[0],
18450 spec->multiout.extra_out_nid[0] = err;
18451 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18456 spec->multiout.hp_nid = err;
18457 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18461 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18463 if (spec->autocfg.dig_outs)
18464 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18466 if (spec->kctls.list)
18467 add_mixer(spec, spec->kctls.list);
18469 spec->num_mux_defs = 1;
18470 spec->input_mux = &spec->private_imux[0];
18472 add_verb(spec, alc662_init_verbs);
18473 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18474 codec->vendor_id == 0x10ec0665)
18475 add_verb(spec, alc663_init_verbs);
18477 if (codec->vendor_id == 0x10ec0272)
18478 add_verb(spec, alc272_init_verbs);
18480 err = alc_auto_add_mic_boost(codec);
18484 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18485 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18486 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18488 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18493 /* additional initialization for auto-configuration model */
18494 static void alc662_auto_init(struct hda_codec *codec)
18496 struct alc_spec *spec = codec->spec;
18497 alc662_auto_init_multi_out(codec);
18498 alc662_auto_init_hp_out(codec);
18499 alc662_auto_init_analog_input(codec);
18500 alc662_auto_init_input_src(codec);
18501 if (spec->unsol_event)
18502 alc_inithook(codec);
18505 static int patch_alc662(struct hda_codec *codec)
18507 struct alc_spec *spec;
18508 int err, board_config;
18510 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18514 codec->spec = spec;
18516 alc_auto_parse_customize_define(codec);
18518 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18520 if (alc_read_coef_idx(codec, 0) == 0x8020)
18521 alc_codec_rename(codec, "ALC661");
18522 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18523 codec->bus->pci->subsystem_vendor == 0x1025 &&
18524 spec->cdefine.platform_type == 1)
18525 alc_codec_rename(codec, "ALC272X");
18527 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18530 if (board_config < 0) {
18531 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18533 board_config = ALC662_AUTO;
18536 if (board_config == ALC662_AUTO) {
18537 /* automatic parse from the BIOS config */
18538 err = alc662_parse_auto_config(codec);
18544 "hda_codec: Cannot set up configuration "
18545 "from BIOS. Using base mode...\n");
18546 board_config = ALC662_3ST_2ch_DIG;
18550 err = snd_hda_attach_beep_device(codec, 0x1);
18556 if (board_config != ALC662_AUTO)
18557 setup_preset(codec, &alc662_presets[board_config]);
18559 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18560 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18562 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18563 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18565 if (!spec->adc_nids) {
18566 spec->adc_nids = alc662_adc_nids;
18567 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18569 if (!spec->capsrc_nids)
18570 spec->capsrc_nids = alc662_capsrc_nids;
18572 if (!spec->cap_mixer)
18573 set_capture_mixer(codec);
18575 if (spec->cdefine.enable_pcbeep) {
18576 switch (codec->vendor_id) {
18578 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18583 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18586 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18590 spec->vmaster_nid = 0x02;
18592 codec->patch_ops = alc_patch_ops;
18593 if (board_config == ALC662_AUTO)
18594 spec->init_hook = alc662_auto_init;
18595 #ifdef CONFIG_SND_HDA_POWER_SAVE
18596 if (!spec->loopback.amplist)
18597 spec->loopback.amplist = alc662_loopbacks;
18603 static int patch_alc888(struct hda_codec *codec)
18605 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18606 kfree(codec->chip_name);
18607 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18608 if (!codec->chip_name) {
18612 return patch_alc662(codec);
18614 return patch_alc882(codec);
18620 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18621 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18622 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18623 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18624 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18625 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18626 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18627 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18628 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18629 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18630 .patch = patch_alc861 },
18631 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18632 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18633 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18634 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18635 .patch = patch_alc882 },
18636 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18637 .patch = patch_alc662 },
18638 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18639 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18640 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18641 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18642 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18643 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18644 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18645 .patch = patch_alc882 },
18646 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18647 .patch = patch_alc882 },
18648 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18649 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18650 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18651 .patch = patch_alc882 },
18652 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18653 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18654 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18655 {} /* terminator */
18658 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18660 MODULE_LICENSE("GPL");
18661 MODULE_DESCRIPTION("Realtek HD-audio codec");
18663 static struct hda_codec_preset_list realtek_list = {
18664 .preset = snd_hda_preset_realtek,
18665 .owner = THIS_MODULE,
18668 static int __init patch_realtek_init(void)
18670 return snd_hda_add_codec_preset(&realtek_list);
18673 static void __exit patch_realtek_exit(void)
18675 snd_hda_delete_codec_preset(&realtek_list);
18678 module_init(patch_realtek_init)
18679 module_exit(patch_realtek_exit)