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)
279 /* codec parameterization */
280 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
281 unsigned int num_mixers;
282 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
283 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
285 const struct hda_verb *init_verbs[10]; /* initialization verbs
289 unsigned int num_init_verbs;
291 char stream_name_analog[32]; /* analog PCM stream */
292 struct hda_pcm_stream *stream_analog_playback;
293 struct hda_pcm_stream *stream_analog_capture;
294 struct hda_pcm_stream *stream_analog_alt_playback;
295 struct hda_pcm_stream *stream_analog_alt_capture;
297 char stream_name_digital[32]; /* digital PCM stream */
298 struct hda_pcm_stream *stream_digital_playback;
299 struct hda_pcm_stream *stream_digital_capture;
302 struct hda_multi_out multiout; /* playback set-up
303 * max_channels, dacs must be set
304 * dig_out_nid and hp_nid are optional
306 hda_nid_t alt_dac_nid;
307 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
311 unsigned int num_adc_nids;
313 hda_nid_t *capsrc_nids;
314 hda_nid_t dig_in_nid; /* digital-in NID; optional */
317 unsigned int num_mux_defs;
318 const struct hda_input_mux *input_mux;
319 unsigned int cur_mux[3];
320 struct alc_mic_route ext_mic;
321 struct alc_mic_route int_mic;
324 const struct hda_channel_mode *channel_mode;
325 int num_channel_mode;
327 int const_channel_count;
328 int ext_channel_count;
330 /* PCM information */
331 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
333 /* dynamic controls, init_verbs and input_mux */
334 struct auto_pin_cfg autocfg;
335 struct snd_array kctls;
336 struct hda_input_mux private_imux[3];
337 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
338 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
339 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
342 void (*init_hook)(struct hda_codec *codec);
343 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
344 #ifdef CONFIG_SND_HDA_POWER_SAVE
345 void (*power_hook)(struct hda_codec *codec);
348 /* for pin sensing */
349 unsigned int sense_updated: 1;
350 unsigned int jack_present: 1;
351 unsigned int master_sw: 1;
352 unsigned int auto_mic:1;
355 unsigned int no_analog :1; /* digital I/O only */
358 /* for virtual master */
359 hda_nid_t vmaster_nid;
360 #ifdef CONFIG_SND_HDA_POWER_SAVE
361 struct hda_loopback_check loopback;
366 unsigned int pll_coef_idx, pll_coef_bit;
370 * configuration template - to be copied to the spec instance
372 struct alc_config_preset {
373 struct snd_kcontrol_new *mixers[5]; /* should be identical size
376 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
377 const struct hda_verb *init_verbs[5];
378 unsigned int num_dacs;
380 hda_nid_t dig_out_nid; /* optional */
381 hda_nid_t hp_nid; /* optional */
382 hda_nid_t *slave_dig_outs;
383 unsigned int num_adc_nids;
385 hda_nid_t *capsrc_nids;
386 hda_nid_t dig_in_nid;
387 unsigned int num_channel_mode;
388 const struct hda_channel_mode *channel_mode;
390 int const_channel_count;
391 unsigned int num_mux_defs;
392 const struct hda_input_mux *input_mux;
393 void (*unsol_event)(struct hda_codec *, unsigned int);
394 void (*setup)(struct hda_codec *);
395 void (*init_hook)(struct hda_codec *);
396 #ifdef CONFIG_SND_HDA_POWER_SAVE
397 struct hda_amp_list *loopbacks;
398 void (*power_hook)(struct hda_codec *codec);
406 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
407 struct snd_ctl_elem_info *uinfo)
409 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
410 struct alc_spec *spec = codec->spec;
411 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
412 if (mux_idx >= spec->num_mux_defs)
414 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
416 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
419 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
420 struct snd_ctl_elem_value *ucontrol)
422 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
423 struct alc_spec *spec = codec->spec;
424 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
426 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
430 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
431 struct snd_ctl_elem_value *ucontrol)
433 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
434 struct alc_spec *spec = codec->spec;
435 const struct hda_input_mux *imux;
436 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
437 unsigned int mux_idx;
438 hda_nid_t nid = spec->capsrc_nids ?
439 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
442 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
443 imux = &spec->input_mux[mux_idx];
444 if (!imux->num_items && mux_idx > 0)
445 imux = &spec->input_mux[0];
447 type = get_wcaps_type(get_wcaps(codec, nid));
448 if (type == AC_WID_AUD_MIX) {
449 /* Matrix-mixer style (e.g. ALC882) */
450 unsigned int *cur_val = &spec->cur_mux[adc_idx];
453 idx = ucontrol->value.enumerated.item[0];
454 if (idx >= imux->num_items)
455 idx = imux->num_items - 1;
458 for (i = 0; i < imux->num_items; i++) {
459 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
460 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
461 imux->items[i].index,
467 /* MUX style (e.g. ALC880) */
468 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
469 &spec->cur_mux[adc_idx]);
474 * channel mode setting
476 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
477 struct snd_ctl_elem_info *uinfo)
479 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
480 struct alc_spec *spec = codec->spec;
481 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
482 spec->num_channel_mode);
485 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
486 struct snd_ctl_elem_value *ucontrol)
488 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
489 struct alc_spec *spec = codec->spec;
490 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
491 spec->num_channel_mode,
492 spec->ext_channel_count);
495 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
496 struct snd_ctl_elem_value *ucontrol)
498 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
499 struct alc_spec *spec = codec->spec;
500 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
501 spec->num_channel_mode,
502 &spec->ext_channel_count);
503 if (err >= 0 && !spec->const_channel_count) {
504 spec->multiout.max_channels = spec->ext_channel_count;
505 if (spec->need_dac_fix)
506 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
512 * Control the mode of pin widget settings via the mixer. "pc" is used
513 * instead of "%" to avoid consequences of accidently treating the % as
514 * being part of a format specifier. Maximum allowed length of a value is
515 * 63 characters plus NULL terminator.
517 * Note: some retasking pin complexes seem to ignore requests for input
518 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
519 * are requested. Therefore order this list so that this behaviour will not
520 * cause problems when mixer clients move through the enum sequentially.
521 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
524 static char *alc_pin_mode_names[] = {
525 "Mic 50pc bias", "Mic 80pc bias",
526 "Line in", "Line out", "Headphone out",
528 static unsigned char alc_pin_mode_values[] = {
529 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
531 /* The control can present all 5 options, or it can limit the options based
532 * in the pin being assumed to be exclusively an input or an output pin. In
533 * addition, "input" pins may or may not process the mic bias option
534 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
535 * accept requests for bias as of chip versions up to March 2006) and/or
536 * wiring in the computer.
538 #define ALC_PIN_DIR_IN 0x00
539 #define ALC_PIN_DIR_OUT 0x01
540 #define ALC_PIN_DIR_INOUT 0x02
541 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
542 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
544 /* Info about the pin modes supported by the different pin direction modes.
545 * For each direction the minimum and maximum values are given.
547 static signed char alc_pin_mode_dir_info[5][2] = {
548 { 0, 2 }, /* ALC_PIN_DIR_IN */
549 { 3, 4 }, /* ALC_PIN_DIR_OUT */
550 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
551 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
552 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
554 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
555 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
556 #define alc_pin_mode_n_items(_dir) \
557 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
559 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
560 struct snd_ctl_elem_info *uinfo)
562 unsigned int item_num = uinfo->value.enumerated.item;
563 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
565 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
567 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
569 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
570 item_num = alc_pin_mode_min(dir);
571 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
575 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
576 struct snd_ctl_elem_value *ucontrol)
579 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
580 hda_nid_t nid = kcontrol->private_value & 0xffff;
581 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
582 long *valp = ucontrol->value.integer.value;
583 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
584 AC_VERB_GET_PIN_WIDGET_CONTROL,
587 /* Find enumerated value for current pinctl setting */
588 i = alc_pin_mode_min(dir);
589 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
591 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
595 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
596 struct snd_ctl_elem_value *ucontrol)
599 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
600 hda_nid_t nid = kcontrol->private_value & 0xffff;
601 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
602 long val = *ucontrol->value.integer.value;
603 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
604 AC_VERB_GET_PIN_WIDGET_CONTROL,
607 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
608 val = alc_pin_mode_min(dir);
610 change = pinctl != alc_pin_mode_values[val];
612 /* Set pin mode to that requested */
613 snd_hda_codec_write_cache(codec, nid, 0,
614 AC_VERB_SET_PIN_WIDGET_CONTROL,
615 alc_pin_mode_values[val]);
617 /* Also enable the retasking pin's input/output as required
618 * for the requested pin mode. Enum values of 2 or less are
621 * Dynamically switching the input/output buffers probably
622 * reduces noise slightly (particularly on input) so we'll
623 * do it. However, having both input and output buffers
624 * enabled simultaneously doesn't seem to be problematic if
625 * this turns out to be necessary in the future.
628 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
629 HDA_AMP_MUTE, HDA_AMP_MUTE);
630 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
633 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
634 HDA_AMP_MUTE, HDA_AMP_MUTE);
635 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
642 #define ALC_PIN_MODE(xname, nid, dir) \
643 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
644 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
645 .info = alc_pin_mode_info, \
646 .get = alc_pin_mode_get, \
647 .put = alc_pin_mode_put, \
648 .private_value = nid | (dir<<16) }
650 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
651 * together using a mask with more than one bit set. This control is
652 * currently used only by the ALC260 test model. At this stage they are not
653 * needed for any "production" models.
655 #ifdef CONFIG_SND_DEBUG
656 #define alc_gpio_data_info snd_ctl_boolean_mono_info
658 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
659 struct snd_ctl_elem_value *ucontrol)
661 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
662 hda_nid_t nid = kcontrol->private_value & 0xffff;
663 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
664 long *valp = ucontrol->value.integer.value;
665 unsigned int val = snd_hda_codec_read(codec, nid, 0,
666 AC_VERB_GET_GPIO_DATA, 0x00);
668 *valp = (val & mask) != 0;
671 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
672 struct snd_ctl_elem_value *ucontrol)
675 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
676 hda_nid_t nid = kcontrol->private_value & 0xffff;
677 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
678 long val = *ucontrol->value.integer.value;
679 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
680 AC_VERB_GET_GPIO_DATA,
683 /* Set/unset the masked GPIO bit(s) as needed */
684 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
689 snd_hda_codec_write_cache(codec, nid, 0,
690 AC_VERB_SET_GPIO_DATA, gpio_data);
694 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
695 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
696 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
697 .info = alc_gpio_data_info, \
698 .get = alc_gpio_data_get, \
699 .put = alc_gpio_data_put, \
700 .private_value = nid | (mask<<16) }
701 #endif /* CONFIG_SND_DEBUG */
703 /* A switch control to allow the enabling of the digital IO pins on the
704 * ALC260. This is incredibly simplistic; the intention of this control is
705 * to provide something in the test model allowing digital outputs to be
706 * identified if present. If models are found which can utilise these
707 * outputs a more complete mixer control can be devised for those models if
710 #ifdef CONFIG_SND_DEBUG
711 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
713 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
714 struct snd_ctl_elem_value *ucontrol)
716 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
717 hda_nid_t nid = kcontrol->private_value & 0xffff;
718 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
719 long *valp = ucontrol->value.integer.value;
720 unsigned int val = snd_hda_codec_read(codec, nid, 0,
721 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
723 *valp = (val & mask) != 0;
726 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
727 struct snd_ctl_elem_value *ucontrol)
730 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
731 hda_nid_t nid = kcontrol->private_value & 0xffff;
732 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
733 long val = *ucontrol->value.integer.value;
734 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
735 AC_VERB_GET_DIGI_CONVERT_1,
738 /* Set/unset the masked control bit(s) as needed */
739 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
744 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
749 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
750 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
751 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
752 .info = alc_spdif_ctrl_info, \
753 .get = alc_spdif_ctrl_get, \
754 .put = alc_spdif_ctrl_put, \
755 .private_value = nid | (mask<<16) }
756 #endif /* CONFIG_SND_DEBUG */
758 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
759 * Again, this is only used in the ALC26x test models to help identify when
760 * the EAPD line must be asserted for features to work.
762 #ifdef CONFIG_SND_DEBUG
763 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
765 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
766 struct snd_ctl_elem_value *ucontrol)
768 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
769 hda_nid_t nid = kcontrol->private_value & 0xffff;
770 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
771 long *valp = ucontrol->value.integer.value;
772 unsigned int val = snd_hda_codec_read(codec, nid, 0,
773 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
775 *valp = (val & mask) != 0;
779 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
780 struct snd_ctl_elem_value *ucontrol)
783 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
784 hda_nid_t nid = kcontrol->private_value & 0xffff;
785 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
786 long val = *ucontrol->value.integer.value;
787 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
788 AC_VERB_GET_EAPD_BTLENABLE,
791 /* Set/unset the masked control bit(s) as needed */
792 change = (!val ? 0 : mask) != (ctrl_data & mask);
797 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
803 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
804 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
805 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
806 .info = alc_eapd_ctrl_info, \
807 .get = alc_eapd_ctrl_get, \
808 .put = alc_eapd_ctrl_put, \
809 .private_value = nid | (mask<<16) }
810 #endif /* CONFIG_SND_DEBUG */
813 * set up the input pin config (depending on the given auto-pin type)
815 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
818 unsigned int val = PIN_IN;
820 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
822 pincap = snd_hda_query_pin_caps(codec, nid);
823 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
824 if (pincap & AC_PINCAP_VREF_80)
826 else if (pincap & AC_PINCAP_VREF_50)
828 else if (pincap & AC_PINCAP_VREF_100)
830 else if (pincap & AC_PINCAP_VREF_GRD)
833 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
838 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
840 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
842 spec->mixers[spec->num_mixers++] = mix;
845 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
847 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
849 spec->init_verbs[spec->num_init_verbs++] = verb;
853 * set up from the preset table
855 static void setup_preset(struct hda_codec *codec,
856 const struct alc_config_preset *preset)
858 struct alc_spec *spec = codec->spec;
861 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
862 add_mixer(spec, preset->mixers[i]);
863 spec->cap_mixer = preset->cap_mixer;
864 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
866 add_verb(spec, preset->init_verbs[i]);
868 spec->channel_mode = preset->channel_mode;
869 spec->num_channel_mode = preset->num_channel_mode;
870 spec->need_dac_fix = preset->need_dac_fix;
871 spec->const_channel_count = preset->const_channel_count;
873 if (preset->const_channel_count)
874 spec->multiout.max_channels = preset->const_channel_count;
876 spec->multiout.max_channels = spec->channel_mode[0].channels;
877 spec->ext_channel_count = spec->channel_mode[0].channels;
879 spec->multiout.num_dacs = preset->num_dacs;
880 spec->multiout.dac_nids = preset->dac_nids;
881 spec->multiout.dig_out_nid = preset->dig_out_nid;
882 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
883 spec->multiout.hp_nid = preset->hp_nid;
885 spec->num_mux_defs = preset->num_mux_defs;
886 if (!spec->num_mux_defs)
887 spec->num_mux_defs = 1;
888 spec->input_mux = preset->input_mux;
890 spec->num_adc_nids = preset->num_adc_nids;
891 spec->adc_nids = preset->adc_nids;
892 spec->capsrc_nids = preset->capsrc_nids;
893 spec->dig_in_nid = preset->dig_in_nid;
895 spec->unsol_event = preset->unsol_event;
896 spec->init_hook = preset->init_hook;
897 #ifdef CONFIG_SND_HDA_POWER_SAVE
898 spec->power_hook = preset->power_hook;
899 spec->loopback.amplist = preset->loopbacks;
903 preset->setup(codec);
906 /* Enable GPIO mask and set output */
907 static struct hda_verb alc_gpio1_init_verbs[] = {
908 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
909 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
910 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
914 static struct hda_verb alc_gpio2_init_verbs[] = {
915 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
916 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
917 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
921 static struct hda_verb alc_gpio3_init_verbs[] = {
922 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
923 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
924 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
929 * Fix hardware PLL issue
930 * On some codecs, the analog PLL gating control must be off while
931 * the default value is 1.
933 static void alc_fix_pll(struct hda_codec *codec)
935 struct alc_spec *spec = codec->spec;
940 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
942 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
943 AC_VERB_GET_PROC_COEF, 0);
944 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
946 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
947 val & ~(1 << spec->pll_coef_bit));
950 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
951 unsigned int coef_idx, unsigned int coef_bit)
953 struct alc_spec *spec = codec->spec;
955 spec->pll_coef_idx = coef_idx;
956 spec->pll_coef_bit = coef_bit;
960 static void alc_automute_pin(struct hda_codec *codec)
962 struct alc_spec *spec = codec->spec;
963 unsigned int nid = spec->autocfg.hp_pins[0];
968 spec->jack_present = snd_hda_jack_detect(codec, nid);
969 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
970 nid = spec->autocfg.speaker_pins[i];
973 snd_hda_codec_write(codec, nid, 0,
974 AC_VERB_SET_PIN_WIDGET_CONTROL,
975 spec->jack_present ? 0 : PIN_OUT);
979 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
982 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
985 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
986 for (i = 0; i < nums; i++)
992 static void alc_mic_automute(struct hda_codec *codec)
994 struct alc_spec *spec = codec->spec;
995 struct alc_mic_route *dead, *alive;
996 unsigned int present, type;
1001 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1003 if (snd_BUG_ON(!spec->adc_nids))
1006 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1008 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1010 alive = &spec->ext_mic;
1011 dead = &spec->int_mic;
1013 alive = &spec->int_mic;
1014 dead = &spec->ext_mic;
1017 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1018 if (type == AC_WID_AUD_MIX) {
1019 /* Matrix-mixer style (e.g. ALC882) */
1020 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1023 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1025 HDA_AMP_MUTE, HDA_AMP_MUTE);
1027 /* MUX style (e.g. ALC880) */
1028 snd_hda_codec_write_cache(codec, cap_nid, 0,
1029 AC_VERB_SET_CONNECT_SEL,
1033 /* FIXME: analog mixer */
1036 /* unsolicited event for HP jack sensing */
1037 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1039 if (codec->vendor_id == 0x10ec0880)
1044 case ALC880_HP_EVENT:
1045 alc_automute_pin(codec);
1047 case ALC880_MIC_EVENT:
1048 alc_mic_automute(codec);
1053 static void alc_inithook(struct hda_codec *codec)
1055 alc_automute_pin(codec);
1056 alc_mic_automute(codec);
1059 /* additional initialization for ALC888 variants */
1060 static void alc888_coef_init(struct hda_codec *codec)
1064 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1065 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1066 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1067 if ((tmp & 0xf0) == 0x20)
1069 snd_hda_codec_read(codec, 0x20, 0,
1070 AC_VERB_SET_PROC_COEF, 0x830);
1073 snd_hda_codec_read(codec, 0x20, 0,
1074 AC_VERB_SET_PROC_COEF, 0x3030);
1077 static void alc889_coef_init(struct hda_codec *codec)
1081 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1082 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1083 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1084 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1087 /* turn on/off EAPD control (only if available) */
1088 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1090 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1092 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1093 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1097 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1102 case ALC_INIT_GPIO1:
1103 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1105 case ALC_INIT_GPIO2:
1106 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1108 case ALC_INIT_GPIO3:
1109 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1111 case ALC_INIT_DEFAULT:
1112 switch (codec->vendor_id) {
1114 set_eapd(codec, 0x0f, 1);
1115 set_eapd(codec, 0x10, 1);
1128 set_eapd(codec, 0x14, 1);
1129 set_eapd(codec, 0x15, 1);
1132 switch (codec->vendor_id) {
1134 snd_hda_codec_write(codec, 0x1a, 0,
1135 AC_VERB_SET_COEF_INDEX, 7);
1136 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1137 AC_VERB_GET_PROC_COEF, 0);
1138 snd_hda_codec_write(codec, 0x1a, 0,
1139 AC_VERB_SET_COEF_INDEX, 7);
1140 snd_hda_codec_write(codec, 0x1a, 0,
1141 AC_VERB_SET_PROC_COEF,
1151 alc889_coef_init(codec);
1154 alc888_coef_init(codec);
1156 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1159 snd_hda_codec_write(codec, 0x20, 0,
1160 AC_VERB_SET_COEF_INDEX, 7);
1161 tmp = snd_hda_codec_read(codec, 0x20, 0,
1162 AC_VERB_GET_PROC_COEF, 0);
1163 snd_hda_codec_write(codec, 0x20, 0,
1164 AC_VERB_SET_COEF_INDEX, 7);
1165 snd_hda_codec_write(codec, 0x20, 0,
1166 AC_VERB_SET_PROC_COEF,
1175 static void alc_init_auto_hp(struct hda_codec *codec)
1177 struct alc_spec *spec = codec->spec;
1179 if (!spec->autocfg.hp_pins[0])
1182 if (!spec->autocfg.speaker_pins[0]) {
1183 if (spec->autocfg.line_out_pins[0] &&
1184 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1185 spec->autocfg.speaker_pins[0] =
1186 spec->autocfg.line_out_pins[0];
1191 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1192 spec->autocfg.hp_pins[0]);
1193 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1194 AC_VERB_SET_UNSOLICITED_ENABLE,
1195 AC_USRSP_EN | ALC880_HP_EVENT);
1196 spec->unsol_event = alc_sku_unsol_event;
1199 static void alc_init_auto_mic(struct hda_codec *codec)
1201 struct alc_spec *spec = codec->spec;
1202 struct auto_pin_cfg *cfg = &spec->autocfg;
1203 hda_nid_t fixed, ext;
1206 /* there must be only two mic inputs exclusively */
1207 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1208 if (cfg->input_pins[i])
1212 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1213 hda_nid_t nid = cfg->input_pins[i];
1214 unsigned int defcfg;
1217 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1218 switch (get_defcfg_connect(defcfg)) {
1219 case AC_JACK_PORT_FIXED:
1221 return; /* already occupied */
1224 case AC_JACK_PORT_COMPLEX:
1226 return; /* already occupied */
1230 return; /* invalid entry */
1235 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1236 return; /* no unsol support */
1237 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1239 spec->ext_mic.pin = ext;
1240 spec->int_mic.pin = fixed;
1241 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1242 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1244 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1245 AC_VERB_SET_UNSOLICITED_ENABLE,
1246 AC_USRSP_EN | ALC880_MIC_EVENT);
1247 spec->unsol_event = alc_sku_unsol_event;
1250 /* check subsystem ID and set up device-specific initialization;
1251 * return 1 if initialized, 0 if invalid SSID
1253 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1254 * 31 ~ 16 : Manufacture ID
1256 * 7 ~ 0 : Assembly ID
1257 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1259 static int alc_subsystem_id(struct hda_codec *codec,
1260 hda_nid_t porta, hda_nid_t porte,
1261 hda_nid_t portd, hda_nid_t porti)
1263 unsigned int ass, tmp, i;
1265 struct alc_spec *spec = codec->spec;
1267 ass = codec->subsystem_id & 0xffff;
1268 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1271 /* invalid SSID, check the special NID pin defcfg instead */
1273 * 31~30 : port connectivity
1276 * 19~16 : Check sum (15:1)
1281 if (codec->vendor_id == 0x10ec0260)
1283 ass = snd_hda_codec_get_pincfg(codec, nid);
1284 snd_printd("realtek: No valid SSID, "
1285 "checking pincfg 0x%08x for NID 0x%x\n",
1289 if ((ass >> 30) != 1) /* no physical connection */
1294 for (i = 1; i < 16; i++) {
1298 if (((ass >> 16) & 0xf) != tmp)
1301 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1302 ass & 0xffff, codec->vendor_id);
1306 * 2 : 0 --> Desktop, 1 --> Laptop
1307 * 3~5 : External Amplifier control
1310 tmp = (ass & 0x38) >> 3; /* external Amp control */
1313 spec->init_amp = ALC_INIT_GPIO1;
1316 spec->init_amp = ALC_INIT_GPIO2;
1319 spec->init_amp = ALC_INIT_GPIO3;
1322 spec->init_amp = ALC_INIT_DEFAULT;
1326 /* is laptop or Desktop and enable the function "Mute internal speaker
1327 * when the external headphone out jack is plugged"
1329 if (!(ass & 0x8000))
1332 * 10~8 : Jack location
1333 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1335 * 15 : 1 --> enable the function "Mute internal speaker
1336 * when the external headphone out jack is plugged"
1338 if (!spec->autocfg.hp_pins[0]) {
1340 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1351 for (i = 0; i < spec->autocfg.line_outs; i++)
1352 if (spec->autocfg.line_out_pins[i] == nid)
1354 spec->autocfg.hp_pins[0] = nid;
1357 alc_init_auto_hp(codec);
1358 alc_init_auto_mic(codec);
1362 static void alc_ssid_check(struct hda_codec *codec,
1363 hda_nid_t porta, hda_nid_t porte,
1364 hda_nid_t portd, hda_nid_t porti)
1366 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1367 struct alc_spec *spec = codec->spec;
1368 snd_printd("realtek: "
1369 "Enable default setup for auto mode as fallback\n");
1370 spec->init_amp = ALC_INIT_DEFAULT;
1371 alc_init_auto_hp(codec);
1372 alc_init_auto_mic(codec);
1377 * Fix-up pin default configurations and add default verbs
1386 const struct alc_pincfg *pins;
1387 const struct hda_verb *verbs;
1390 static void alc_pick_fixup(struct hda_codec *codec,
1391 const struct snd_pci_quirk *quirk,
1392 const struct alc_fixup *fix)
1394 const struct alc_pincfg *cfg;
1396 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1400 fix += quirk->value;
1403 for (; cfg->nid; cfg++)
1404 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1407 add_verb(codec->spec, fix->verbs);
1410 static int alc_read_coef_idx(struct hda_codec *codec,
1411 unsigned int coef_idx)
1414 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1416 val = snd_hda_codec_read(codec, 0x20, 0,
1417 AC_VERB_GET_PROC_COEF, 0);
1428 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1429 /* Mic-in jack as mic in */
1430 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1431 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1432 /* Line-in jack as Line in */
1433 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1434 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1435 /* Line-Out as Front */
1436 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1443 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1444 /* Mic-in jack as mic in */
1445 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1446 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1447 /* Line-in jack as Surround */
1448 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1449 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1450 /* Line-Out as Front */
1451 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1458 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1459 /* Mic-in jack as CLFE */
1460 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1461 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1462 /* Line-in jack as Surround */
1463 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1464 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1465 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1466 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1473 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1474 /* Mic-in jack as CLFE */
1475 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1476 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1477 /* Line-in jack as Surround */
1478 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1479 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1480 /* Line-Out as Side */
1481 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1485 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1486 { 2, alc888_4ST_ch2_intel_init },
1487 { 4, alc888_4ST_ch4_intel_init },
1488 { 6, alc888_4ST_ch6_intel_init },
1489 { 8, alc888_4ST_ch8_intel_init },
1493 * ALC888 Fujitsu Siemens Amillo xa3530
1496 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1497 /* Front Mic: set to PIN_IN (empty by default) */
1498 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1499 /* Connect Internal HP to Front */
1500 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1502 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1503 /* Connect Bass HP to Front */
1504 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1506 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1507 /* Connect Line-Out side jack (SPDIF) to Side */
1508 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1509 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1510 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1511 /* Connect Mic jack to CLFE */
1512 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1513 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1514 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1515 /* Connect Line-in jack to Surround */
1516 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1517 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1518 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1519 /* Connect HP out jack to Front */
1520 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1521 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1522 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1523 /* Enable unsolicited event for HP jack and Line-out jack */
1524 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1525 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1529 static void alc_automute_amp(struct hda_codec *codec)
1531 struct alc_spec *spec = codec->spec;
1536 spec->jack_present = 0;
1537 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1538 nid = spec->autocfg.hp_pins[i];
1541 if (snd_hda_jack_detect(codec, nid)) {
1542 spec->jack_present = 1;
1547 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1548 /* Toggle internal speakers muting */
1549 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1550 nid = spec->autocfg.speaker_pins[i];
1553 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1554 HDA_AMP_MUTE, mute);
1558 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1561 if (codec->vendor_id == 0x10ec0880)
1565 if (res == ALC880_HP_EVENT)
1566 alc_automute_amp(codec);
1569 static void alc889_automute_setup(struct hda_codec *codec)
1571 struct alc_spec *spec = codec->spec;
1573 spec->autocfg.hp_pins[0] = 0x15;
1574 spec->autocfg.speaker_pins[0] = 0x14;
1575 spec->autocfg.speaker_pins[1] = 0x16;
1576 spec->autocfg.speaker_pins[2] = 0x17;
1577 spec->autocfg.speaker_pins[3] = 0x19;
1578 spec->autocfg.speaker_pins[4] = 0x1a;
1581 static void alc889_intel_init_hook(struct hda_codec *codec)
1583 alc889_coef_init(codec);
1584 alc_automute_amp(codec);
1587 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1589 struct alc_spec *spec = codec->spec;
1591 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1592 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1593 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1594 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1598 * ALC888 Acer Aspire 4930G model
1601 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1602 /* Front Mic: set to PIN_IN (empty by default) */
1603 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1604 /* Unselect Front Mic by default in input mixer 3 */
1605 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1606 /* Enable unsolicited event for HP jack */
1607 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1608 /* Connect Internal HP to front */
1609 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1610 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1611 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1612 /* Connect HP out to front */
1613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1615 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1620 * ALC888 Acer Aspire 6530G model
1623 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1624 /* Bias voltage on for external mic port */
1625 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1626 /* Front Mic: set to PIN_IN (empty by default) */
1627 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1628 /* Unselect Front Mic by default in input mixer 3 */
1629 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1630 /* Enable unsolicited event for HP jack */
1631 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1632 /* Enable speaker output */
1633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1634 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1635 /* Enable headphone output */
1636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1638 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1643 * ALC889 Acer Aspire 8930G model
1646 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1647 /* Front Mic: set to PIN_IN (empty by default) */
1648 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1649 /* Unselect Front Mic by default in input mixer 3 */
1650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1651 /* Enable unsolicited event for HP jack */
1652 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1653 /* Connect Internal Front to Front */
1654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1655 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1656 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1657 /* Connect Internal Rear to Rear */
1658 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1659 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1660 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1661 /* Connect Internal CLFE to CLFE */
1662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1664 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1665 /* Connect HP out to Front */
1666 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1667 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1668 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1669 /* Enable all DACs */
1670 /* DAC DISABLE/MUTE 1? */
1671 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1672 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1673 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1674 /* DAC DISABLE/MUTE 2? */
1675 /* some bit here disables the other DACs. Init=0x4900 */
1676 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1677 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1679 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1680 * which makes the stereo useless. However, either the mic or the ALC889
1681 * makes the signal become a difference/sum signal instead of standard
1682 * stereo, which is annoying. So instead we flip this bit which makes the
1683 * codec replicate the sum signal to both channels, turning it into a
1686 /* DMIC_CONTROL? Init value = 0x0001 */
1687 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1688 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1692 static struct hda_input_mux alc888_2_capture_sources[2] = {
1693 /* Front mic only available on one ADC */
1700 { "Front Mic", 0xb },
1713 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1714 /* Interal mic only available on one ADC */
1721 { "Input Mix", 0xa },
1731 { "Input Mix", 0xa },
1736 static struct hda_input_mux alc889_capture_sources[3] = {
1737 /* Digital mic only available on first "ADC" */
1744 { "Front Mic", 0xb },
1745 { "Input Mix", 0xa },
1754 { "Input Mix", 0xa },
1763 { "Input Mix", 0xa },
1768 static struct snd_kcontrol_new alc888_base_mixer[] = {
1769 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1770 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1771 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1772 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1775 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1776 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1777 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1778 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1779 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1780 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1781 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1782 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1783 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1785 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1790 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1791 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1792 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1793 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1794 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1797 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1798 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1799 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1800 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1801 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1803 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1809 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1811 struct alc_spec *spec = codec->spec;
1813 spec->autocfg.hp_pins[0] = 0x15;
1814 spec->autocfg.speaker_pins[0] = 0x14;
1815 spec->autocfg.speaker_pins[1] = 0x16;
1816 spec->autocfg.speaker_pins[2] = 0x17;
1819 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1821 struct alc_spec *spec = codec->spec;
1823 spec->autocfg.hp_pins[0] = 0x15;
1824 spec->autocfg.speaker_pins[0] = 0x14;
1825 spec->autocfg.speaker_pins[1] = 0x16;
1826 spec->autocfg.speaker_pins[2] = 0x17;
1829 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1831 struct alc_spec *spec = codec->spec;
1833 spec->autocfg.hp_pins[0] = 0x15;
1834 spec->autocfg.speaker_pins[0] = 0x14;
1835 spec->autocfg.speaker_pins[1] = 0x16;
1836 spec->autocfg.speaker_pins[2] = 0x1b;
1840 * ALC880 3-stack model
1842 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1843 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1844 * F-Mic = 0x1b, HP = 0x19
1847 static hda_nid_t alc880_dac_nids[4] = {
1848 /* front, rear, clfe, rear_surr */
1849 0x02, 0x05, 0x04, 0x03
1852 static hda_nid_t alc880_adc_nids[3] = {
1857 /* The datasheet says the node 0x07 is connected from inputs,
1858 * but it shows zero connection in the real implementation on some devices.
1859 * Note: this is a 915GAV bug, fixed on 915GLV
1861 static hda_nid_t alc880_adc_nids_alt[2] = {
1866 #define ALC880_DIGOUT_NID 0x06
1867 #define ALC880_DIGIN_NID 0x0a
1869 static struct hda_input_mux alc880_capture_source = {
1873 { "Front Mic", 0x3 },
1879 /* channel source setting (2/6 channel selection for 3-stack) */
1881 static struct hda_verb alc880_threestack_ch2_init[] = {
1882 /* set line-in to input, mute it */
1883 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1884 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1885 /* set mic-in to input vref 80%, mute it */
1886 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1887 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1892 static struct hda_verb alc880_threestack_ch6_init[] = {
1893 /* set line-in to output, unmute it */
1894 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1895 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1896 /* set mic-in to output, unmute it */
1897 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1898 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1902 static struct hda_channel_mode alc880_threestack_modes[2] = {
1903 { 2, alc880_threestack_ch2_init },
1904 { 6, alc880_threestack_ch6_init },
1907 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1908 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1909 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1910 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1911 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1912 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1913 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1914 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1915 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1916 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1917 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1918 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1919 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1922 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1923 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1924 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1926 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1927 .name = "Channel Mode",
1928 .info = alc_ch_mode_info,
1929 .get = alc_ch_mode_get,
1930 .put = alc_ch_mode_put,
1935 /* capture mixer elements */
1936 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1937 struct snd_ctl_elem_info *uinfo)
1939 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1940 struct alc_spec *spec = codec->spec;
1943 mutex_lock(&codec->control_mutex);
1944 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1946 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1947 mutex_unlock(&codec->control_mutex);
1951 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1952 unsigned int size, unsigned int __user *tlv)
1954 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1955 struct alc_spec *spec = codec->spec;
1958 mutex_lock(&codec->control_mutex);
1959 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1961 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1962 mutex_unlock(&codec->control_mutex);
1966 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1967 struct snd_ctl_elem_value *ucontrol);
1969 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1970 struct snd_ctl_elem_value *ucontrol,
1973 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1974 struct alc_spec *spec = codec->spec;
1975 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1978 mutex_lock(&codec->control_mutex);
1979 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1981 err = func(kcontrol, ucontrol);
1982 mutex_unlock(&codec->control_mutex);
1986 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1987 struct snd_ctl_elem_value *ucontrol)
1989 return alc_cap_getput_caller(kcontrol, ucontrol,
1990 snd_hda_mixer_amp_volume_get);
1993 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1994 struct snd_ctl_elem_value *ucontrol)
1996 return alc_cap_getput_caller(kcontrol, ucontrol,
1997 snd_hda_mixer_amp_volume_put);
2000 /* capture mixer elements */
2001 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2003 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2004 struct snd_ctl_elem_value *ucontrol)
2006 return alc_cap_getput_caller(kcontrol, ucontrol,
2007 snd_hda_mixer_amp_switch_get);
2010 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2011 struct snd_ctl_elem_value *ucontrol)
2013 return alc_cap_getput_caller(kcontrol, ucontrol,
2014 snd_hda_mixer_amp_switch_put);
2017 #define _DEFINE_CAPMIX(num) \
2019 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2020 .name = "Capture Switch", \
2021 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2023 .info = alc_cap_sw_info, \
2024 .get = alc_cap_sw_get, \
2025 .put = alc_cap_sw_put, \
2028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2029 .name = "Capture Volume", \
2030 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2031 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2032 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2034 .info = alc_cap_vol_info, \
2035 .get = alc_cap_vol_get, \
2036 .put = alc_cap_vol_put, \
2037 .tlv = { .c = alc_cap_vol_tlv }, \
2040 #define _DEFINE_CAPSRC(num) \
2042 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2043 /* .name = "Capture Source", */ \
2044 .name = "Input Source", \
2046 .info = alc_mux_enum_info, \
2047 .get = alc_mux_enum_get, \
2048 .put = alc_mux_enum_put, \
2051 #define DEFINE_CAPMIX(num) \
2052 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2053 _DEFINE_CAPMIX(num), \
2054 _DEFINE_CAPSRC(num), \
2058 #define DEFINE_CAPMIX_NOSRC(num) \
2059 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2060 _DEFINE_CAPMIX(num), \
2064 /* up to three ADCs */
2068 DEFINE_CAPMIX_NOSRC(1);
2069 DEFINE_CAPMIX_NOSRC(2);
2070 DEFINE_CAPMIX_NOSRC(3);
2073 * ALC880 5-stack model
2075 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2077 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2078 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2081 /* additional mixers to alc880_three_stack_mixer */
2082 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2083 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2084 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2088 /* channel source setting (6/8 channel selection for 5-stack) */
2090 static struct hda_verb alc880_fivestack_ch6_init[] = {
2091 /* set line-in to input, mute it */
2092 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2093 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2098 static struct hda_verb alc880_fivestack_ch8_init[] = {
2099 /* set line-in to output, unmute it */
2100 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2101 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2105 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2106 { 6, alc880_fivestack_ch6_init },
2107 { 8, alc880_fivestack_ch8_init },
2112 * ALC880 6-stack model
2114 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2115 * Side = 0x05 (0x0f)
2116 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2117 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2120 static hda_nid_t alc880_6st_dac_nids[4] = {
2121 /* front, rear, clfe, rear_surr */
2122 0x02, 0x03, 0x04, 0x05
2125 static struct hda_input_mux alc880_6stack_capture_source = {
2129 { "Front Mic", 0x1 },
2135 /* fixed 8-channels */
2136 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2140 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2141 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2142 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2143 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2144 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2145 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2146 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2147 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2148 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2149 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2150 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2151 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2152 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2153 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2154 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2157 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2158 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2160 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2161 .name = "Channel Mode",
2162 .info = alc_ch_mode_info,
2163 .get = alc_ch_mode_get,
2164 .put = alc_ch_mode_put,
2173 * W810 has rear IO for:
2176 * Center/LFE (DAC 04)
2179 * The system also has a pair of internal speakers, and a headphone jack.
2180 * These are both connected to Line2 on the codec, hence to DAC 02.
2182 * There is a variable resistor to control the speaker or headphone
2183 * volume. This is a hardware-only device without a software API.
2185 * Plugging headphones in will disable the internal speakers. This is
2186 * implemented in hardware, not via the driver using jack sense. In
2187 * a similar fashion, plugging into the rear socket marked "front" will
2188 * disable both the speakers and headphones.
2190 * For input, there's a microphone jack, and an "audio in" jack.
2191 * These may not do anything useful with this driver yet, because I
2192 * haven't setup any initialization verbs for these yet...
2195 static hda_nid_t alc880_w810_dac_nids[3] = {
2196 /* front, rear/surround, clfe */
2200 /* fixed 6 channels */
2201 static struct hda_channel_mode alc880_w810_modes[1] = {
2205 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2206 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2207 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2208 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2209 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2210 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2211 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2212 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2213 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2214 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2215 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2223 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2224 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2228 static hda_nid_t alc880_z71v_dac_nids[1] = {
2231 #define ALC880_Z71V_HP_DAC 0x03
2233 /* fixed 2 channels */
2234 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2238 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2239 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2240 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2241 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2242 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2243 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2244 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2246 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2252 * ALC880 F1734 model
2254 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2255 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2258 static hda_nid_t alc880_f1734_dac_nids[1] = {
2261 #define ALC880_F1734_HP_DAC 0x02
2263 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2264 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2265 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2266 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2267 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2268 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2269 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2275 static struct hda_input_mux alc880_f1734_capture_source = {
2287 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2288 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2289 * Mic = 0x18, Line = 0x1a
2292 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2293 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2295 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2296 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2297 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2298 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2299 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2300 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2301 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2302 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2303 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2304 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2305 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2306 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2307 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2308 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2309 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2311 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2312 .name = "Channel Mode",
2313 .info = alc_ch_mode_info,
2314 .get = alc_ch_mode_get,
2315 .put = alc_ch_mode_put,
2321 * ALC880 ASUS W1V model
2323 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2324 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2325 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2328 /* additional mixers to alc880_asus_mixer */
2329 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2330 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2331 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2336 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2338 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2340 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2341 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2344 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2345 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2350 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2351 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2352 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2353 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2354 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2355 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2356 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2357 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2358 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2359 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2360 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2361 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2362 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2363 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2365 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2366 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2368 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2369 .name = "Channel Mode",
2370 .info = alc_ch_mode_info,
2371 .get = alc_ch_mode_get,
2372 .put = alc_ch_mode_put,
2377 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2378 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2379 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2380 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2381 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2382 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2383 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2384 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2385 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2386 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2387 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2391 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2392 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2393 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2394 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2395 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2397 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2402 * virtual master controls
2406 * slave controls for virtual master
2408 static const char *alc_slave_vols[] = {
2409 "Front Playback Volume",
2410 "Surround Playback Volume",
2411 "Center Playback Volume",
2412 "LFE Playback Volume",
2413 "Side Playback Volume",
2414 "Headphone Playback Volume",
2415 "Speaker Playback Volume",
2416 "Mono Playback Volume",
2417 "Line-Out Playback Volume",
2418 "PCM Playback Volume",
2422 static const char *alc_slave_sws[] = {
2423 "Front Playback Switch",
2424 "Surround Playback Switch",
2425 "Center Playback Switch",
2426 "LFE Playback Switch",
2427 "Side Playback Switch",
2428 "Headphone Playback Switch",
2429 "Speaker Playback Switch",
2430 "Mono Playback Switch",
2431 "IEC958 Playback Switch",
2432 "Line-Out Playback Switch",
2433 "PCM Playback Switch",
2438 * build control elements
2441 #define NID_MAPPING (-1)
2443 #define SUBDEV_SPEAKER_ (0 << 6)
2444 #define SUBDEV_HP_ (1 << 6)
2445 #define SUBDEV_LINE_ (2 << 6)
2446 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2447 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2448 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2450 static void alc_free_kctls(struct hda_codec *codec);
2452 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2453 /* additional beep mixers; the actual parameters are overwritten at build */
2454 static struct snd_kcontrol_new alc_beep_mixer[] = {
2455 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2456 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2461 static int alc_build_controls(struct hda_codec *codec)
2463 struct alc_spec *spec = codec->spec;
2464 struct snd_kcontrol *kctl;
2465 struct snd_kcontrol_new *knew;
2470 for (i = 0; i < spec->num_mixers; i++) {
2471 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2475 if (spec->cap_mixer) {
2476 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2480 if (spec->multiout.dig_out_nid) {
2481 err = snd_hda_create_spdif_out_ctls(codec,
2482 spec->multiout.dig_out_nid);
2485 if (!spec->no_analog) {
2486 err = snd_hda_create_spdif_share_sw(codec,
2490 spec->multiout.share_spdif = 1;
2493 if (spec->dig_in_nid) {
2494 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2499 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2500 /* create beep controls if needed */
2501 if (spec->beep_amp) {
2502 struct snd_kcontrol_new *knew;
2503 for (knew = alc_beep_mixer; knew->name; knew++) {
2504 struct snd_kcontrol *kctl;
2505 kctl = snd_ctl_new1(knew, codec);
2508 kctl->private_value = spec->beep_amp;
2509 err = snd_hda_ctl_add(codec, 0, kctl);
2516 /* if we have no master control, let's create it */
2517 if (!spec->no_analog &&
2518 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2519 unsigned int vmaster_tlv[4];
2520 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2521 HDA_OUTPUT, vmaster_tlv);
2522 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2523 vmaster_tlv, alc_slave_vols);
2527 if (!spec->no_analog &&
2528 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2529 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2530 NULL, alc_slave_sws);
2535 /* assign Capture Source enums to NID */
2536 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2538 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2539 for (i = 0; kctl && i < kctl->count; i++) {
2540 hda_nid_t *nids = spec->capsrc_nids;
2542 nids = spec->adc_nids;
2543 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2547 if (spec->cap_mixer) {
2548 const char *kname = kctl ? kctl->id.name : NULL;
2549 for (knew = spec->cap_mixer; knew->name; knew++) {
2550 if (kname && strcmp(knew->name, kname) == 0)
2552 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2553 for (i = 0; kctl && i < kctl->count; i++) {
2554 err = snd_hda_add_nid(codec, kctl, i,
2562 /* other nid->control mapping */
2563 for (i = 0; i < spec->num_mixers; i++) {
2564 for (knew = spec->mixers[i]; knew->name; knew++) {
2565 if (knew->iface != NID_MAPPING)
2567 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2570 u = knew->subdevice;
2571 for (j = 0; j < 4; j++, u >>= 8) {
2576 case SUBDEV_SPEAKER_:
2577 nid = spec->autocfg.speaker_pins[nid];
2580 nid = spec->autocfg.line_out_pins[nid];
2583 nid = spec->autocfg.hp_pins[nid];
2588 err = snd_hda_add_nid(codec, kctl, 0, nid);
2592 u = knew->private_value;
2593 for (j = 0; j < 4; j++, u >>= 8) {
2597 err = snd_hda_add_nid(codec, kctl, 0, nid);
2604 alc_free_kctls(codec); /* no longer needed */
2611 * initialize the codec volumes, etc
2615 * generic initialization of ADC, input mixers and output mixers
2617 static struct hda_verb alc880_volume_init_verbs[] = {
2619 * Unmute ADC0-2 and set the default input to mic-in
2621 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2623 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2624 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2625 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2626 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2628 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2630 * Note: PASD motherboards uses the Line In 2 as the input for front
2633 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2635 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2636 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2637 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2638 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2643 * Set up output mixers (0x0c - 0x0f)
2645 /* set vol=0 to output mixers */
2646 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2649 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2650 /* set up input amps for analog loopback */
2651 /* Amp Indices: DAC = 0, mixer = 1 */
2652 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2654 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2655 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2656 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2657 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2658 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2659 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2665 * 3-stack pin configuration:
2666 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2668 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2670 * preset connection lists of input pins
2671 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2673 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2674 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2675 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2678 * Set pin mode and muting
2680 /* set front pin widgets 0x14 for output */
2681 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2682 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2683 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2684 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2685 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2686 /* Mic2 (as headphone out) for HP output */
2687 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2689 /* Line In pin widget for input */
2690 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2692 /* Line2 (as front mic) pin widget for input and vref at 80% */
2693 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2694 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2695 /* CD pin widget for input */
2696 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2702 * 5-stack pin configuration:
2703 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2704 * line-in/side = 0x1a, f-mic = 0x1b
2706 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2708 * preset connection lists of input pins
2709 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2711 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2712 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2715 * Set pin mode and muting
2717 /* set pin widgets 0x14-0x17 for output */
2718 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2720 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2721 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2722 /* unmute pins for output (no gain on this amp) */
2723 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2724 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2725 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2726 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2728 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2729 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2730 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2731 /* Mic2 (as headphone out) for HP output */
2732 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2733 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 /* Line In pin widget for input */
2735 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2736 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2737 /* Line2 (as front mic) pin widget for input and vref at 80% */
2738 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2739 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2740 /* CD pin widget for input */
2741 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2747 * W810 pin configuration:
2748 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2750 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2751 /* hphone/speaker input selector: front DAC */
2752 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2754 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2755 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2756 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2757 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2758 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2759 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2761 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2762 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2768 * Z71V pin configuration:
2769 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2771 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2777 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2778 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2779 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2780 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2786 * 6-stack pin configuration:
2787 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2788 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2790 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2791 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2793 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2794 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2795 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2796 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2797 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2798 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2799 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2800 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2802 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2803 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2804 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2805 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2806 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2807 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2808 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2809 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2816 * Uniwill pin configuration:
2817 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2820 static struct hda_verb alc880_uniwill_init_verbs[] = {
2821 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2826 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2827 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2828 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2829 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2830 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2831 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2833 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2834 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2835 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2836 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2838 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2839 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2840 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2841 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2842 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2843 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2844 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2845 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2846 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2848 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2849 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2856 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2858 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2859 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2861 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2862 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2865 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2866 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2867 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2868 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2869 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2870 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2871 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2872 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2874 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2876 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2877 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2878 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2879 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2881 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2882 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2887 static struct hda_verb alc880_beep_init_verbs[] = {
2888 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2892 /* auto-toggle front mic */
2893 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2895 unsigned int present;
2898 present = snd_hda_jack_detect(codec, 0x18);
2899 bits = present ? HDA_AMP_MUTE : 0;
2900 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2903 static void alc880_uniwill_setup(struct hda_codec *codec)
2905 struct alc_spec *spec = codec->spec;
2907 spec->autocfg.hp_pins[0] = 0x14;
2908 spec->autocfg.speaker_pins[0] = 0x15;
2909 spec->autocfg.speaker_pins[0] = 0x16;
2912 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2914 alc_automute_amp(codec);
2915 alc880_uniwill_mic_automute(codec);
2918 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2921 /* Looks like the unsol event is incompatible with the standard
2922 * definition. 4bit tag is placed at 28 bit!
2924 switch (res >> 28) {
2925 case ALC880_MIC_EVENT:
2926 alc880_uniwill_mic_automute(codec);
2929 alc_automute_amp_unsol_event(codec, res);
2934 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2936 struct alc_spec *spec = codec->spec;
2938 spec->autocfg.hp_pins[0] = 0x14;
2939 spec->autocfg.speaker_pins[0] = 0x15;
2942 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2944 unsigned int present;
2946 present = snd_hda_codec_read(codec, 0x21, 0,
2947 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2948 present &= HDA_AMP_VOLMASK;
2949 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2950 HDA_AMP_VOLMASK, present);
2951 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2952 HDA_AMP_VOLMASK, present);
2955 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2958 /* Looks like the unsol event is incompatible with the standard
2959 * definition. 4bit tag is placed at 28 bit!
2961 if ((res >> 28) == ALC880_DCVOL_EVENT)
2962 alc880_uniwill_p53_dcvol_automute(codec);
2964 alc_automute_amp_unsol_event(codec, res);
2968 * F1734 pin configuration:
2969 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2971 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2972 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2973 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2974 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2975 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2976 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2978 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2979 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2980 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2981 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2983 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2984 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2985 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2987 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2988 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2989 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2990 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2991 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2993 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2994 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3000 * ASUS pin configuration:
3001 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3003 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3004 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3005 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3006 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3007 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3009 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3010 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3011 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3012 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3013 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3014 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3015 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3016 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3018 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3019 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3020 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3021 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3022 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3024 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3026 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3031 /* Enable GPIO mask and set output */
3032 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3033 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3034 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3036 /* Clevo m520g init */
3037 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3038 /* headphone output */
3039 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3041 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3042 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3044 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3045 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3047 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3048 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3049 /* Mic1 (rear panel) */
3050 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3051 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3052 /* Mic2 (front panel) */
3053 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3054 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3057 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3058 /* change to EAPD mode */
3059 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3060 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3065 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3066 /* change to EAPD mode */
3067 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3068 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3070 /* Headphone output */
3071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3074 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3076 /* Line In pin widget for input */
3077 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3078 /* CD pin widget for input */
3079 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3080 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3081 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3083 /* change to EAPD mode */
3084 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3085 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3091 * LG m1 express dual
3094 * Rear Line-In/Out (blue): 0x14
3095 * Build-in Mic-In: 0x15
3097 * HP-Out (green): 0x1b
3098 * Mic-In/Out (red): 0x19
3102 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3103 static hda_nid_t alc880_lg_dac_nids[3] = {
3107 /* seems analog CD is not working */
3108 static struct hda_input_mux alc880_lg_capture_source = {
3113 { "Internal Mic", 0x6 },
3117 /* 2,4,6 channel modes */
3118 static struct hda_verb alc880_lg_ch2_init[] = {
3119 /* set line-in and mic-in to input */
3120 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3121 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3125 static struct hda_verb alc880_lg_ch4_init[] = {
3126 /* set line-in to out and mic-in to input */
3127 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3128 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3132 static struct hda_verb alc880_lg_ch6_init[] = {
3133 /* set line-in and mic-in to output */
3134 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3135 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3139 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3140 { 2, alc880_lg_ch2_init },
3141 { 4, alc880_lg_ch4_init },
3142 { 6, alc880_lg_ch6_init },
3145 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3147 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3148 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3149 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3150 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3151 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3152 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3153 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3155 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3156 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3157 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3158 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3159 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3161 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3162 .name = "Channel Mode",
3163 .info = alc_ch_mode_info,
3164 .get = alc_ch_mode_get,
3165 .put = alc_ch_mode_put,
3170 static struct hda_verb alc880_lg_init_verbs[] = {
3171 /* set capture source to mic-in */
3172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3173 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3174 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3175 /* mute all amp mixer inputs */
3176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3177 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3179 /* line-in to input */
3180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3184 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3186 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3187 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3188 /* mic-in to input */
3189 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3190 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3193 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3194 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3195 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3197 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3201 /* toggle speaker-output according to the hp-jack state */
3202 static void alc880_lg_setup(struct hda_codec *codec)
3204 struct alc_spec *spec = codec->spec;
3206 spec->autocfg.hp_pins[0] = 0x1b;
3207 spec->autocfg.speaker_pins[0] = 0x17;
3216 * Built-in Mic-In: 0x19
3222 static struct hda_input_mux alc880_lg_lw_capture_source = {
3226 { "Internal Mic", 0x1 },
3231 #define alc880_lg_lw_modes alc880_threestack_modes
3233 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3234 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3235 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3236 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3237 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3238 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3239 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3240 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3241 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3242 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3243 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3246 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3247 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3249 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3250 .name = "Channel Mode",
3251 .info = alc_ch_mode_info,
3252 .get = alc_ch_mode_get,
3253 .put = alc_ch_mode_put,
3258 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3259 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3260 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3261 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3263 /* set capture source to mic-in */
3264 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3265 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3266 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3269 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3270 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3272 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3273 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3274 /* mic-in to input */
3275 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3276 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3278 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3279 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3281 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3285 /* toggle speaker-output according to the hp-jack state */
3286 static void alc880_lg_lw_setup(struct hda_codec *codec)
3288 struct alc_spec *spec = codec->spec;
3290 spec->autocfg.hp_pins[0] = 0x1b;
3291 spec->autocfg.speaker_pins[0] = 0x14;
3294 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3295 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3296 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3299 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3300 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3304 static struct hda_input_mux alc880_medion_rim_capture_source = {
3308 { "Internal Mic", 0x1 },
3312 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3313 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3315 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3316 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3318 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3319 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3320 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3321 /* Mic2 (as headphone out) for HP output */
3322 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3323 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3324 /* Internal Speaker */
3325 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3326 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3328 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3329 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3331 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3335 /* toggle speaker-output according to the hp-jack state */
3336 static void alc880_medion_rim_automute(struct hda_codec *codec)
3338 struct alc_spec *spec = codec->spec;
3339 alc_automute_amp(codec);
3341 if (spec->jack_present)
3342 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3344 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3347 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3350 /* Looks like the unsol event is incompatible with the standard
3351 * definition. 4bit tag is placed at 28 bit!
3353 if ((res >> 28) == ALC880_HP_EVENT)
3354 alc880_medion_rim_automute(codec);
3357 static void alc880_medion_rim_setup(struct hda_codec *codec)
3359 struct alc_spec *spec = codec->spec;
3361 spec->autocfg.hp_pins[0] = 0x14;
3362 spec->autocfg.speaker_pins[0] = 0x1b;
3365 #ifdef CONFIG_SND_HDA_POWER_SAVE
3366 static struct hda_amp_list alc880_loopbacks[] = {
3367 { 0x0b, HDA_INPUT, 0 },
3368 { 0x0b, HDA_INPUT, 1 },
3369 { 0x0b, HDA_INPUT, 2 },
3370 { 0x0b, HDA_INPUT, 3 },
3371 { 0x0b, HDA_INPUT, 4 },
3375 static struct hda_amp_list alc880_lg_loopbacks[] = {
3376 { 0x0b, HDA_INPUT, 1 },
3377 { 0x0b, HDA_INPUT, 6 },
3378 { 0x0b, HDA_INPUT, 7 },
3387 static int alc_init(struct hda_codec *codec)
3389 struct alc_spec *spec = codec->spec;
3393 alc_auto_init_amp(codec, spec->init_amp);
3395 for (i = 0; i < spec->num_init_verbs; i++)
3396 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3398 if (spec->init_hook)
3399 spec->init_hook(codec);
3404 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3406 struct alc_spec *spec = codec->spec;
3408 if (spec->unsol_event)
3409 spec->unsol_event(codec, res);
3412 #ifdef CONFIG_SND_HDA_POWER_SAVE
3413 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3415 struct alc_spec *spec = codec->spec;
3416 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3421 * Analog playback callbacks
3423 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3424 struct hda_codec *codec,
3425 struct snd_pcm_substream *substream)
3427 struct alc_spec *spec = codec->spec;
3428 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3432 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3433 struct hda_codec *codec,
3434 unsigned int stream_tag,
3435 unsigned int format,
3436 struct snd_pcm_substream *substream)
3438 struct alc_spec *spec = codec->spec;
3439 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3440 stream_tag, format, substream);
3443 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3444 struct hda_codec *codec,
3445 struct snd_pcm_substream *substream)
3447 struct alc_spec *spec = codec->spec;
3448 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3454 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3455 struct hda_codec *codec,
3456 struct snd_pcm_substream *substream)
3458 struct alc_spec *spec = codec->spec;
3459 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3462 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3463 struct hda_codec *codec,
3464 unsigned int stream_tag,
3465 unsigned int format,
3466 struct snd_pcm_substream *substream)
3468 struct alc_spec *spec = codec->spec;
3469 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3470 stream_tag, format, substream);
3473 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3474 struct hda_codec *codec,
3475 struct snd_pcm_substream *substream)
3477 struct alc_spec *spec = codec->spec;
3478 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3481 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3482 struct hda_codec *codec,
3483 struct snd_pcm_substream *substream)
3485 struct alc_spec *spec = codec->spec;
3486 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3492 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3493 struct hda_codec *codec,
3494 unsigned int stream_tag,
3495 unsigned int format,
3496 struct snd_pcm_substream *substream)
3498 struct alc_spec *spec = codec->spec;
3500 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3501 stream_tag, 0, format);
3505 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3506 struct hda_codec *codec,
3507 struct snd_pcm_substream *substream)
3509 struct alc_spec *spec = codec->spec;
3511 snd_hda_codec_cleanup_stream(codec,
3512 spec->adc_nids[substream->number + 1]);
3519 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3523 /* NID is set in alc_build_pcms */
3525 .open = alc880_playback_pcm_open,
3526 .prepare = alc880_playback_pcm_prepare,
3527 .cleanup = alc880_playback_pcm_cleanup
3531 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3535 /* NID is set in alc_build_pcms */
3538 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3542 /* NID is set in alc_build_pcms */
3545 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3546 .substreams = 2, /* can be overridden */
3549 /* NID is set in alc_build_pcms */
3551 .prepare = alc880_alt_capture_pcm_prepare,
3552 .cleanup = alc880_alt_capture_pcm_cleanup
3556 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3560 /* NID is set in alc_build_pcms */
3562 .open = alc880_dig_playback_pcm_open,
3563 .close = alc880_dig_playback_pcm_close,
3564 .prepare = alc880_dig_playback_pcm_prepare,
3565 .cleanup = alc880_dig_playback_pcm_cleanup
3569 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3573 /* NID is set in alc_build_pcms */
3576 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3577 static struct hda_pcm_stream alc_pcm_null_stream = {
3583 static int alc_build_pcms(struct hda_codec *codec)
3585 struct alc_spec *spec = codec->spec;
3586 struct hda_pcm *info = spec->pcm_rec;
3589 codec->num_pcms = 1;
3590 codec->pcm_info = info;
3592 if (spec->no_analog)
3595 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3596 "%s Analog", codec->chip_name);
3597 info->name = spec->stream_name_analog;
3599 if (spec->stream_analog_playback) {
3600 if (snd_BUG_ON(!spec->multiout.dac_nids))
3602 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3603 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3605 if (spec->stream_analog_capture) {
3606 if (snd_BUG_ON(!spec->adc_nids))
3608 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3609 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3612 if (spec->channel_mode) {
3613 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3614 for (i = 0; i < spec->num_channel_mode; i++) {
3615 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3616 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3622 /* SPDIF for stream index #1 */
3623 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3624 snprintf(spec->stream_name_digital,
3625 sizeof(spec->stream_name_digital),
3626 "%s Digital", codec->chip_name);
3627 codec->num_pcms = 2;
3628 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3629 info = spec->pcm_rec + 1;
3630 info->name = spec->stream_name_digital;
3631 if (spec->dig_out_type)
3632 info->pcm_type = spec->dig_out_type;
3634 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3635 if (spec->multiout.dig_out_nid &&
3636 spec->stream_digital_playback) {
3637 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3638 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3640 if (spec->dig_in_nid &&
3641 spec->stream_digital_capture) {
3642 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3643 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3645 /* FIXME: do we need this for all Realtek codec models? */
3646 codec->spdif_status_reset = 1;
3649 if (spec->no_analog)
3652 /* If the use of more than one ADC is requested for the current
3653 * model, configure a second analog capture-only PCM.
3655 /* Additional Analaog capture for index #2 */
3656 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3657 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3658 codec->num_pcms = 3;
3659 info = spec->pcm_rec + 2;
3660 info->name = spec->stream_name_analog;
3661 if (spec->alt_dac_nid) {
3662 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3663 *spec->stream_analog_alt_playback;
3664 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3667 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3668 alc_pcm_null_stream;
3669 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3671 if (spec->num_adc_nids > 1) {
3672 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3673 *spec->stream_analog_alt_capture;
3674 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3676 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3677 spec->num_adc_nids - 1;
3679 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3680 alc_pcm_null_stream;
3681 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3688 static inline void alc_shutup(struct hda_codec *codec)
3690 snd_hda_shutup_pins(codec);
3693 static void alc_free_kctls(struct hda_codec *codec)
3695 struct alc_spec *spec = codec->spec;
3697 if (spec->kctls.list) {
3698 struct snd_kcontrol_new *kctl = spec->kctls.list;
3700 for (i = 0; i < spec->kctls.used; i++)
3701 kfree(kctl[i].name);
3703 snd_array_free(&spec->kctls);
3706 static void alc_free(struct hda_codec *codec)
3708 struct alc_spec *spec = codec->spec;
3714 alc_free_kctls(codec);
3716 snd_hda_detach_beep_device(codec);
3719 #ifdef CONFIG_SND_HDA_POWER_SAVE
3720 static void alc_power_eapd(struct hda_codec *codec)
3722 /* We currently only handle front, HP */
3723 switch (codec->vendor_id) {
3725 set_eapd(codec, 0x0f, 0);
3726 set_eapd(codec, 0x10, 0);
3739 set_eapd(codec, 0x14, 0);
3740 set_eapd(codec, 0x15, 0);
3745 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3747 struct alc_spec *spec = codec->spec;
3749 if (spec && spec->power_hook)
3750 spec->power_hook(codec);
3755 #ifdef SND_HDA_NEEDS_RESUME
3756 static int alc_resume(struct hda_codec *codec)
3758 codec->patch_ops.init(codec);
3759 snd_hda_codec_resume_amp(codec);
3760 snd_hda_codec_resume_cache(codec);
3767 static struct hda_codec_ops alc_patch_ops = {
3768 .build_controls = alc_build_controls,
3769 .build_pcms = alc_build_pcms,
3772 .unsol_event = alc_unsol_event,
3773 #ifdef SND_HDA_NEEDS_RESUME
3774 .resume = alc_resume,
3776 #ifdef CONFIG_SND_HDA_POWER_SAVE
3777 .suspend = alc_suspend,
3778 .check_power_status = alc_check_power_status,
3780 .reboot_notify = alc_shutup,
3785 * Test configuration for debugging
3787 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3790 #ifdef CONFIG_SND_DEBUG
3791 static hda_nid_t alc880_test_dac_nids[4] = {
3792 0x02, 0x03, 0x04, 0x05
3795 static struct hda_input_mux alc880_test_capture_source = {
3804 { "Surround", 0x6 },
3808 static struct hda_channel_mode alc880_test_modes[4] = {
3815 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3816 struct snd_ctl_elem_info *uinfo)
3818 static char *texts[] = {
3819 "N/A", "Line Out", "HP Out",
3820 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3822 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3824 uinfo->value.enumerated.items = 8;
3825 if (uinfo->value.enumerated.item >= 8)
3826 uinfo->value.enumerated.item = 7;
3827 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3831 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3832 struct snd_ctl_elem_value *ucontrol)
3834 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3835 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3836 unsigned int pin_ctl, item = 0;
3838 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3839 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3840 if (pin_ctl & AC_PINCTL_OUT_EN) {
3841 if (pin_ctl & AC_PINCTL_HP_EN)
3845 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3846 switch (pin_ctl & AC_PINCTL_VREFEN) {
3847 case AC_PINCTL_VREF_HIZ: item = 3; break;
3848 case AC_PINCTL_VREF_50: item = 4; break;
3849 case AC_PINCTL_VREF_GRD: item = 5; break;
3850 case AC_PINCTL_VREF_80: item = 6; break;
3851 case AC_PINCTL_VREF_100: item = 7; break;
3854 ucontrol->value.enumerated.item[0] = item;
3858 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3859 struct snd_ctl_elem_value *ucontrol)
3861 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3862 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3863 static unsigned int ctls[] = {
3864 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3865 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3866 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3867 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3868 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3869 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3871 unsigned int old_ctl, new_ctl;
3873 old_ctl = snd_hda_codec_read(codec, nid, 0,
3874 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3875 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3876 if (old_ctl != new_ctl) {
3878 snd_hda_codec_write_cache(codec, nid, 0,
3879 AC_VERB_SET_PIN_WIDGET_CONTROL,
3881 val = ucontrol->value.enumerated.item[0] >= 3 ?
3883 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3890 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3891 struct snd_ctl_elem_info *uinfo)
3893 static char *texts[] = {
3894 "Front", "Surround", "CLFE", "Side"
3896 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3898 uinfo->value.enumerated.items = 4;
3899 if (uinfo->value.enumerated.item >= 4)
3900 uinfo->value.enumerated.item = 3;
3901 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3905 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3906 struct snd_ctl_elem_value *ucontrol)
3908 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3909 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3912 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3913 ucontrol->value.enumerated.item[0] = sel & 3;
3917 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3918 struct snd_ctl_elem_value *ucontrol)
3920 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3921 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3924 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3925 if (ucontrol->value.enumerated.item[0] != sel) {
3926 sel = ucontrol->value.enumerated.item[0] & 3;
3927 snd_hda_codec_write_cache(codec, nid, 0,
3928 AC_VERB_SET_CONNECT_SEL, sel);
3934 #define PIN_CTL_TEST(xname,nid) { \
3935 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3937 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3938 .info = alc_test_pin_ctl_info, \
3939 .get = alc_test_pin_ctl_get, \
3940 .put = alc_test_pin_ctl_put, \
3941 .private_value = nid \
3944 #define PIN_SRC_TEST(xname,nid) { \
3945 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3947 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3948 .info = alc_test_pin_src_info, \
3949 .get = alc_test_pin_src_get, \
3950 .put = alc_test_pin_src_put, \
3951 .private_value = nid \
3954 static struct snd_kcontrol_new alc880_test_mixer[] = {
3955 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3956 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3957 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3958 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3959 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3960 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3961 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3962 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3963 PIN_CTL_TEST("Front Pin Mode", 0x14),
3964 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3965 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3966 PIN_CTL_TEST("Side Pin Mode", 0x17),
3967 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3968 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3969 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3970 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3971 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3972 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3973 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3974 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3975 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3976 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3977 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3978 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3979 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3980 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3981 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3982 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3983 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3984 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3986 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3987 .name = "Channel Mode",
3988 .info = alc_ch_mode_info,
3989 .get = alc_ch_mode_get,
3990 .put = alc_ch_mode_put,
3995 static struct hda_verb alc880_test_init_verbs[] = {
3996 /* Unmute inputs of 0x0c - 0x0f */
3997 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3999 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4000 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4001 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4002 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4003 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4004 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4005 /* Vol output for 0x0c-0x0f */
4006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4007 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4008 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4009 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4010 /* Set output pins 0x14-0x17 */
4011 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4013 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4014 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4015 /* Unmute output pins 0x14-0x17 */
4016 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4018 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4019 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4020 /* Set input pins 0x18-0x1c */
4021 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4022 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4023 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4024 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4025 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4026 /* Mute input pins 0x18-0x1b */
4027 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4028 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4029 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4030 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4033 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4034 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4035 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4036 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4037 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4038 /* Analog input/passthru */
4039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4051 static const char *alc880_models[ALC880_MODEL_LAST] = {
4052 [ALC880_3ST] = "3stack",
4053 [ALC880_TCL_S700] = "tcl",
4054 [ALC880_3ST_DIG] = "3stack-digout",
4055 [ALC880_CLEVO] = "clevo",
4056 [ALC880_5ST] = "5stack",
4057 [ALC880_5ST_DIG] = "5stack-digout",
4058 [ALC880_W810] = "w810",
4059 [ALC880_Z71V] = "z71v",
4060 [ALC880_6ST] = "6stack",
4061 [ALC880_6ST_DIG] = "6stack-digout",
4062 [ALC880_ASUS] = "asus",
4063 [ALC880_ASUS_W1V] = "asus-w1v",
4064 [ALC880_ASUS_DIG] = "asus-dig",
4065 [ALC880_ASUS_DIG2] = "asus-dig2",
4066 [ALC880_UNIWILL_DIG] = "uniwill",
4067 [ALC880_UNIWILL_P53] = "uniwill-p53",
4068 [ALC880_FUJITSU] = "fujitsu",
4069 [ALC880_F1734] = "F1734",
4071 [ALC880_LG_LW] = "lg-lw",
4072 [ALC880_MEDION_RIM] = "medion",
4073 #ifdef CONFIG_SND_DEBUG
4074 [ALC880_TEST] = "test",
4076 [ALC880_AUTO] = "auto",
4079 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4080 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4081 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4082 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4083 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4084 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4085 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4086 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4087 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4088 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4089 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4090 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4091 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4092 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4093 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4094 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4095 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4096 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4097 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4098 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4099 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4100 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4101 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4102 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4103 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4104 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4105 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4106 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4107 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4108 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4109 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4110 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4111 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4112 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4113 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4114 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4115 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4116 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4117 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4118 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4119 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4120 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4121 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4122 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4123 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4124 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4125 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4126 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4127 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4128 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4129 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4130 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4131 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4132 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4133 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4134 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4135 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4136 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4137 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4138 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4139 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4140 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4141 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4142 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4143 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4144 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4145 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4146 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4147 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4149 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4150 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4151 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4156 * ALC880 codec presets
4158 static struct alc_config_preset alc880_presets[] = {
4160 .mixers = { alc880_three_stack_mixer },
4161 .init_verbs = { alc880_volume_init_verbs,
4162 alc880_pin_3stack_init_verbs },
4163 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4164 .dac_nids = alc880_dac_nids,
4165 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4166 .channel_mode = alc880_threestack_modes,
4168 .input_mux = &alc880_capture_source,
4170 [ALC880_3ST_DIG] = {
4171 .mixers = { alc880_three_stack_mixer },
4172 .init_verbs = { alc880_volume_init_verbs,
4173 alc880_pin_3stack_init_verbs },
4174 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4175 .dac_nids = alc880_dac_nids,
4176 .dig_out_nid = ALC880_DIGOUT_NID,
4177 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4178 .channel_mode = alc880_threestack_modes,
4180 .input_mux = &alc880_capture_source,
4182 [ALC880_TCL_S700] = {
4183 .mixers = { alc880_tcl_s700_mixer },
4184 .init_verbs = { alc880_volume_init_verbs,
4185 alc880_pin_tcl_S700_init_verbs,
4186 alc880_gpio2_init_verbs },
4187 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4188 .dac_nids = alc880_dac_nids,
4189 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4190 .num_adc_nids = 1, /* single ADC */
4192 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4193 .channel_mode = alc880_2_jack_modes,
4194 .input_mux = &alc880_capture_source,
4197 .mixers = { alc880_three_stack_mixer,
4198 alc880_five_stack_mixer},
4199 .init_verbs = { alc880_volume_init_verbs,
4200 alc880_pin_5stack_init_verbs },
4201 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4202 .dac_nids = alc880_dac_nids,
4203 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4204 .channel_mode = alc880_fivestack_modes,
4205 .input_mux = &alc880_capture_source,
4207 [ALC880_5ST_DIG] = {
4208 .mixers = { alc880_three_stack_mixer,
4209 alc880_five_stack_mixer },
4210 .init_verbs = { alc880_volume_init_verbs,
4211 alc880_pin_5stack_init_verbs },
4212 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4213 .dac_nids = alc880_dac_nids,
4214 .dig_out_nid = ALC880_DIGOUT_NID,
4215 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4216 .channel_mode = alc880_fivestack_modes,
4217 .input_mux = &alc880_capture_source,
4220 .mixers = { alc880_six_stack_mixer },
4221 .init_verbs = { alc880_volume_init_verbs,
4222 alc880_pin_6stack_init_verbs },
4223 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4224 .dac_nids = alc880_6st_dac_nids,
4225 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4226 .channel_mode = alc880_sixstack_modes,
4227 .input_mux = &alc880_6stack_capture_source,
4229 [ALC880_6ST_DIG] = {
4230 .mixers = { alc880_six_stack_mixer },
4231 .init_verbs = { alc880_volume_init_verbs,
4232 alc880_pin_6stack_init_verbs },
4233 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4234 .dac_nids = alc880_6st_dac_nids,
4235 .dig_out_nid = ALC880_DIGOUT_NID,
4236 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4237 .channel_mode = alc880_sixstack_modes,
4238 .input_mux = &alc880_6stack_capture_source,
4241 .mixers = { alc880_w810_base_mixer },
4242 .init_verbs = { alc880_volume_init_verbs,
4243 alc880_pin_w810_init_verbs,
4244 alc880_gpio2_init_verbs },
4245 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4246 .dac_nids = alc880_w810_dac_nids,
4247 .dig_out_nid = ALC880_DIGOUT_NID,
4248 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4249 .channel_mode = alc880_w810_modes,
4250 .input_mux = &alc880_capture_source,
4253 .mixers = { alc880_z71v_mixer },
4254 .init_verbs = { alc880_volume_init_verbs,
4255 alc880_pin_z71v_init_verbs },
4256 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4257 .dac_nids = alc880_z71v_dac_nids,
4258 .dig_out_nid = ALC880_DIGOUT_NID,
4260 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4261 .channel_mode = alc880_2_jack_modes,
4262 .input_mux = &alc880_capture_source,
4265 .mixers = { alc880_f1734_mixer },
4266 .init_verbs = { alc880_volume_init_verbs,
4267 alc880_pin_f1734_init_verbs },
4268 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4269 .dac_nids = alc880_f1734_dac_nids,
4271 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4272 .channel_mode = alc880_2_jack_modes,
4273 .input_mux = &alc880_f1734_capture_source,
4274 .unsol_event = alc880_uniwill_p53_unsol_event,
4275 .setup = alc880_uniwill_p53_setup,
4276 .init_hook = alc_automute_amp,
4279 .mixers = { alc880_asus_mixer },
4280 .init_verbs = { alc880_volume_init_verbs,
4281 alc880_pin_asus_init_verbs,
4282 alc880_gpio1_init_verbs },
4283 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4284 .dac_nids = alc880_asus_dac_nids,
4285 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4286 .channel_mode = alc880_asus_modes,
4288 .input_mux = &alc880_capture_source,
4290 [ALC880_ASUS_DIG] = {
4291 .mixers = { alc880_asus_mixer },
4292 .init_verbs = { alc880_volume_init_verbs,
4293 alc880_pin_asus_init_verbs,
4294 alc880_gpio1_init_verbs },
4295 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4296 .dac_nids = alc880_asus_dac_nids,
4297 .dig_out_nid = ALC880_DIGOUT_NID,
4298 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4299 .channel_mode = alc880_asus_modes,
4301 .input_mux = &alc880_capture_source,
4303 [ALC880_ASUS_DIG2] = {
4304 .mixers = { alc880_asus_mixer },
4305 .init_verbs = { alc880_volume_init_verbs,
4306 alc880_pin_asus_init_verbs,
4307 alc880_gpio2_init_verbs }, /* use GPIO2 */
4308 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4309 .dac_nids = alc880_asus_dac_nids,
4310 .dig_out_nid = ALC880_DIGOUT_NID,
4311 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4312 .channel_mode = alc880_asus_modes,
4314 .input_mux = &alc880_capture_source,
4316 [ALC880_ASUS_W1V] = {
4317 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4318 .init_verbs = { alc880_volume_init_verbs,
4319 alc880_pin_asus_init_verbs,
4320 alc880_gpio1_init_verbs },
4321 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4322 .dac_nids = alc880_asus_dac_nids,
4323 .dig_out_nid = ALC880_DIGOUT_NID,
4324 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4325 .channel_mode = alc880_asus_modes,
4327 .input_mux = &alc880_capture_source,
4329 [ALC880_UNIWILL_DIG] = {
4330 .mixers = { alc880_asus_mixer },
4331 .init_verbs = { alc880_volume_init_verbs,
4332 alc880_pin_asus_init_verbs },
4333 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4334 .dac_nids = alc880_asus_dac_nids,
4335 .dig_out_nid = ALC880_DIGOUT_NID,
4336 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4337 .channel_mode = alc880_asus_modes,
4339 .input_mux = &alc880_capture_source,
4341 [ALC880_UNIWILL] = {
4342 .mixers = { alc880_uniwill_mixer },
4343 .init_verbs = { alc880_volume_init_verbs,
4344 alc880_uniwill_init_verbs },
4345 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4346 .dac_nids = alc880_asus_dac_nids,
4347 .dig_out_nid = ALC880_DIGOUT_NID,
4348 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4349 .channel_mode = alc880_threestack_modes,
4351 .input_mux = &alc880_capture_source,
4352 .unsol_event = alc880_uniwill_unsol_event,
4353 .setup = alc880_uniwill_setup,
4354 .init_hook = alc880_uniwill_init_hook,
4356 [ALC880_UNIWILL_P53] = {
4357 .mixers = { alc880_uniwill_p53_mixer },
4358 .init_verbs = { alc880_volume_init_verbs,
4359 alc880_uniwill_p53_init_verbs },
4360 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4361 .dac_nids = alc880_asus_dac_nids,
4362 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4363 .channel_mode = alc880_threestack_modes,
4364 .input_mux = &alc880_capture_source,
4365 .unsol_event = alc880_uniwill_p53_unsol_event,
4366 .setup = alc880_uniwill_p53_setup,
4367 .init_hook = alc_automute_amp,
4369 [ALC880_FUJITSU] = {
4370 .mixers = { alc880_fujitsu_mixer },
4371 .init_verbs = { alc880_volume_init_verbs,
4372 alc880_uniwill_p53_init_verbs,
4373 alc880_beep_init_verbs },
4374 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4375 .dac_nids = alc880_dac_nids,
4376 .dig_out_nid = ALC880_DIGOUT_NID,
4377 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4378 .channel_mode = alc880_2_jack_modes,
4379 .input_mux = &alc880_capture_source,
4380 .unsol_event = alc880_uniwill_p53_unsol_event,
4381 .setup = alc880_uniwill_p53_setup,
4382 .init_hook = alc_automute_amp,
4385 .mixers = { alc880_three_stack_mixer },
4386 .init_verbs = { alc880_volume_init_verbs,
4387 alc880_pin_clevo_init_verbs },
4388 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4389 .dac_nids = alc880_dac_nids,
4391 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4392 .channel_mode = alc880_threestack_modes,
4394 .input_mux = &alc880_capture_source,
4397 .mixers = { alc880_lg_mixer },
4398 .init_verbs = { alc880_volume_init_verbs,
4399 alc880_lg_init_verbs },
4400 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4401 .dac_nids = alc880_lg_dac_nids,
4402 .dig_out_nid = ALC880_DIGOUT_NID,
4403 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4404 .channel_mode = alc880_lg_ch_modes,
4406 .input_mux = &alc880_lg_capture_source,
4407 .unsol_event = alc_automute_amp_unsol_event,
4408 .setup = alc880_lg_setup,
4409 .init_hook = alc_automute_amp,
4410 #ifdef CONFIG_SND_HDA_POWER_SAVE
4411 .loopbacks = alc880_lg_loopbacks,
4415 .mixers = { alc880_lg_lw_mixer },
4416 .init_verbs = { alc880_volume_init_verbs,
4417 alc880_lg_lw_init_verbs },
4418 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4419 .dac_nids = alc880_dac_nids,
4420 .dig_out_nid = ALC880_DIGOUT_NID,
4421 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4422 .channel_mode = alc880_lg_lw_modes,
4423 .input_mux = &alc880_lg_lw_capture_source,
4424 .unsol_event = alc_automute_amp_unsol_event,
4425 .setup = alc880_lg_lw_setup,
4426 .init_hook = alc_automute_amp,
4428 [ALC880_MEDION_RIM] = {
4429 .mixers = { alc880_medion_rim_mixer },
4430 .init_verbs = { alc880_volume_init_verbs,
4431 alc880_medion_rim_init_verbs,
4432 alc_gpio2_init_verbs },
4433 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4434 .dac_nids = alc880_dac_nids,
4435 .dig_out_nid = ALC880_DIGOUT_NID,
4436 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4437 .channel_mode = alc880_2_jack_modes,
4438 .input_mux = &alc880_medion_rim_capture_source,
4439 .unsol_event = alc880_medion_rim_unsol_event,
4440 .setup = alc880_medion_rim_setup,
4441 .init_hook = alc880_medion_rim_automute,
4443 #ifdef CONFIG_SND_DEBUG
4445 .mixers = { alc880_test_mixer },
4446 .init_verbs = { alc880_test_init_verbs },
4447 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4448 .dac_nids = alc880_test_dac_nids,
4449 .dig_out_nid = ALC880_DIGOUT_NID,
4450 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4451 .channel_mode = alc880_test_modes,
4452 .input_mux = &alc880_test_capture_source,
4458 * Automatic parse of I/O pins from the BIOS configuration
4463 ALC_CTL_WIDGET_MUTE,
4466 static struct snd_kcontrol_new alc880_control_templates[] = {
4467 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4468 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4469 HDA_BIND_MUTE(NULL, 0, 0, 0),
4472 /* add dynamic controls */
4473 static int add_control(struct alc_spec *spec, int type, const char *name,
4476 struct snd_kcontrol_new *knew;
4478 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4479 knew = snd_array_new(&spec->kctls);
4482 *knew = alc880_control_templates[type];
4483 knew->name = kstrdup(name, GFP_KERNEL);
4486 if (get_amp_nid_(val))
4487 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4488 knew->private_value = val;
4492 static int add_control_with_pfx(struct alc_spec *spec, int type,
4493 const char *pfx, const char *dir,
4494 const char *sfx, unsigned long val)
4497 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4498 return add_control(spec, type, name, val);
4501 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4502 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4503 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4504 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4506 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4507 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4508 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4509 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4510 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4511 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4512 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4513 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4514 #define ALC880_PIN_CD_NID 0x1c
4516 /* fill in the dac_nids table from the parsed pin configuration */
4517 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4518 const struct auto_pin_cfg *cfg)
4524 memset(assigned, 0, sizeof(assigned));
4525 spec->multiout.dac_nids = spec->private_dac_nids;
4527 /* check the pins hardwired to audio widget */
4528 for (i = 0; i < cfg->line_outs; i++) {
4529 nid = cfg->line_out_pins[i];
4530 if (alc880_is_fixed_pin(nid)) {
4531 int idx = alc880_fixed_pin_idx(nid);
4532 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4536 /* left pins can be connect to any audio widget */
4537 for (i = 0; i < cfg->line_outs; i++) {
4538 nid = cfg->line_out_pins[i];
4539 if (alc880_is_fixed_pin(nid))
4541 /* search for an empty channel */
4542 for (j = 0; j < cfg->line_outs; j++) {
4544 spec->multiout.dac_nids[i] =
4545 alc880_idx_to_dac(j);
4551 spec->multiout.num_dacs = cfg->line_outs;
4555 /* add playback controls from the parsed DAC table */
4556 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4557 const struct auto_pin_cfg *cfg)
4559 static const char *chname[4] = {
4560 "Front", "Surround", NULL /*CLFE*/, "Side"
4565 for (i = 0; i < cfg->line_outs; i++) {
4566 if (!spec->multiout.dac_nids[i])
4568 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4571 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4573 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4577 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4579 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4583 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4585 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4589 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4591 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4597 if (cfg->line_outs == 1 &&
4598 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4602 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4603 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4607 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4608 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4617 /* add playback controls for speaker and HP outputs */
4618 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4627 if (alc880_is_fixed_pin(pin)) {
4628 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4629 /* specify the DAC as the extra output */
4630 if (!spec->multiout.hp_nid)
4631 spec->multiout.hp_nid = nid;
4633 spec->multiout.extra_out_nid[0] = nid;
4634 /* control HP volume/switch on the output mixer amp */
4635 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4636 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4637 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4640 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4641 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4644 } else if (alc880_is_multi_pin(pin)) {
4645 /* set manual connection */
4646 /* we have only a switch on HP-out PIN */
4647 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4648 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4655 /* create input playback/capture controls for the given pin */
4656 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4657 const char *ctlname,
4658 int idx, hda_nid_t mix_nid)
4662 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4663 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4666 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4667 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4673 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4675 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4676 return (pincap & AC_PINCAP_IN) != 0;
4679 /* create playback/capture controls for input pins */
4680 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4681 const struct auto_pin_cfg *cfg,
4683 hda_nid_t cap1, hda_nid_t cap2)
4685 struct alc_spec *spec = codec->spec;
4686 struct hda_input_mux *imux = &spec->private_imux[0];
4689 for (i = 0; i < AUTO_PIN_LAST; i++) {
4692 pin = cfg->input_pins[i];
4693 if (!alc_is_input_pin(codec, pin))
4697 idx = get_connection_index(codec, mixer, pin);
4699 err = new_analog_input(spec, pin,
4700 auto_pin_cfg_labels[i],
4709 idx = get_connection_index(codec, cap1, pin);
4710 if (idx < 0 && cap2)
4711 idx = get_connection_index(codec, cap2, pin);
4713 imux->items[imux->num_items].label =
4714 auto_pin_cfg_labels[i];
4715 imux->items[imux->num_items].index = idx;
4722 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4723 const struct auto_pin_cfg *cfg)
4725 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4728 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4729 unsigned int pin_type)
4731 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4734 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4738 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4739 hda_nid_t nid, int pin_type,
4742 alc_set_pin_output(codec, nid, pin_type);
4743 /* need the manual connection? */
4744 if (alc880_is_multi_pin(nid)) {
4745 struct alc_spec *spec = codec->spec;
4746 int idx = alc880_multi_pin_idx(nid);
4747 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4748 AC_VERB_SET_CONNECT_SEL,
4749 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4753 static int get_pin_type(int line_out_type)
4755 if (line_out_type == AUTO_PIN_HP_OUT)
4761 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4763 struct alc_spec *spec = codec->spec;
4766 for (i = 0; i < spec->autocfg.line_outs; i++) {
4767 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4768 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4769 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4773 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4775 struct alc_spec *spec = codec->spec;
4778 pin = spec->autocfg.speaker_pins[0];
4779 if (pin) /* connect to front */
4780 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4781 pin = spec->autocfg.hp_pins[0];
4782 if (pin) /* connect to front */
4783 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4786 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4788 struct alc_spec *spec = codec->spec;
4791 for (i = 0; i < AUTO_PIN_LAST; i++) {
4792 hda_nid_t nid = spec->autocfg.input_pins[i];
4793 if (alc_is_input_pin(codec, nid)) {
4794 alc_set_input_pin(codec, nid, i);
4795 if (nid != ALC880_PIN_CD_NID &&
4796 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4797 snd_hda_codec_write(codec, nid, 0,
4798 AC_VERB_SET_AMP_GAIN_MUTE,
4804 /* parse the BIOS configuration and set up the alc_spec */
4805 /* return 1 if successful, 0 if the proper config is not found,
4806 * or a negative error code
4808 static int alc880_parse_auto_config(struct hda_codec *codec)
4810 struct alc_spec *spec = codec->spec;
4812 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4814 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4818 if (!spec->autocfg.line_outs)
4819 return 0; /* can't find valid BIOS pin config */
4821 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4824 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4827 err = alc880_auto_create_extra_out(spec,
4828 spec->autocfg.speaker_pins[0],
4832 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4836 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4840 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4842 /* check multiple SPDIF-out (for recent codecs) */
4843 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4845 err = snd_hda_get_connections(codec,
4846 spec->autocfg.dig_out_pins[i],
4851 spec->multiout.dig_out_nid = dig_nid;
4853 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4854 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4856 spec->slave_dig_outs[i - 1] = dig_nid;
4859 if (spec->autocfg.dig_in_pin)
4860 spec->dig_in_nid = ALC880_DIGIN_NID;
4862 if (spec->kctls.list)
4863 add_mixer(spec, spec->kctls.list);
4865 add_verb(spec, alc880_volume_init_verbs);
4867 spec->num_mux_defs = 1;
4868 spec->input_mux = &spec->private_imux[0];
4870 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4875 /* additional initialization for auto-configuration model */
4876 static void alc880_auto_init(struct hda_codec *codec)
4878 struct alc_spec *spec = codec->spec;
4879 alc880_auto_init_multi_out(codec);
4880 alc880_auto_init_extra_out(codec);
4881 alc880_auto_init_analog_input(codec);
4882 if (spec->unsol_event)
4883 alc_inithook(codec);
4886 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4887 * one of two digital mic pins, e.g. on ALC272
4889 static void fixup_automic_adc(struct hda_codec *codec)
4891 struct alc_spec *spec = codec->spec;
4894 for (i = 0; i < spec->num_adc_nids; i++) {
4895 hda_nid_t cap = spec->capsrc_nids ?
4896 spec->capsrc_nids[i] : spec->adc_nids[i];
4899 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4902 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4905 spec->int_mic.mux_idx = iidx;
4906 spec->ext_mic.mux_idx = eidx;
4907 if (spec->capsrc_nids)
4908 spec->capsrc_nids += i;
4909 spec->adc_nids += i;
4910 spec->num_adc_nids = 1;
4913 snd_printd(KERN_INFO "hda_codec: %s: "
4914 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4915 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4916 spec->auto_mic = 0; /* disable auto-mic to be sure */
4919 /* choose the ADC/MUX containing the input pin and initialize the setup */
4920 static void fixup_single_adc(struct hda_codec *codec)
4922 struct alc_spec *spec = codec->spec;
4926 /* search for the input pin; there must be only one */
4927 for (i = 0; i < AUTO_PIN_LAST; i++) {
4928 if (spec->autocfg.input_pins[i]) {
4929 pin = spec->autocfg.input_pins[i];
4936 /* set the default connection to that pin */
4937 for (i = 0; i < spec->num_adc_nids; i++) {
4938 hda_nid_t cap = spec->capsrc_nids ?
4939 spec->capsrc_nids[i] : spec->adc_nids[i];
4942 idx = get_connection_index(codec, cap, pin);
4945 /* use only this ADC */
4946 if (spec->capsrc_nids)
4947 spec->capsrc_nids += i;
4948 spec->adc_nids += i;
4949 spec->num_adc_nids = 1;
4950 /* select or unmute this route */
4951 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4952 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4955 snd_hda_codec_write_cache(codec, cap, 0,
4956 AC_VERB_SET_CONNECT_SEL, idx);
4962 static void set_capture_mixer(struct hda_codec *codec)
4964 struct alc_spec *spec = codec->spec;
4965 static struct snd_kcontrol_new *caps[2][3] = {
4966 { alc_capture_mixer_nosrc1,
4967 alc_capture_mixer_nosrc2,
4968 alc_capture_mixer_nosrc3 },
4969 { alc_capture_mixer1,
4971 alc_capture_mixer3 },
4973 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4976 fixup_automic_adc(codec);
4977 else if (spec->input_mux) {
4978 if (spec->input_mux->num_items > 1)
4980 else if (spec->input_mux->num_items == 1)
4981 fixup_single_adc(codec);
4983 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4987 /* fill adc_nids (and capsrc_nids) containing all active input pins */
4988 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
4991 struct alc_spec *spec = codec->spec;
4993 hda_nid_t fallback_adc = 0, fallback_cap = 0;
4995 for (n = 0; n < num_nids; n++) {
4997 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5001 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5004 nconns = snd_hda_get_connections(codec, cap, conn,
5008 nconns = snd_hda_get_connections(codec, cap, conn,
5013 if (!fallback_adc) {
5017 for (i = 0; i < AUTO_PIN_LAST; i++) {
5018 hda_nid_t nid = spec->autocfg.input_pins[i];
5021 for (j = 0; j < nconns; j++) {
5028 if (i >= AUTO_PIN_LAST) {
5029 int num_adcs = spec->num_adc_nids;
5030 spec->private_adc_nids[num_adcs] = adc;
5031 spec->private_capsrc_nids[num_adcs] = cap;
5032 spec->num_adc_nids++;
5033 spec->adc_nids = spec->private_adc_nids;
5035 spec->capsrc_nids = spec->private_capsrc_nids;
5038 if (!spec->num_adc_nids) {
5039 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5040 " using fallback 0x%x\n",
5041 codec->chip_name, fallback_adc);
5042 spec->private_adc_nids[0] = fallback_adc;
5043 spec->adc_nids = spec->private_adc_nids;
5044 if (fallback_adc != fallback_cap) {
5045 spec->private_capsrc_nids[0] = fallback_cap;
5046 spec->capsrc_nids = spec->private_adc_nids;
5051 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5052 #define set_beep_amp(spec, nid, idx, dir) \
5053 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5055 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5059 * OK, here we have finally the patch for ALC880
5062 static int patch_alc880(struct hda_codec *codec)
5064 struct alc_spec *spec;
5068 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5074 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5077 if (board_config < 0) {
5078 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5080 board_config = ALC880_AUTO;
5083 if (board_config == ALC880_AUTO) {
5084 /* automatic parse from the BIOS config */
5085 err = alc880_parse_auto_config(codec);
5091 "hda_codec: Cannot set up configuration "
5092 "from BIOS. Using 3-stack mode...\n");
5093 board_config = ALC880_3ST;
5097 err = snd_hda_attach_beep_device(codec, 0x1);
5103 if (board_config != ALC880_AUTO)
5104 setup_preset(codec, &alc880_presets[board_config]);
5106 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5107 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5108 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5110 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5111 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5113 if (!spec->adc_nids && spec->input_mux) {
5114 /* check whether NID 0x07 is valid */
5115 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5117 wcap = get_wcaps_type(wcap);
5118 if (wcap != AC_WID_AUD_IN) {
5119 spec->adc_nids = alc880_adc_nids_alt;
5120 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5122 spec->adc_nids = alc880_adc_nids;
5123 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5126 set_capture_mixer(codec);
5127 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5129 spec->vmaster_nid = 0x0c;
5131 codec->patch_ops = alc_patch_ops;
5132 if (board_config == ALC880_AUTO)
5133 spec->init_hook = alc880_auto_init;
5134 #ifdef CONFIG_SND_HDA_POWER_SAVE
5135 if (!spec->loopback.amplist)
5136 spec->loopback.amplist = alc880_loopbacks;
5147 static hda_nid_t alc260_dac_nids[1] = {
5152 static hda_nid_t alc260_adc_nids[1] = {
5157 static hda_nid_t alc260_adc_nids_alt[1] = {
5162 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5163 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5165 static hda_nid_t alc260_dual_adc_nids[2] = {
5170 #define ALC260_DIGOUT_NID 0x03
5171 #define ALC260_DIGIN_NID 0x06
5173 static struct hda_input_mux alc260_capture_source = {
5177 { "Front Mic", 0x1 },
5183 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5184 * headphone jack and the internal CD lines since these are the only pins at
5185 * which audio can appear. For flexibility, also allow the option of
5186 * recording the mixer output on the second ADC (ADC0 doesn't have a
5187 * connection to the mixer output).
5189 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5193 { "Mic/Line", 0x0 },
5195 { "Headphone", 0x2 },
5201 { "Mic/Line", 0x0 },
5203 { "Headphone", 0x2 },
5210 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5211 * the Fujitsu S702x, but jacks are marked differently.
5213 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5220 { "Headphone", 0x5 },
5229 { "Headphone", 0x6 },
5235 /* Maxdata Favorit 100XS */
5236 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5240 { "Line/Mic", 0x0 },
5247 { "Line/Mic", 0x0 },
5255 * This is just place-holder, so there's something for alc_build_pcms to look
5256 * at when it calculates the maximum number of channels. ALC260 has no mixer
5257 * element which allows changing the channel mode, so the verb list is
5260 static struct hda_channel_mode alc260_modes[1] = {
5265 /* Mixer combinations
5267 * basic: base_output + input + pc_beep + capture
5268 * HP: base_output + input + capture_alt
5269 * HP_3013: hp_3013 + input + capture
5270 * fujitsu: fujitsu + capture
5271 * acer: acer + capture
5274 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5275 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5276 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5277 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5278 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5279 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5280 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5284 static struct snd_kcontrol_new alc260_input_mixer[] = {
5285 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5286 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5287 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5288 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5290 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5291 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5292 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5296 /* update HP, line and mono out pins according to the master switch */
5297 static void alc260_hp_master_update(struct hda_codec *codec,
5298 hda_nid_t hp, hda_nid_t line,
5301 struct alc_spec *spec = codec->spec;
5302 unsigned int val = spec->master_sw ? PIN_HP : 0;
5303 /* change HP and line-out pins */
5304 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5306 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5308 /* mono (speaker) depending on the HP jack sense */
5309 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5310 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5314 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5315 struct snd_ctl_elem_value *ucontrol)
5317 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5318 struct alc_spec *spec = codec->spec;
5319 *ucontrol->value.integer.value = spec->master_sw;
5323 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5324 struct snd_ctl_elem_value *ucontrol)
5326 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5327 struct alc_spec *spec = codec->spec;
5328 int val = !!*ucontrol->value.integer.value;
5329 hda_nid_t hp, line, mono;
5331 if (val == spec->master_sw)
5333 spec->master_sw = val;
5334 hp = (kcontrol->private_value >> 16) & 0xff;
5335 line = (kcontrol->private_value >> 8) & 0xff;
5336 mono = kcontrol->private_value & 0xff;
5337 alc260_hp_master_update(codec, hp, line, mono);
5341 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5343 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5344 .name = "Master Playback Switch",
5345 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5346 .info = snd_ctl_boolean_mono_info,
5347 .get = alc260_hp_master_sw_get,
5348 .put = alc260_hp_master_sw_put,
5349 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5351 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5352 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5353 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5354 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5355 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5357 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5361 static struct hda_verb alc260_hp_unsol_verbs[] = {
5362 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5366 static void alc260_hp_automute(struct hda_codec *codec)
5368 struct alc_spec *spec = codec->spec;
5370 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5371 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5374 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5376 if ((res >> 26) == ALC880_HP_EVENT)
5377 alc260_hp_automute(codec);
5380 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5382 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5383 .name = "Master Playback Switch",
5384 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5385 .info = snd_ctl_boolean_mono_info,
5386 .get = alc260_hp_master_sw_get,
5387 .put = alc260_hp_master_sw_put,
5388 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5390 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5391 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5392 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5393 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5394 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5395 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5396 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5397 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5401 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5402 .ops = &snd_hda_bind_vol,
5404 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5405 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5406 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5411 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5412 .ops = &snd_hda_bind_sw,
5414 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5415 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5420 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5421 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5422 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5423 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5424 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5428 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5429 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5433 static void alc260_hp_3013_automute(struct hda_codec *codec)
5435 struct alc_spec *spec = codec->spec;
5437 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5438 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5441 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5444 if ((res >> 26) == ALC880_HP_EVENT)
5445 alc260_hp_3013_automute(codec);
5448 static void alc260_hp_3012_automute(struct hda_codec *codec)
5450 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5452 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5454 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5456 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5460 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5463 if ((res >> 26) == ALC880_HP_EVENT)
5464 alc260_hp_3012_automute(codec);
5467 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5468 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5470 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5471 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5472 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5473 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5474 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5475 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5476 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5477 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5478 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5479 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5480 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5484 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5485 * versions of the ALC260 don't act on requests to enable mic bias from NID
5486 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5487 * datasheet doesn't mention this restriction. At this stage it's not clear
5488 * whether this behaviour is intentional or is a hardware bug in chip
5489 * revisions available in early 2006. Therefore for now allow the
5490 * "Headphone Jack Mode" control to span all choices, but if it turns out
5491 * that the lack of mic bias for this NID is intentional we could change the
5492 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5494 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5495 * don't appear to make the mic bias available from the "line" jack, even
5496 * though the NID used for this jack (0x14) can supply it. The theory is
5497 * that perhaps Acer have included blocking capacitors between the ALC260
5498 * and the output jack. If this turns out to be the case for all such
5499 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5500 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5502 * The C20x Tablet series have a mono internal speaker which is controlled
5503 * via the chip's Mono sum widget and pin complex, so include the necessary
5504 * controls for such models. On models without a "mono speaker" the control
5505 * won't do anything.
5507 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5508 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5509 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5510 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5511 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5513 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5515 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5516 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5517 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5518 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5519 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5520 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5521 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5522 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5526 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5528 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5529 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5530 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5531 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5532 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5533 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5534 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5538 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5539 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5541 static struct snd_kcontrol_new alc260_will_mixer[] = {
5542 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5543 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5544 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5545 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5546 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5547 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5548 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5549 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5550 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5551 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5555 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5556 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5558 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5559 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5560 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5562 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5563 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5564 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5565 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5566 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5567 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5568 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5573 * initialization verbs
5575 static struct hda_verb alc260_init_verbs[] = {
5576 /* Line In pin widget for input */
5577 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5578 /* CD pin widget for input */
5579 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5580 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5581 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5582 /* Mic2 (front panel) pin widget for input and vref at 80% */
5583 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5584 /* LINE-2 is used for line-out in rear */
5585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5586 /* select line-out */
5587 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5589 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5591 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5593 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5594 /* mute capture amp left and right */
5595 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5596 /* set connection select to line in (default select for this ADC) */
5597 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5598 /* mute capture amp left and right */
5599 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5600 /* set connection select to line in (default select for this ADC) */
5601 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5602 /* set vol=0 Line-Out mixer amp left and right */
5603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5604 /* unmute pin widget amp left and right (no gain on this amp) */
5605 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5606 /* set vol=0 HP mixer amp left and right */
5607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5608 /* unmute pin widget amp left and right (no gain on this amp) */
5609 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5610 /* set vol=0 Mono mixer amp left and right */
5611 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5612 /* unmute pin widget amp left and right (no gain on this amp) */
5613 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5614 /* unmute LINE-2 out pin */
5615 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5616 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5619 /* mute analog inputs */
5620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5623 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5625 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5626 /* mute Front out path */
5627 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5628 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5629 /* mute Headphone out path */
5630 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5632 /* mute Mono out path */
5633 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5634 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5638 #if 0 /* should be identical with alc260_init_verbs? */
5639 static struct hda_verb alc260_hp_init_verbs[] = {
5640 /* Headphone and output */
5641 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5643 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5644 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5645 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5646 /* Mic2 (front panel) pin widget for input and vref at 80% */
5647 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5648 /* Line In pin widget for input */
5649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5650 /* Line-2 pin widget for output */
5651 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5652 /* CD pin widget for input */
5653 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5654 /* unmute amp left and right */
5655 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5656 /* set connection select to line in (default select for this ADC) */
5657 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5658 /* unmute Line-Out mixer amp left and right (volume = 0) */
5659 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5660 /* mute pin widget amp left and right (no gain on this amp) */
5661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5662 /* unmute HP mixer amp left and right (volume = 0) */
5663 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5664 /* mute pin widget amp left and right (no gain on this amp) */
5665 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5666 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5669 /* mute analog inputs */
5670 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5671 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5673 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5674 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5675 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5676 /* Unmute Front out path */
5677 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5678 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5679 /* Unmute Headphone out path */
5680 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5681 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5682 /* Unmute Mono out path */
5683 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5684 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5689 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5690 /* Line out and output */
5691 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5693 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5694 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5695 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5696 /* Mic2 (front panel) pin widget for input and vref at 80% */
5697 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5698 /* Line In pin widget for input */
5699 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5700 /* Headphone pin widget for output */
5701 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5702 /* CD pin widget for input */
5703 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5704 /* unmute amp left and right */
5705 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5706 /* set connection select to line in (default select for this ADC) */
5707 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5708 /* unmute Line-Out mixer amp left and right (volume = 0) */
5709 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5710 /* mute pin widget amp left and right (no gain on this amp) */
5711 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5712 /* unmute HP mixer amp left and right (volume = 0) */
5713 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5714 /* mute pin widget amp left and right (no gain on this amp) */
5715 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5716 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5719 /* mute analog inputs */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5725 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5726 /* Unmute Front out path */
5727 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5728 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5729 /* Unmute Headphone out path */
5730 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5731 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5732 /* Unmute Mono out path */
5733 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5734 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5738 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5739 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5740 * audio = 0x16, internal speaker = 0x10.
5742 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5743 /* Disable all GPIOs */
5744 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5745 /* Internal speaker is connected to headphone pin */
5746 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5747 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5748 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5749 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5750 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5751 /* Ensure all other unused pins are disabled and muted. */
5752 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5753 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5754 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5755 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5756 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5757 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5758 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5761 /* Disable digital (SPDIF) pins */
5762 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5763 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5765 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5766 * when acting as an output.
5768 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5770 /* Start with output sum widgets muted and their output gains at min */
5771 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5772 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5773 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5774 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5775 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5776 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5777 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5778 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5779 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5781 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5782 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5783 /* Unmute Line1 pin widget output buffer since it starts as an output.
5784 * If the pin mode is changed by the user the pin mode control will
5785 * take care of enabling the pin's input/output buffers as needed.
5786 * Therefore there's no need to enable the input buffer at this
5789 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5790 /* Unmute input buffer of pin widget used for Line-in (no equiv
5793 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5795 /* Mute capture amp left and right */
5796 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5797 /* Set ADC connection select to match default mixer setting - line
5800 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5802 /* Do the same for the second ADC: mute capture input amp and
5803 * set ADC connection to line in (on mic1 pin)
5805 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5806 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5808 /* Mute all inputs to mixer widget (even unconnected ones) */
5809 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5810 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5811 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5812 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5813 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5814 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5815 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5816 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5821 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5822 * similar laptops (adapted from Fujitsu init verbs).
5824 static struct hda_verb alc260_acer_init_verbs[] = {
5825 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5826 * the headphone jack. Turn this on and rely on the standard mute
5827 * methods whenever the user wants to turn these outputs off.
5829 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5830 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5831 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5832 /* Internal speaker/Headphone jack is connected to Line-out pin */
5833 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5834 /* Internal microphone/Mic jack is connected to Mic1 pin */
5835 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5836 /* Line In jack is connected to Line1 pin */
5837 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5838 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5839 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5840 /* Ensure all other unused pins are disabled and muted. */
5841 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5842 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5843 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5844 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5845 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5846 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5847 /* Disable digital (SPDIF) pins */
5848 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5849 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5851 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5852 * bus when acting as outputs.
5854 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5855 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5857 /* Start with output sum widgets muted and their output gains at min */
5858 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5859 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5860 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5861 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5862 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5863 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5864 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5865 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5866 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5868 /* Unmute Line-out pin widget amp left and right
5869 * (no equiv mixer ctrl)
5871 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5872 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5873 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5874 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5875 * inputs. If the pin mode is changed by the user the pin mode control
5876 * will take care of enabling the pin's input/output buffers as needed.
5877 * Therefore there's no need to enable the input buffer at this
5880 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5881 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5883 /* Mute capture amp left and right */
5884 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5885 /* Set ADC connection select to match default mixer setting - mic
5888 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5890 /* Do similar with the second ADC: mute capture input amp and
5891 * set ADC connection to mic to match ALSA's default state.
5893 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5894 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5896 /* Mute all inputs to mixer widget (even unconnected ones) */
5897 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5899 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5902 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5909 /* Initialisation sequence for Maxdata Favorit 100XS
5910 * (adapted from Acer init verbs).
5912 static struct hda_verb alc260_favorit100_init_verbs[] = {
5913 /* GPIO 0 enables the output jack.
5914 * Turn this on and rely on the standard mute
5915 * methods whenever the user wants to turn these outputs off.
5917 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5918 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5919 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5920 /* Line/Mic input jack is connected to Mic1 pin */
5921 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5922 /* Ensure all other unused pins are disabled and muted. */
5923 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5924 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5925 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5926 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5927 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5928 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5929 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5930 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5931 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5933 /* Disable digital (SPDIF) pins */
5934 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5935 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5937 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5938 * bus when acting as outputs.
5940 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5941 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5943 /* Start with output sum widgets muted and their output gains at min */
5944 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5945 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5946 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5947 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5948 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5949 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5950 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5951 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5952 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5954 /* Unmute Line-out pin widget amp left and right
5955 * (no equiv mixer ctrl)
5957 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5958 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5959 * inputs. If the pin mode is changed by the user the pin mode control
5960 * will take care of enabling the pin's input/output buffers as needed.
5961 * Therefore there's no need to enable the input buffer at this
5964 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5966 /* Mute capture amp left and right */
5967 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5968 /* Set ADC connection select to match default mixer setting - mic
5971 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5973 /* Do similar with the second ADC: mute capture input amp and
5974 * set ADC connection to mic to match ALSA's default state.
5976 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5977 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5979 /* Mute all inputs to mixer widget (even unconnected ones) */
5980 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5982 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5983 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5984 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5985 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5992 static struct hda_verb alc260_will_verbs[] = {
5993 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5994 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5995 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5996 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5997 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5998 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6002 static struct hda_verb alc260_replacer_672v_verbs[] = {
6003 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6004 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6005 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6007 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6008 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6009 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6011 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6015 /* toggle speaker-output according to the hp-jack state */
6016 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6018 unsigned int present;
6020 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6021 present = snd_hda_jack_detect(codec, 0x0f);
6023 snd_hda_codec_write_cache(codec, 0x01, 0,
6024 AC_VERB_SET_GPIO_DATA, 1);
6025 snd_hda_codec_write_cache(codec, 0x0f, 0,
6026 AC_VERB_SET_PIN_WIDGET_CONTROL,
6029 snd_hda_codec_write_cache(codec, 0x01, 0,
6030 AC_VERB_SET_GPIO_DATA, 0);
6031 snd_hda_codec_write_cache(codec, 0x0f, 0,
6032 AC_VERB_SET_PIN_WIDGET_CONTROL,
6037 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6040 if ((res >> 26) == ALC880_HP_EVENT)
6041 alc260_replacer_672v_automute(codec);
6044 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6045 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6046 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6047 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6048 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6049 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6050 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6051 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6052 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6053 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6054 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6058 /* Test configuration for debugging, modelled after the ALC880 test
6061 #ifdef CONFIG_SND_DEBUG
6062 static hda_nid_t alc260_test_dac_nids[1] = {
6065 static hda_nid_t alc260_test_adc_nids[2] = {
6068 /* For testing the ALC260, each input MUX needs its own definition since
6069 * the signal assignments are different. This assumes that the first ADC
6072 static struct hda_input_mux alc260_test_capture_sources[2] = {
6076 { "MIC1 pin", 0x0 },
6077 { "MIC2 pin", 0x1 },
6078 { "LINE1 pin", 0x2 },
6079 { "LINE2 pin", 0x3 },
6081 { "LINE-OUT pin", 0x5 },
6082 { "HP-OUT pin", 0x6 },
6088 { "MIC1 pin", 0x0 },
6089 { "MIC2 pin", 0x1 },
6090 { "LINE1 pin", 0x2 },
6091 { "LINE2 pin", 0x3 },
6094 { "LINE-OUT pin", 0x6 },
6095 { "HP-OUT pin", 0x7 },
6099 static struct snd_kcontrol_new alc260_test_mixer[] = {
6100 /* Output driver widgets */
6101 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6102 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6103 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6104 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6105 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6106 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6108 /* Modes for retasking pin widgets
6109 * Note: the ALC260 doesn't seem to act on requests to enable mic
6110 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6111 * mention this restriction. At this stage it's not clear whether
6112 * this behaviour is intentional or is a hardware bug in chip
6113 * revisions available at least up until early 2006. Therefore for
6114 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6115 * choices, but if it turns out that the lack of mic bias for these
6116 * NIDs is intentional we could change their modes from
6117 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6119 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6120 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6121 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6122 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6123 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6124 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6126 /* Loopback mixer controls */
6127 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6128 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6129 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6130 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6131 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6132 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6133 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6134 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6135 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6136 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6137 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6138 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6139 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6140 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6142 /* Controls for GPIO pins, assuming they are configured as outputs */
6143 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6144 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6145 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6146 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6148 /* Switches to allow the digital IO pins to be enabled. The datasheet
6149 * is ambigious as to which NID is which; testing on laptops which
6150 * make this output available should provide clarification.
6152 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6153 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6155 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6156 * this output to turn on an external amplifier.
6158 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6159 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6163 static struct hda_verb alc260_test_init_verbs[] = {
6164 /* Enable all GPIOs as outputs with an initial value of 0 */
6165 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6166 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6167 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6169 /* Enable retasking pins as output, initially without power amp */
6170 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6171 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6172 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6173 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6174 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6175 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6177 /* Disable digital (SPDIF) pins initially, but users can enable
6178 * them via a mixer switch. In the case of SPDIF-out, this initverb
6179 * payload also sets the generation to 0, output to be in "consumer"
6180 * PCM format, copyright asserted, no pre-emphasis and no validity
6183 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6184 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6186 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6187 * OUT1 sum bus when acting as an output.
6189 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6190 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6191 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6192 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6194 /* Start with output sum widgets muted and their output gains at min */
6195 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6196 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6197 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6198 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6199 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6200 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6201 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6202 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6203 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6205 /* Unmute retasking pin widget output buffers since the default
6206 * state appears to be output. As the pin mode is changed by the
6207 * user the pin mode control will take care of enabling the pin's
6208 * input/output buffers as needed.
6210 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6211 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6212 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6213 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6214 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6215 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6216 /* Also unmute the mono-out pin widget */
6217 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6219 /* Mute capture amp left and right */
6220 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6221 /* Set ADC connection select to match default mixer setting (mic1
6224 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6226 /* Do the same for the second ADC: mute capture input amp and
6227 * set ADC connection to mic1 pin
6229 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6230 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6232 /* Mute all inputs to mixer widget (even unconnected ones) */
6233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6239 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6240 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6246 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6247 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6249 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6250 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6253 * for BIOS auto-configuration
6256 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6257 const char *pfx, int *vol_bits)
6260 unsigned long vol_val, sw_val;
6263 if (nid >= 0x0f && nid < 0x11) {
6264 nid_vol = nid - 0x7;
6265 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6266 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6267 } else if (nid == 0x11) {
6268 nid_vol = nid - 0x7;
6269 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6270 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6271 } else if (nid >= 0x12 && nid <= 0x15) {
6273 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6274 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6278 if (!(*vol_bits & (1 << nid_vol))) {
6279 /* first control for the volume widget */
6280 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6283 *vol_bits |= (1 << nid_vol);
6285 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6291 /* add playback controls from the parsed DAC table */
6292 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6293 const struct auto_pin_cfg *cfg)
6299 spec->multiout.num_dacs = 1;
6300 spec->multiout.dac_nids = spec->private_dac_nids;
6301 spec->multiout.dac_nids[0] = 0x02;
6303 nid = cfg->line_out_pins[0];
6306 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6308 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6312 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6317 nid = cfg->speaker_pins[0];
6319 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6324 nid = cfg->hp_pins[0];
6326 err = alc260_add_playback_controls(spec, nid, "Headphone",
6334 /* create playback/capture controls for input pins */
6335 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6336 const struct auto_pin_cfg *cfg)
6338 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6341 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6342 hda_nid_t nid, int pin_type,
6345 alc_set_pin_output(codec, nid, pin_type);
6346 /* need the manual connection? */
6348 int idx = nid - 0x12;
6349 snd_hda_codec_write(codec, idx + 0x0b, 0,
6350 AC_VERB_SET_CONNECT_SEL, sel_idx);
6354 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6356 struct alc_spec *spec = codec->spec;
6359 nid = spec->autocfg.line_out_pins[0];
6361 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6362 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6365 nid = spec->autocfg.speaker_pins[0];
6367 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6369 nid = spec->autocfg.hp_pins[0];
6371 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6374 #define ALC260_PIN_CD_NID 0x16
6375 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6377 struct alc_spec *spec = codec->spec;
6380 for (i = 0; i < AUTO_PIN_LAST; i++) {
6381 hda_nid_t nid = spec->autocfg.input_pins[i];
6383 alc_set_input_pin(codec, nid, i);
6384 if (nid != ALC260_PIN_CD_NID &&
6385 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6386 snd_hda_codec_write(codec, nid, 0,
6387 AC_VERB_SET_AMP_GAIN_MUTE,
6394 * generic initialization of ADC, input mixers and output mixers
6396 static struct hda_verb alc260_volume_init_verbs[] = {
6398 * Unmute ADC0-1 and set the default input to mic-in
6400 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6401 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6402 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6403 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6405 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6407 * Note: PASD motherboards uses the Line In 2 as the input for
6408 * front panel mic (mic 2)
6410 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6411 /* mute analog inputs */
6412 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6419 * Set up output mixers (0x08 - 0x0a)
6421 /* set vol=0 to output mixers */
6422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6423 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6424 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6425 /* set up input amps for analog loopback */
6426 /* Amp Indices: DAC = 0, mixer = 1 */
6427 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6428 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6429 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6430 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6431 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6432 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6437 static int alc260_parse_auto_config(struct hda_codec *codec)
6439 struct alc_spec *spec = codec->spec;
6441 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6443 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6447 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6450 if (!spec->kctls.list)
6451 return 0; /* can't find valid BIOS pin config */
6452 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6456 spec->multiout.max_channels = 2;
6458 if (spec->autocfg.dig_outs)
6459 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6460 if (spec->kctls.list)
6461 add_mixer(spec, spec->kctls.list);
6463 add_verb(spec, alc260_volume_init_verbs);
6465 spec->num_mux_defs = 1;
6466 spec->input_mux = &spec->private_imux[0];
6468 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6473 /* additional initialization for auto-configuration model */
6474 static void alc260_auto_init(struct hda_codec *codec)
6476 struct alc_spec *spec = codec->spec;
6477 alc260_auto_init_multi_out(codec);
6478 alc260_auto_init_analog_input(codec);
6479 if (spec->unsol_event)
6480 alc_inithook(codec);
6483 #ifdef CONFIG_SND_HDA_POWER_SAVE
6484 static struct hda_amp_list alc260_loopbacks[] = {
6485 { 0x07, HDA_INPUT, 0 },
6486 { 0x07, HDA_INPUT, 1 },
6487 { 0x07, HDA_INPUT, 2 },
6488 { 0x07, HDA_INPUT, 3 },
6489 { 0x07, HDA_INPUT, 4 },
6495 * ALC260 configurations
6497 static const char *alc260_models[ALC260_MODEL_LAST] = {
6498 [ALC260_BASIC] = "basic",
6500 [ALC260_HP_3013] = "hp-3013",
6501 [ALC260_HP_DC7600] = "hp-dc7600",
6502 [ALC260_FUJITSU_S702X] = "fujitsu",
6503 [ALC260_ACER] = "acer",
6504 [ALC260_WILL] = "will",
6505 [ALC260_REPLACER_672V] = "replacer",
6506 [ALC260_FAVORIT100] = "favorit100",
6507 #ifdef CONFIG_SND_DEBUG
6508 [ALC260_TEST] = "test",
6510 [ALC260_AUTO] = "auto",
6513 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6514 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6515 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6516 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6517 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6518 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6519 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6520 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6521 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6522 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6523 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6524 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6525 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6526 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6527 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6528 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6529 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6530 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6531 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6532 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6533 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6537 static struct alc_config_preset alc260_presets[] = {
6539 .mixers = { alc260_base_output_mixer,
6540 alc260_input_mixer },
6541 .init_verbs = { alc260_init_verbs },
6542 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6543 .dac_nids = alc260_dac_nids,
6544 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6545 .adc_nids = alc260_dual_adc_nids,
6546 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6547 .channel_mode = alc260_modes,
6548 .input_mux = &alc260_capture_source,
6551 .mixers = { alc260_hp_output_mixer,
6552 alc260_input_mixer },
6553 .init_verbs = { alc260_init_verbs,
6554 alc260_hp_unsol_verbs },
6555 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6556 .dac_nids = alc260_dac_nids,
6557 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6558 .adc_nids = alc260_adc_nids_alt,
6559 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6560 .channel_mode = alc260_modes,
6561 .input_mux = &alc260_capture_source,
6562 .unsol_event = alc260_hp_unsol_event,
6563 .init_hook = alc260_hp_automute,
6565 [ALC260_HP_DC7600] = {
6566 .mixers = { alc260_hp_dc7600_mixer,
6567 alc260_input_mixer },
6568 .init_verbs = { alc260_init_verbs,
6569 alc260_hp_dc7600_verbs },
6570 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6571 .dac_nids = alc260_dac_nids,
6572 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6573 .adc_nids = alc260_adc_nids_alt,
6574 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6575 .channel_mode = alc260_modes,
6576 .input_mux = &alc260_capture_source,
6577 .unsol_event = alc260_hp_3012_unsol_event,
6578 .init_hook = alc260_hp_3012_automute,
6580 [ALC260_HP_3013] = {
6581 .mixers = { alc260_hp_3013_mixer,
6582 alc260_input_mixer },
6583 .init_verbs = { alc260_hp_3013_init_verbs,
6584 alc260_hp_3013_unsol_verbs },
6585 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6586 .dac_nids = alc260_dac_nids,
6587 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6588 .adc_nids = alc260_adc_nids_alt,
6589 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6590 .channel_mode = alc260_modes,
6591 .input_mux = &alc260_capture_source,
6592 .unsol_event = alc260_hp_3013_unsol_event,
6593 .init_hook = alc260_hp_3013_automute,
6595 [ALC260_FUJITSU_S702X] = {
6596 .mixers = { alc260_fujitsu_mixer },
6597 .init_verbs = { alc260_fujitsu_init_verbs },
6598 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6599 .dac_nids = alc260_dac_nids,
6600 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6601 .adc_nids = alc260_dual_adc_nids,
6602 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6603 .channel_mode = alc260_modes,
6604 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6605 .input_mux = alc260_fujitsu_capture_sources,
6608 .mixers = { alc260_acer_mixer },
6609 .init_verbs = { alc260_acer_init_verbs },
6610 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6611 .dac_nids = alc260_dac_nids,
6612 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6613 .adc_nids = alc260_dual_adc_nids,
6614 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6615 .channel_mode = alc260_modes,
6616 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6617 .input_mux = alc260_acer_capture_sources,
6619 [ALC260_FAVORIT100] = {
6620 .mixers = { alc260_favorit100_mixer },
6621 .init_verbs = { alc260_favorit100_init_verbs },
6622 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6623 .dac_nids = alc260_dac_nids,
6624 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6625 .adc_nids = alc260_dual_adc_nids,
6626 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6627 .channel_mode = alc260_modes,
6628 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6629 .input_mux = alc260_favorit100_capture_sources,
6632 .mixers = { alc260_will_mixer },
6633 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6634 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6635 .dac_nids = alc260_dac_nids,
6636 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6637 .adc_nids = alc260_adc_nids,
6638 .dig_out_nid = ALC260_DIGOUT_NID,
6639 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6640 .channel_mode = alc260_modes,
6641 .input_mux = &alc260_capture_source,
6643 [ALC260_REPLACER_672V] = {
6644 .mixers = { alc260_replacer_672v_mixer },
6645 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6646 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6647 .dac_nids = alc260_dac_nids,
6648 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6649 .adc_nids = alc260_adc_nids,
6650 .dig_out_nid = ALC260_DIGOUT_NID,
6651 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6652 .channel_mode = alc260_modes,
6653 .input_mux = &alc260_capture_source,
6654 .unsol_event = alc260_replacer_672v_unsol_event,
6655 .init_hook = alc260_replacer_672v_automute,
6657 #ifdef CONFIG_SND_DEBUG
6659 .mixers = { alc260_test_mixer },
6660 .init_verbs = { alc260_test_init_verbs },
6661 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6662 .dac_nids = alc260_test_dac_nids,
6663 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6664 .adc_nids = alc260_test_adc_nids,
6665 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6666 .channel_mode = alc260_modes,
6667 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6668 .input_mux = alc260_test_capture_sources,
6673 static int patch_alc260(struct hda_codec *codec)
6675 struct alc_spec *spec;
6676 int err, board_config;
6678 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6684 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6687 if (board_config < 0) {
6688 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6690 board_config = ALC260_AUTO;
6693 if (board_config == ALC260_AUTO) {
6694 /* automatic parse from the BIOS config */
6695 err = alc260_parse_auto_config(codec);
6701 "hda_codec: Cannot set up configuration "
6702 "from BIOS. Using base mode...\n");
6703 board_config = ALC260_BASIC;
6707 err = snd_hda_attach_beep_device(codec, 0x1);
6713 if (board_config != ALC260_AUTO)
6714 setup_preset(codec, &alc260_presets[board_config]);
6716 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6717 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6719 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6720 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6722 if (!spec->adc_nids && spec->input_mux) {
6723 /* check whether NID 0x04 is valid */
6724 unsigned int wcap = get_wcaps(codec, 0x04);
6725 wcap = get_wcaps_type(wcap);
6727 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6728 spec->adc_nids = alc260_adc_nids_alt;
6729 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6731 spec->adc_nids = alc260_adc_nids;
6732 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6735 set_capture_mixer(codec);
6736 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6738 spec->vmaster_nid = 0x08;
6740 codec->patch_ops = alc_patch_ops;
6741 if (board_config == ALC260_AUTO)
6742 spec->init_hook = alc260_auto_init;
6743 #ifdef CONFIG_SND_HDA_POWER_SAVE
6744 if (!spec->loopback.amplist)
6745 spec->loopback.amplist = alc260_loopbacks;
6753 * ALC882/883/885/888/889 support
6755 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6756 * configuration. Each pin widget can choose any input DACs and a mixer.
6757 * Each ADC is connected from a mixer of all inputs. This makes possible
6758 * 6-channel independent captures.
6760 * In addition, an independent DAC for the multi-playback (not used in this
6763 #define ALC882_DIGOUT_NID 0x06
6764 #define ALC882_DIGIN_NID 0x0a
6765 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6766 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6767 #define ALC1200_DIGOUT_NID 0x10
6770 static struct hda_channel_mode alc882_ch_modes[1] = {
6775 static hda_nid_t alc882_dac_nids[4] = {
6776 /* front, rear, clfe, rear_surr */
6777 0x02, 0x03, 0x04, 0x05
6779 #define alc883_dac_nids alc882_dac_nids
6782 #define alc882_adc_nids alc880_adc_nids
6783 #define alc882_adc_nids_alt alc880_adc_nids_alt
6784 #define alc883_adc_nids alc882_adc_nids_alt
6785 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6786 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6787 #define alc889_adc_nids alc880_adc_nids
6789 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6790 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6791 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6792 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6793 #define alc889_capsrc_nids alc882_capsrc_nids
6796 /* FIXME: should be a matrix-type input source selection */
6798 static struct hda_input_mux alc882_capture_source = {
6802 { "Front Mic", 0x1 },
6808 #define alc883_capture_source alc882_capture_source
6810 static struct hda_input_mux alc889_capture_source = {
6813 { "Front Mic", 0x0 },
6819 static struct hda_input_mux mb5_capture_source = {
6828 static struct hda_input_mux macmini3_capture_source = {
6836 static struct hda_input_mux alc883_3stack_6ch_intel = {
6840 { "Front Mic", 0x0 },
6846 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6854 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6864 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6872 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6876 { "Front Mic", 0x1 },
6881 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6889 static struct hda_input_mux alc889A_mb31_capture_source = {
6893 /* Front Mic (0x01) unused */
6895 /* Line 2 (0x03) unused */
6896 /* CD (0x04) unused? */
6903 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6910 static struct hda_verb alc882_3ST_ch2_init[] = {
6911 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6912 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6913 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6914 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6921 static struct hda_verb alc882_3ST_ch4_init[] = {
6922 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6923 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6924 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6925 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6926 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6933 static struct hda_verb alc882_3ST_ch6_init[] = {
6934 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6935 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6936 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6937 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6938 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6939 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6943 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6944 { 2, alc882_3ST_ch2_init },
6945 { 4, alc882_3ST_ch4_init },
6946 { 6, alc882_3ST_ch6_init },
6949 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6954 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6955 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6956 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6957 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6958 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6959 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6966 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6967 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6968 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6969 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6970 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6971 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6972 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6979 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6980 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6981 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6982 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6983 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6984 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6985 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6986 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6990 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6991 { 2, alc883_3ST_ch2_clevo_init },
6992 { 4, alc883_3ST_ch4_clevo_init },
6993 { 6, alc883_3ST_ch6_clevo_init },
7000 static struct hda_verb alc882_sixstack_ch6_init[] = {
7001 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7002 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7003 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7004 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7011 static struct hda_verb alc882_sixstack_ch8_init[] = {
7012 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7013 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7014 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7015 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7019 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7020 { 6, alc882_sixstack_ch6_init },
7021 { 8, alc882_sixstack_ch8_init },
7025 /* Macbook Air 2,1 */
7027 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7032 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7038 static struct hda_verb alc885_mbp_ch2_init[] = {
7039 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7040 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7041 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7048 static struct hda_verb alc885_mbp_ch4_init[] = {
7049 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7050 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7051 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7052 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7053 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7057 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7058 { 2, alc885_mbp_ch2_init },
7059 { 4, alc885_mbp_ch4_init },
7064 * Speakers/Woofer/HP = Front
7067 static struct hda_verb alc885_mb5_ch2_init[] = {
7068 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7075 * Speakers/HP = Front
7079 static struct hda_verb alc885_mb5_ch6_init[] = {
7080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7081 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7086 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7087 { 2, alc885_mb5_ch2_init },
7088 { 6, alc885_mb5_ch6_init },
7091 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7096 static struct hda_verb alc883_4ST_ch2_init[] = {
7097 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7098 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7099 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7100 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7101 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7102 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7109 static struct hda_verb alc883_4ST_ch4_init[] = {
7110 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7111 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7112 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7113 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7114 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7115 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7116 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7123 static struct hda_verb alc883_4ST_ch6_init[] = {
7124 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7125 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7126 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7127 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7128 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7129 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7130 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7131 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7138 static struct hda_verb alc883_4ST_ch8_init[] = {
7139 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7140 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7141 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7142 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7143 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7144 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7145 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7146 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7147 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7151 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7152 { 2, alc883_4ST_ch2_init },
7153 { 4, alc883_4ST_ch4_init },
7154 { 6, alc883_4ST_ch6_init },
7155 { 8, alc883_4ST_ch8_init },
7162 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7163 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7164 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7165 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7166 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7173 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7174 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7175 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7176 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7177 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7178 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7185 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7186 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7187 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7188 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7189 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7190 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7191 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7195 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7196 { 2, alc883_3ST_ch2_intel_init },
7197 { 4, alc883_3ST_ch4_intel_init },
7198 { 6, alc883_3ST_ch6_intel_init },
7204 static struct hda_verb alc889_ch2_intel_init[] = {
7205 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7206 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7207 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7208 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7209 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7210 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7217 static struct hda_verb alc889_ch6_intel_init[] = {
7218 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7219 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7220 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7221 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7222 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7223 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7230 static struct hda_verb alc889_ch8_intel_init[] = {
7231 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7232 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7233 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7234 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7235 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7236 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7237 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7241 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7242 { 2, alc889_ch2_intel_init },
7243 { 6, alc889_ch6_intel_init },
7244 { 8, alc889_ch8_intel_init },
7250 static struct hda_verb alc883_sixstack_ch6_init[] = {
7251 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7252 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7253 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7254 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7261 static struct hda_verb alc883_sixstack_ch8_init[] = {
7262 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7263 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7264 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7265 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7269 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7270 { 6, alc883_sixstack_ch6_init },
7271 { 8, alc883_sixstack_ch8_init },
7275 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7276 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7278 static struct snd_kcontrol_new alc882_base_mixer[] = {
7279 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7280 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7281 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7282 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7283 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7284 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7285 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7286 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7287 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7288 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7289 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7290 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7291 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7292 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7293 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7294 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7295 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7297 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7298 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7299 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7303 /* Macbook Air 2,1 same control for HP and internal Speaker */
7305 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7306 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7307 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7312 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7313 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7314 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7315 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7316 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7317 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7319 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7321 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7322 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7323 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7327 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7328 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7329 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7330 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7331 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7332 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7333 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7334 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7335 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7336 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7337 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7339 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7340 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7341 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7345 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7346 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7347 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7348 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7349 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7350 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7351 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7352 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7353 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7354 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7355 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7356 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7360 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7361 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7362 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7363 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7364 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7365 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7366 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7367 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7368 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7369 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7374 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7375 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7376 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7377 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7378 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7379 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7380 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7382 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7383 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7387 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7388 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7389 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7390 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7391 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7392 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7393 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7394 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7396 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7397 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7398 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7399 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7400 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7404 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7405 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7407 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7408 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7409 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7410 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7411 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7412 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7413 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7414 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7415 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7416 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7417 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7424 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7425 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7426 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7428 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7429 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7430 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7431 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7438 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7440 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7441 .name = "Channel Mode",
7442 .info = alc_ch_mode_info,
7443 .get = alc_ch_mode_get,
7444 .put = alc_ch_mode_put,
7449 static struct hda_verb alc882_base_init_verbs[] = {
7450 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7454 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7455 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7457 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7460 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7461 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7463 /* Front Pin: output 0 (0x0c) */
7464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7466 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7467 /* Rear Pin: output 1 (0x0d) */
7468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7470 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7471 /* CLFE Pin: output 2 (0x0e) */
7472 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7473 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7474 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7475 /* Side Pin: output 3 (0x0f) */
7476 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7477 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7478 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7479 /* Mic (rear) pin: input vref at 80% */
7480 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7481 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7482 /* Front Mic pin: input vref at 80% */
7483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7484 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7485 /* Line In pin: input */
7486 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7487 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7488 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7490 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7491 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7492 /* CD pin widget for input */
7493 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7495 /* FIXME: use matrix-type input source selection */
7496 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7500 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7501 /* ADC2: mute amp left and right */
7502 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7503 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7504 /* ADC3: mute amp left and right */
7505 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7506 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7511 static struct hda_verb alc882_adc1_init_verbs[] = {
7512 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7513 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7514 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7517 /* ADC1: mute amp left and right */
7518 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7519 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7523 static struct hda_verb alc882_eapd_verbs[] = {
7524 /* change to EAPD mode */
7525 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7526 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7530 static struct hda_verb alc889_eapd_verbs[] = {
7531 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7532 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7536 static struct hda_verb alc_hp15_unsol_verbs[] = {
7537 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7542 static struct hda_verb alc885_init_verbs[] = {
7543 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7547 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7550 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7551 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7553 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7554 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7556 /* Front HP Pin: output 0 (0x0c) */
7557 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7559 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7560 /* Front Pin: output 0 (0x0c) */
7561 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7562 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7563 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7564 /* Rear Pin: output 1 (0x0d) */
7565 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7566 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7567 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7568 /* CLFE Pin: output 2 (0x0e) */
7569 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7570 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7571 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7572 /* Side Pin: output 3 (0x0f) */
7573 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7574 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7575 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7576 /* Mic (rear) pin: input vref at 80% */
7577 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7578 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7579 /* Front Mic pin: input vref at 80% */
7580 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7581 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7582 /* Line In pin: input */
7583 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7584 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7586 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7588 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7593 /* ADC2: mute amp left and right */
7594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7595 /* ADC3: mute amp left and right */
7596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7601 static struct hda_verb alc885_init_input_verbs[] = {
7602 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7603 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7604 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7609 /* Unmute Selector 24h and set the default input to front mic */
7610 static struct hda_verb alc889_init_input_verbs[] = {
7611 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7617 #define alc883_init_verbs alc882_base_init_verbs
7620 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7621 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7622 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7623 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7624 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7625 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7626 /* FIXME: this looks suspicious...
7627 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7628 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7633 static struct hda_verb alc882_macpro_init_verbs[] = {
7634 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7635 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7636 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7637 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7638 /* Front Pin: output 0 (0x0c) */
7639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7642 /* Front Mic pin: input vref at 80% */
7643 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7644 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7645 /* Speaker: output */
7646 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7647 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7648 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7649 /* Headphone output (output 0 - 0x0c) */
7650 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7651 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7652 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7654 /* FIXME: use matrix-type input source selection */
7655 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7656 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7671 /* ADC1: mute amp left and right */
7672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7673 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7674 /* ADC2: mute amp left and right */
7675 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7676 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7677 /* ADC3: mute amp left and right */
7678 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7679 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7685 static struct hda_verb alc885_mb5_init_verbs[] = {
7687 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7688 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7689 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7690 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7695 /* Surround mixer */
7696 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7697 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7698 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7700 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7701 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7702 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7704 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7705 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7706 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7707 /* Front Pin (0x0c) */
7708 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7709 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7710 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7711 /* LFE Pin (0x0e) */
7712 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7713 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7714 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7718 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7719 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7720 /* Front Mic pin: input vref at 80% */
7721 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7722 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7725 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7727 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7728 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7729 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7730 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7735 static struct hda_verb alc885_macmini3_init_verbs[] = {
7737 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7738 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7739 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7740 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7745 /* Surround mixer */
7746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7748 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7750 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7751 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7752 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7754 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7755 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7756 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7757 /* Front Pin (0x0c) */
7758 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7759 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7760 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7761 /* LFE Pin (0x0e) */
7762 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7763 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7764 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7766 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7768 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7769 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7771 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7772 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7774 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7782 static struct hda_verb alc885_mba21_init_verbs[] = {
7783 /*Internal and HP Speaker Mixer*/
7784 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7785 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7787 /*Internal Speaker Pin (0x0c)*/
7788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7790 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7791 /* HP Pin: output 0 (0x0e) */
7792 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7793 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7794 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7795 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7796 /* Line in (is hp when jack connected)*/
7797 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7798 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7804 /* Macbook Pro rev3 */
7805 static struct hda_verb alc885_mbp3_init_verbs[] = {
7806 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7811 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7816 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7817 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7818 /* Front Pin: output 0 (0x0c) */
7819 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7820 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7821 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7822 /* HP Pin: output 0 (0x0e) */
7823 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7824 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7825 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7826 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7827 /* Mic (rear) pin: input vref at 80% */
7828 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7829 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7830 /* Front Mic pin: input vref at 80% */
7831 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7832 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7833 /* Line In pin: use output 1 when in LineOut mode */
7834 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7835 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7836 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7838 /* FIXME: use matrix-type input source selection */
7839 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7840 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7841 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7842 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7843 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7846 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7847 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7848 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7849 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7851 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7852 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7853 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7854 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7855 /* ADC1: mute amp left and right */
7856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7857 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7858 /* ADC2: mute amp left and right */
7859 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7860 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7861 /* ADC3: mute amp left and right */
7862 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7863 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7869 static struct hda_verb alc885_imac91_init_verbs[] = {
7870 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7871 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7872 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7873 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7875 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7876 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7878 /* HP Pin: output 0 (0x0c) */
7879 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7881 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7882 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7883 /* Internal Speakers: output 0 (0x0d) */
7884 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7885 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7886 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7887 /* Mic (rear) pin: input vref at 80% */
7888 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7890 /* Front Mic pin: input vref at 80% */
7891 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7892 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7893 /* Line In pin: use output 1 when in LineOut mode */
7894 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7895 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7896 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7898 /* FIXME: use matrix-type input source selection */
7899 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7900 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7901 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7902 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7903 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7906 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7907 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7908 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7909 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7912 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7915 /* ADC1: mute amp left and right */
7916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7917 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7918 /* ADC2: mute amp left and right */
7919 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7920 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7921 /* ADC3: mute amp left and right */
7922 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7923 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7928 /* iMac 24 mixer. */
7929 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7930 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7931 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7935 /* iMac 24 init verbs. */
7936 static struct hda_verb alc885_imac24_init_verbs[] = {
7937 /* Internal speakers: output 0 (0x0c) */
7938 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7939 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7940 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7941 /* Internal speakers: output 0 (0x0c) */
7942 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7944 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7945 /* Headphone: output 0 (0x0c) */
7946 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7947 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7948 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7949 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7950 /* Front Mic: input vref at 80% */
7951 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7952 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7956 /* Toggle speaker-output according to the hp-jack state */
7957 static void alc885_imac24_setup(struct hda_codec *codec)
7959 struct alc_spec *spec = codec->spec;
7961 spec->autocfg.hp_pins[0] = 0x14;
7962 spec->autocfg.speaker_pins[0] = 0x18;
7963 spec->autocfg.speaker_pins[1] = 0x1a;
7966 #define alc885_mb5_setup alc885_imac24_setup
7967 #define alc885_macmini3_setup alc885_imac24_setup
7969 /* Macbook Air 2,1 */
7970 static void alc885_mba21_setup(struct hda_codec *codec)
7972 struct alc_spec *spec = codec->spec;
7974 spec->autocfg.hp_pins[0] = 0x14;
7975 spec->autocfg.speaker_pins[0] = 0x18;
7980 static void alc885_mbp3_setup(struct hda_codec *codec)
7982 struct alc_spec *spec = codec->spec;
7984 spec->autocfg.hp_pins[0] = 0x15;
7985 spec->autocfg.speaker_pins[0] = 0x14;
7988 static void alc885_imac91_setup(struct hda_codec *codec)
7990 struct alc_spec *spec = codec->spec;
7992 spec->autocfg.hp_pins[0] = 0x14;
7993 spec->autocfg.speaker_pins[0] = 0x15;
7994 spec->autocfg.speaker_pins[1] = 0x1a;
7997 static struct hda_verb alc882_targa_verbs[] = {
7998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8001 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8002 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8004 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8005 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8006 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8008 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8012 /* toggle speaker-output according to the hp-jack state */
8013 static void alc882_targa_automute(struct hda_codec *codec)
8015 struct alc_spec *spec = codec->spec;
8016 alc_automute_amp(codec);
8017 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8018 spec->jack_present ? 1 : 3);
8021 static void alc882_targa_setup(struct hda_codec *codec)
8023 struct alc_spec *spec = codec->spec;
8025 spec->autocfg.hp_pins[0] = 0x14;
8026 spec->autocfg.speaker_pins[0] = 0x1b;
8029 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8031 if ((res >> 26) == ALC880_HP_EVENT)
8032 alc882_targa_automute(codec);
8035 static struct hda_verb alc882_asus_a7j_verbs[] = {
8036 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8037 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8039 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8040 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8041 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8043 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8044 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8045 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8047 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8048 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8049 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8053 static struct hda_verb alc882_asus_a7m_verbs[] = {
8054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8057 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8058 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8059 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8061 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8062 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8063 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8065 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8066 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8067 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8071 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8073 unsigned int gpiostate, gpiomask, gpiodir;
8075 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8076 AC_VERB_GET_GPIO_DATA, 0);
8079 gpiostate |= (1 << pin);
8081 gpiostate &= ~(1 << pin);
8083 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8084 AC_VERB_GET_GPIO_MASK, 0);
8085 gpiomask |= (1 << pin);
8087 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8088 AC_VERB_GET_GPIO_DIRECTION, 0);
8089 gpiodir |= (1 << pin);
8092 snd_hda_codec_write(codec, codec->afg, 0,
8093 AC_VERB_SET_GPIO_MASK, gpiomask);
8094 snd_hda_codec_write(codec, codec->afg, 0,
8095 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8099 snd_hda_codec_write(codec, codec->afg, 0,
8100 AC_VERB_SET_GPIO_DATA, gpiostate);
8103 /* set up GPIO at initialization */
8104 static void alc885_macpro_init_hook(struct hda_codec *codec)
8106 alc882_gpio_mute(codec, 0, 0);
8107 alc882_gpio_mute(codec, 1, 0);
8110 /* set up GPIO and update auto-muting at initialization */
8111 static void alc885_imac24_init_hook(struct hda_codec *codec)
8113 alc885_macpro_init_hook(codec);
8114 alc_automute_amp(codec);
8118 * generic initialization of ADC, input mixers and output mixers
8120 static struct hda_verb alc883_auto_init_verbs[] = {
8122 * Unmute ADC0-2 and set the default input to mic-in
8124 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8125 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8126 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8127 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8130 * Set up output mixers (0x0c - 0x0f)
8132 /* set vol=0 to output mixers */
8133 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8134 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8135 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8136 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8137 /* set up input amps for analog loopback */
8138 /* Amp Indices: DAC = 0, mixer = 1 */
8139 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8140 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8141 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8142 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8143 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8144 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8145 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8146 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8147 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8148 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8150 /* FIXME: use matrix-type input source selection */
8151 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8153 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8159 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8160 static struct hda_verb alc889A_mb31_ch2_init[] = {
8161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8162 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8163 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8164 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8168 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8169 static struct hda_verb alc889A_mb31_ch4_init[] = {
8170 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8171 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8172 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8173 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8177 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8178 static struct hda_verb alc889A_mb31_ch5_init[] = {
8179 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8180 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8181 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8182 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8186 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8187 static struct hda_verb alc889A_mb31_ch6_init[] = {
8188 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8189 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8190 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8195 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8196 { 2, alc889A_mb31_ch2_init },
8197 { 4, alc889A_mb31_ch4_init },
8198 { 5, alc889A_mb31_ch5_init },
8199 { 6, alc889A_mb31_ch6_init },
8202 static struct hda_verb alc883_medion_eapd_verbs[] = {
8203 /* eanable EAPD on medion laptop */
8204 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8205 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8209 #define alc883_base_mixer alc882_base_mixer
8211 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8212 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8213 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8214 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8215 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8216 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8217 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8220 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8222 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8224 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8228 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8229 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8230 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8231 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8232 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8234 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8236 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8237 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8238 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8242 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8243 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8244 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8245 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8246 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8247 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8248 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8250 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8252 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8256 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8257 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8258 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8260 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8261 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8262 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8263 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8265 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8268 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8269 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8273 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8274 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8275 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8276 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8277 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8278 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8279 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8280 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8281 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8282 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8283 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8284 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8285 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8286 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8288 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8290 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8291 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8292 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8296 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8297 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8298 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8299 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8300 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8301 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8303 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8304 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8305 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8306 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8307 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8308 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8309 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8310 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8312 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8313 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8314 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8315 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8316 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8320 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8321 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8322 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8323 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8324 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8325 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8327 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8328 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8329 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8330 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8331 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8332 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8333 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8334 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8336 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8337 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8338 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8339 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8340 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8344 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8345 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8346 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8347 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8348 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8349 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8350 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8351 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8352 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8353 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8356 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8357 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8358 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8359 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8361 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8362 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8363 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8367 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8368 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8369 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8371 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8372 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8373 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8374 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8375 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8376 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8377 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
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),
8388 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8389 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8390 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8391 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8392 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8393 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8394 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8396 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8397 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8398 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8399 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8400 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8404 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8405 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8406 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8407 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8408 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8409 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8413 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8414 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8415 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8416 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8417 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8420 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8425 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8426 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8427 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8428 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8429 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8430 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8431 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8433 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8434 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8438 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8439 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8440 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8441 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8442 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8443 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8444 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8445 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8446 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8447 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8451 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8452 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8453 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8454 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8455 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8456 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8457 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8458 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8459 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8463 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8464 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8465 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8466 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8467 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8468 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8469 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8470 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8471 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8473 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8478 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8479 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8480 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8481 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8482 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8483 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8484 0x0d, 1, 0x0, HDA_OUTPUT),
8485 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8486 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8487 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8488 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8489 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8490 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8491 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8492 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8493 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8494 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8495 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8496 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8497 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8498 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8499 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8503 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8505 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8506 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8507 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8508 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8509 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8511 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8512 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8513 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8514 /* Output switches */
8515 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8516 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8517 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8519 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8520 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8522 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8523 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8524 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8525 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8529 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8530 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8531 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8532 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8534 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8535 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8539 static struct hda_bind_ctls alc883_bind_cap_vol = {
8540 .ops = &snd_hda_bind_vol,
8542 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8543 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8548 static struct hda_bind_ctls alc883_bind_cap_switch = {
8549 .ops = &snd_hda_bind_sw,
8551 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8552 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8557 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8558 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8559 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8560 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8564 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8569 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8570 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8571 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8573 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8574 /* .name = "Capture Source", */
8575 .name = "Input Source",
8577 .info = alc_mux_enum_info,
8578 .get = alc_mux_enum_get,
8579 .put = alc_mux_enum_put,
8584 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8586 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8587 .name = "Channel Mode",
8588 .info = alc_ch_mode_info,
8589 .get = alc_ch_mode_get,
8590 .put = alc_ch_mode_put,
8595 /* toggle speaker-output according to the hp-jack state */
8596 static void alc883_mitac_setup(struct hda_codec *codec)
8598 struct alc_spec *spec = codec->spec;
8600 spec->autocfg.hp_pins[0] = 0x15;
8601 spec->autocfg.speaker_pins[0] = 0x14;
8602 spec->autocfg.speaker_pins[1] = 0x17;
8605 /* auto-toggle front mic */
8607 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8609 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8611 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8615 static struct hda_verb alc883_mitac_verbs[] = {
8617 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8618 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8620 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8621 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8623 /* enable unsolicited event */
8624 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8625 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8630 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8632 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8633 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8635 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8637 /* enable unsolicited event */
8639 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8640 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8646 static struct hda_verb alc883_clevo_m720_verbs[] = {
8648 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8651 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8654 /* enable unsolicited event */
8655 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8656 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8661 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8663 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8666 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8669 /* enable unsolicited event */
8670 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8675 static struct hda_verb alc883_targa_verbs[] = {
8676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8677 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8680 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8682 /* Connect Line-Out side jack (SPDIF) to Side */
8683 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8684 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8685 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8686 /* Connect Mic jack to CLFE */
8687 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8688 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8689 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8690 /* Connect Line-in jack to Surround */
8691 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8692 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8693 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8694 /* Connect HP out jack to Front */
8695 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8696 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8697 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8699 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8704 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8705 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8706 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8707 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8711 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8712 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8713 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8714 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8719 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8720 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8722 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8723 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8724 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8728 static struct hda_verb alc883_haier_w66_verbs[] = {
8729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8734 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8736 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8737 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8741 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8745 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8746 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8747 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8748 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8749 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8753 static struct hda_verb alc888_6st_dell_verbs[] = {
8754 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8758 static struct hda_verb alc883_vaiott_verbs[] = {
8760 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8761 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8763 /* enable unsolicited event */
8764 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8769 static void alc888_3st_hp_setup(struct hda_codec *codec)
8771 struct alc_spec *spec = codec->spec;
8773 spec->autocfg.hp_pins[0] = 0x1b;
8774 spec->autocfg.speaker_pins[0] = 0x14;
8775 spec->autocfg.speaker_pins[1] = 0x16;
8776 spec->autocfg.speaker_pins[2] = 0x18;
8779 static struct hda_verb alc888_3st_hp_verbs[] = {
8780 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8781 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8782 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8783 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8790 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8791 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8792 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8793 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8794 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8801 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8802 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8803 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8804 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8805 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8806 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8813 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8814 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8815 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8816 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8817 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8818 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8819 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8823 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8824 { 2, alc888_3st_hp_2ch_init },
8825 { 4, alc888_3st_hp_4ch_init },
8826 { 6, alc888_3st_hp_6ch_init },
8829 /* toggle front-jack and RCA according to the hp-jack state */
8830 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8832 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8834 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8835 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8836 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8837 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8840 /* toggle RCA according to the front-jack state */
8841 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8843 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8845 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8846 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8849 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8852 if ((res >> 26) == ALC880_HP_EVENT)
8853 alc888_lenovo_ms7195_front_automute(codec);
8854 if ((res >> 26) == ALC880_FRONT_EVENT)
8855 alc888_lenovo_ms7195_rca_automute(codec);
8858 static struct hda_verb alc883_medion_md2_verbs[] = {
8859 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8860 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8864 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8868 /* toggle speaker-output according to the hp-jack state */
8869 static void alc883_medion_md2_setup(struct hda_codec *codec)
8871 struct alc_spec *spec = codec->spec;
8873 spec->autocfg.hp_pins[0] = 0x14;
8874 spec->autocfg.speaker_pins[0] = 0x15;
8877 /* toggle speaker-output according to the hp-jack state */
8878 #define alc883_targa_init_hook alc882_targa_init_hook
8879 #define alc883_targa_unsol_event alc882_targa_unsol_event
8881 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8883 unsigned int present;
8885 present = snd_hda_jack_detect(codec, 0x18);
8886 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8887 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8890 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8892 struct alc_spec *spec = codec->spec;
8894 spec->autocfg.hp_pins[0] = 0x15;
8895 spec->autocfg.speaker_pins[0] = 0x14;
8898 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8900 alc_automute_amp(codec);
8901 alc883_clevo_m720_mic_automute(codec);
8904 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8907 switch (res >> 26) {
8908 case ALC880_MIC_EVENT:
8909 alc883_clevo_m720_mic_automute(codec);
8912 alc_automute_amp_unsol_event(codec, res);
8917 /* toggle speaker-output according to the hp-jack state */
8918 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8920 struct alc_spec *spec = codec->spec;
8922 spec->autocfg.hp_pins[0] = 0x14;
8923 spec->autocfg.speaker_pins[0] = 0x15;
8926 static void alc883_haier_w66_setup(struct hda_codec *codec)
8928 struct alc_spec *spec = codec->spec;
8930 spec->autocfg.hp_pins[0] = 0x1b;
8931 spec->autocfg.speaker_pins[0] = 0x14;
8934 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8936 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8938 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8939 HDA_AMP_MUTE, bits);
8942 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8944 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8946 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8947 HDA_AMP_MUTE, bits);
8948 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8949 HDA_AMP_MUTE, bits);
8952 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8955 if ((res >> 26) == ALC880_HP_EVENT)
8956 alc883_lenovo_101e_all_automute(codec);
8957 if ((res >> 26) == ALC880_FRONT_EVENT)
8958 alc883_lenovo_101e_ispeaker_automute(codec);
8961 /* toggle speaker-output according to the hp-jack state */
8962 static void alc883_acer_aspire_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;
8968 spec->autocfg.speaker_pins[1] = 0x16;
8971 static struct hda_verb alc883_acer_eapd_verbs[] = {
8972 /* HP Pin: output 0 (0x0c) */
8973 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8974 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8975 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8976 /* Front Pin: output 0 (0x0c) */
8977 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8978 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8979 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8980 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8981 /* eanable EAPD on medion laptop */
8982 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8983 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8984 /* enable unsolicited event */
8985 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8989 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8990 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8991 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8992 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8996 static void alc888_6st_dell_setup(struct hda_codec *codec)
8998 struct alc_spec *spec = codec->spec;
9000 spec->autocfg.hp_pins[0] = 0x1b;
9001 spec->autocfg.speaker_pins[0] = 0x14;
9002 spec->autocfg.speaker_pins[1] = 0x15;
9003 spec->autocfg.speaker_pins[2] = 0x16;
9004 spec->autocfg.speaker_pins[3] = 0x17;
9007 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9009 struct alc_spec *spec = codec->spec;
9011 spec->autocfg.hp_pins[0] = 0x1b;
9012 spec->autocfg.speaker_pins[0] = 0x14;
9013 spec->autocfg.speaker_pins[1] = 0x15;
9014 spec->autocfg.speaker_pins[2] = 0x16;
9015 spec->autocfg.speaker_pins[3] = 0x17;
9016 spec->autocfg.speaker_pins[4] = 0x1a;
9019 static void alc883_vaiott_setup(struct hda_codec *codec)
9021 struct alc_spec *spec = codec->spec;
9023 spec->autocfg.hp_pins[0] = 0x15;
9024 spec->autocfg.speaker_pins[0] = 0x14;
9025 spec->autocfg.speaker_pins[1] = 0x17;
9028 static struct hda_verb alc888_asus_m90v_verbs[] = {
9029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9032 /* enable unsolicited event */
9033 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9034 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9038 static void alc883_mode2_setup(struct hda_codec *codec)
9040 struct alc_spec *spec = codec->spec;
9042 spec->autocfg.hp_pins[0] = 0x1b;
9043 spec->autocfg.speaker_pins[0] = 0x14;
9044 spec->autocfg.speaker_pins[1] = 0x15;
9045 spec->autocfg.speaker_pins[2] = 0x16;
9046 spec->ext_mic.pin = 0x18;
9047 spec->int_mic.pin = 0x19;
9048 spec->ext_mic.mux_idx = 0;
9049 spec->int_mic.mux_idx = 1;
9053 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9054 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9055 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9057 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9058 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9059 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9060 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9061 /* enable unsolicited event */
9062 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9066 static void alc883_eee1601_inithook(struct hda_codec *codec)
9068 struct alc_spec *spec = codec->spec;
9070 spec->autocfg.hp_pins[0] = 0x14;
9071 spec->autocfg.speaker_pins[0] = 0x1b;
9072 alc_automute_pin(codec);
9075 static struct hda_verb alc889A_mb31_verbs[] = {
9076 /* Init rear pin (used as headphone output) */
9077 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9078 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9079 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9080 /* Init line pin (used as output in 4ch and 6ch mode) */
9081 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9082 /* Init line 2 pin (used as headphone out by default) */
9083 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9084 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9088 /* Mute speakers according to the headphone jack state */
9089 static void alc889A_mb31_automute(struct hda_codec *codec)
9091 unsigned int present;
9093 /* Mute only in 2ch or 4ch mode */
9094 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9096 present = snd_hda_jack_detect(codec, 0x15);
9097 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9098 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9099 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9100 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9104 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9106 if ((res >> 26) == ALC880_HP_EVENT)
9107 alc889A_mb31_automute(codec);
9111 #ifdef CONFIG_SND_HDA_POWER_SAVE
9112 #define alc882_loopbacks alc880_loopbacks
9115 /* pcm configuration: identical with ALC880 */
9116 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9117 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9118 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9119 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9121 static hda_nid_t alc883_slave_dig_outs[] = {
9122 ALC1200_DIGOUT_NID, 0,
9125 static hda_nid_t alc1200_slave_dig_outs[] = {
9126 ALC883_DIGOUT_NID, 0,
9130 * configuration and preset
9132 static const char *alc882_models[ALC882_MODEL_LAST] = {
9133 [ALC882_3ST_DIG] = "3stack-dig",
9134 [ALC882_6ST_DIG] = "6stack-dig",
9135 [ALC882_ARIMA] = "arima",
9136 [ALC882_W2JC] = "w2jc",
9137 [ALC882_TARGA] = "targa",
9138 [ALC882_ASUS_A7J] = "asus-a7j",
9139 [ALC882_ASUS_A7M] = "asus-a7m",
9140 [ALC885_MACPRO] = "macpro",
9141 [ALC885_MB5] = "mb5",
9142 [ALC885_MACMINI3] = "macmini3",
9143 [ALC885_MBA21] = "mba21",
9144 [ALC885_MBP3] = "mbp3",
9145 [ALC885_IMAC24] = "imac24",
9146 [ALC885_IMAC91] = "imac91",
9147 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9148 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9149 [ALC883_3ST_6ch] = "3stack-6ch",
9150 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9151 [ALC883_TARGA_DIG] = "targa-dig",
9152 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9153 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9154 [ALC883_ACER] = "acer",
9155 [ALC883_ACER_ASPIRE] = "acer-aspire",
9156 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9157 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9158 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9159 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9160 [ALC883_MEDION] = "medion",
9161 [ALC883_MEDION_MD2] = "medion-md2",
9162 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9163 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9164 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9165 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9166 [ALC888_LENOVO_SKY] = "lenovo-sky",
9167 [ALC883_HAIER_W66] = "haier-w66",
9168 [ALC888_3ST_HP] = "3stack-hp",
9169 [ALC888_6ST_DELL] = "6stack-dell",
9170 [ALC883_MITAC] = "mitac",
9171 [ALC883_CLEVO_M540R] = "clevo-m540r",
9172 [ALC883_CLEVO_M720] = "clevo-m720",
9173 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9174 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9175 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9176 [ALC889A_INTEL] = "intel-alc889a",
9177 [ALC889_INTEL] = "intel-x58",
9178 [ALC1200_ASUS_P5Q] = "asus-p5q",
9179 [ALC889A_MB31] = "mb31",
9180 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9181 [ALC882_AUTO] = "auto",
9184 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9185 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9187 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9188 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9189 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9190 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9191 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9192 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9193 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9194 ALC888_ACER_ASPIRE_4930G),
9195 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9196 ALC888_ACER_ASPIRE_4930G),
9197 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9198 ALC888_ACER_ASPIRE_8930G),
9199 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9200 ALC888_ACER_ASPIRE_8930G),
9201 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9202 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9203 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9204 ALC888_ACER_ASPIRE_6530G),
9205 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9206 ALC888_ACER_ASPIRE_6530G),
9207 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9208 ALC888_ACER_ASPIRE_7730G),
9209 /* default Acer -- disabled as it causes more problems.
9210 * model=auto should work fine now
9212 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9214 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9216 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9217 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9218 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9219 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9220 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9221 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9223 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9224 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9225 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9226 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9227 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9228 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9229 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9230 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9231 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9232 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9233 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9235 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9236 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9237 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9238 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9239 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9240 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9241 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9242 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9243 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9245 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9246 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9247 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9248 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9249 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9250 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9251 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9252 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9253 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9254 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9255 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9256 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9257 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9258 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9259 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9260 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9261 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9262 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9263 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9264 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9265 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9266 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9267 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9268 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9269 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9270 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9271 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9272 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9273 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9274 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9275 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9277 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9278 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9279 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9280 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9281 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9282 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9283 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9284 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9285 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9286 ALC883_FUJITSU_PI2515),
9287 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9288 ALC888_FUJITSU_XA3530),
9289 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9290 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9291 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9292 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9293 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9294 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9295 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9296 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9297 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9299 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9300 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9301 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9302 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9303 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9304 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9305 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9310 /* codec SSID table for Intel Mac */
9311 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9312 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9313 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9314 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9315 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9316 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9317 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9318 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9319 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9320 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9321 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9322 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9323 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9324 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9325 * so apparently no perfect solution yet
9327 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9328 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9329 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9333 static struct alc_config_preset alc882_presets[] = {
9334 [ALC882_3ST_DIG] = {
9335 .mixers = { alc882_base_mixer },
9336 .init_verbs = { alc882_base_init_verbs,
9337 alc882_adc1_init_verbs },
9338 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9339 .dac_nids = alc882_dac_nids,
9340 .dig_out_nid = ALC882_DIGOUT_NID,
9341 .dig_in_nid = ALC882_DIGIN_NID,
9342 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9343 .channel_mode = alc882_ch_modes,
9345 .input_mux = &alc882_capture_source,
9347 [ALC882_6ST_DIG] = {
9348 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9349 .init_verbs = { alc882_base_init_verbs,
9350 alc882_adc1_init_verbs },
9351 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9352 .dac_nids = alc882_dac_nids,
9353 .dig_out_nid = ALC882_DIGOUT_NID,
9354 .dig_in_nid = ALC882_DIGIN_NID,
9355 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9356 .channel_mode = alc882_sixstack_modes,
9357 .input_mux = &alc882_capture_source,
9360 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9361 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9362 alc882_eapd_verbs },
9363 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9364 .dac_nids = alc882_dac_nids,
9365 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9366 .channel_mode = alc882_sixstack_modes,
9367 .input_mux = &alc882_capture_source,
9370 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9371 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9372 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9373 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9374 .dac_nids = alc882_dac_nids,
9375 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9376 .channel_mode = alc880_threestack_modes,
9378 .input_mux = &alc882_capture_source,
9379 .dig_out_nid = ALC882_DIGOUT_NID,
9382 .mixers = { alc885_mba21_mixer },
9383 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9385 .dac_nids = alc882_dac_nids,
9386 .channel_mode = alc885_mba21_ch_modes,
9387 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9388 .input_mux = &alc882_capture_source,
9389 .unsol_event = alc_automute_amp_unsol_event,
9390 .setup = alc885_mba21_setup,
9391 .init_hook = alc_automute_amp,
9394 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9395 .init_verbs = { alc885_mbp3_init_verbs,
9396 alc880_gpio1_init_verbs },
9398 .dac_nids = alc882_dac_nids,
9400 .channel_mode = alc885_mbp_4ch_modes,
9401 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9402 .input_mux = &alc882_capture_source,
9403 .dig_out_nid = ALC882_DIGOUT_NID,
9404 .dig_in_nid = ALC882_DIGIN_NID,
9405 .unsol_event = alc_automute_amp_unsol_event,
9406 .setup = alc885_mbp3_setup,
9407 .init_hook = alc_automute_amp,
9410 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9411 .init_verbs = { alc885_mb5_init_verbs,
9412 alc880_gpio1_init_verbs },
9413 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9414 .dac_nids = alc882_dac_nids,
9415 .channel_mode = alc885_mb5_6ch_modes,
9416 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9417 .input_mux = &mb5_capture_source,
9418 .dig_out_nid = ALC882_DIGOUT_NID,
9419 .dig_in_nid = ALC882_DIGIN_NID,
9420 .unsol_event = alc_automute_amp_unsol_event,
9421 .setup = alc885_mb5_setup,
9422 .init_hook = alc_automute_amp,
9424 [ALC885_MACMINI3] = {
9425 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9426 .init_verbs = { alc885_macmini3_init_verbs,
9427 alc880_gpio1_init_verbs },
9428 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9429 .dac_nids = alc882_dac_nids,
9430 .channel_mode = alc885_macmini3_6ch_modes,
9431 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9432 .input_mux = &macmini3_capture_source,
9433 .dig_out_nid = ALC882_DIGOUT_NID,
9434 .dig_in_nid = ALC882_DIGIN_NID,
9435 .unsol_event = alc_automute_amp_unsol_event,
9436 .setup = alc885_macmini3_setup,
9437 .init_hook = alc_automute_amp,
9440 .mixers = { alc882_macpro_mixer },
9441 .init_verbs = { alc882_macpro_init_verbs },
9442 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9443 .dac_nids = alc882_dac_nids,
9444 .dig_out_nid = ALC882_DIGOUT_NID,
9445 .dig_in_nid = ALC882_DIGIN_NID,
9446 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9447 .channel_mode = alc882_ch_modes,
9448 .input_mux = &alc882_capture_source,
9449 .init_hook = alc885_macpro_init_hook,
9452 .mixers = { alc885_imac24_mixer },
9453 .init_verbs = { alc885_imac24_init_verbs },
9454 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9455 .dac_nids = alc882_dac_nids,
9456 .dig_out_nid = ALC882_DIGOUT_NID,
9457 .dig_in_nid = ALC882_DIGIN_NID,
9458 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9459 .channel_mode = alc882_ch_modes,
9460 .input_mux = &alc882_capture_source,
9461 .unsol_event = alc_automute_amp_unsol_event,
9462 .setup = alc885_imac24_setup,
9463 .init_hook = alc885_imac24_init_hook,
9466 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9467 .init_verbs = { alc885_imac91_init_verbs,
9468 alc880_gpio1_init_verbs },
9469 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9470 .dac_nids = alc882_dac_nids,
9471 .channel_mode = alc885_mbp_4ch_modes,
9472 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9473 .input_mux = &alc882_capture_source,
9474 .dig_out_nid = ALC882_DIGOUT_NID,
9475 .dig_in_nid = ALC882_DIGIN_NID,
9476 .unsol_event = alc_automute_amp_unsol_event,
9477 .setup = alc885_imac91_setup,
9478 .init_hook = alc_automute_amp,
9481 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9482 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9483 alc880_gpio3_init_verbs, alc882_targa_verbs},
9484 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9485 .dac_nids = alc882_dac_nids,
9486 .dig_out_nid = ALC882_DIGOUT_NID,
9487 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9488 .adc_nids = alc882_adc_nids,
9489 .capsrc_nids = alc882_capsrc_nids,
9490 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9491 .channel_mode = alc882_3ST_6ch_modes,
9493 .input_mux = &alc882_capture_source,
9494 .unsol_event = alc882_targa_unsol_event,
9495 .setup = alc882_targa_setup,
9496 .init_hook = alc882_targa_automute,
9498 [ALC882_ASUS_A7J] = {
9499 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9500 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9501 alc882_asus_a7j_verbs},
9502 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9503 .dac_nids = alc882_dac_nids,
9504 .dig_out_nid = ALC882_DIGOUT_NID,
9505 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9506 .adc_nids = alc882_adc_nids,
9507 .capsrc_nids = alc882_capsrc_nids,
9508 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9509 .channel_mode = alc882_3ST_6ch_modes,
9511 .input_mux = &alc882_capture_source,
9513 [ALC882_ASUS_A7M] = {
9514 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9515 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9516 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9517 alc882_asus_a7m_verbs },
9518 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9519 .dac_nids = alc882_dac_nids,
9520 .dig_out_nid = ALC882_DIGOUT_NID,
9521 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9522 .channel_mode = alc880_threestack_modes,
9524 .input_mux = &alc882_capture_source,
9526 [ALC883_3ST_2ch_DIG] = {
9527 .mixers = { alc883_3ST_2ch_mixer },
9528 .init_verbs = { alc883_init_verbs },
9529 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9530 .dac_nids = alc883_dac_nids,
9531 .dig_out_nid = ALC883_DIGOUT_NID,
9532 .dig_in_nid = ALC883_DIGIN_NID,
9533 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9534 .channel_mode = alc883_3ST_2ch_modes,
9535 .input_mux = &alc883_capture_source,
9537 [ALC883_3ST_6ch_DIG] = {
9538 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9539 .init_verbs = { alc883_init_verbs },
9540 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9541 .dac_nids = alc883_dac_nids,
9542 .dig_out_nid = ALC883_DIGOUT_NID,
9543 .dig_in_nid = ALC883_DIGIN_NID,
9544 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9545 .channel_mode = alc883_3ST_6ch_modes,
9547 .input_mux = &alc883_capture_source,
9549 [ALC883_3ST_6ch] = {
9550 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9551 .init_verbs = { alc883_init_verbs },
9552 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9553 .dac_nids = alc883_dac_nids,
9554 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9555 .channel_mode = alc883_3ST_6ch_modes,
9557 .input_mux = &alc883_capture_source,
9559 [ALC883_3ST_6ch_INTEL] = {
9560 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9561 .init_verbs = { alc883_init_verbs },
9562 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9563 .dac_nids = alc883_dac_nids,
9564 .dig_out_nid = ALC883_DIGOUT_NID,
9565 .dig_in_nid = ALC883_DIGIN_NID,
9566 .slave_dig_outs = alc883_slave_dig_outs,
9567 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9568 .channel_mode = alc883_3ST_6ch_intel_modes,
9570 .input_mux = &alc883_3stack_6ch_intel,
9573 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9574 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9575 alc_hp15_unsol_verbs },
9576 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9577 .dac_nids = alc883_dac_nids,
9578 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9579 .adc_nids = alc889_adc_nids,
9580 .dig_out_nid = ALC883_DIGOUT_NID,
9581 .dig_in_nid = ALC883_DIGIN_NID,
9582 .slave_dig_outs = alc883_slave_dig_outs,
9583 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9584 .channel_mode = alc889_8ch_intel_modes,
9585 .capsrc_nids = alc889_capsrc_nids,
9586 .input_mux = &alc889_capture_source,
9587 .setup = alc889_automute_setup,
9588 .init_hook = alc_automute_amp,
9589 .unsol_event = alc_automute_amp_unsol_event,
9593 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9594 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9595 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9596 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9597 .dac_nids = alc883_dac_nids,
9598 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9599 .adc_nids = alc889_adc_nids,
9600 .dig_out_nid = ALC883_DIGOUT_NID,
9601 .dig_in_nid = ALC883_DIGIN_NID,
9602 .slave_dig_outs = alc883_slave_dig_outs,
9603 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9604 .channel_mode = alc889_8ch_intel_modes,
9605 .capsrc_nids = alc889_capsrc_nids,
9606 .input_mux = &alc889_capture_source,
9607 .setup = alc889_automute_setup,
9608 .init_hook = alc889_intel_init_hook,
9609 .unsol_event = alc_automute_amp_unsol_event,
9612 [ALC883_6ST_DIG] = {
9613 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9614 .init_verbs = { alc883_init_verbs },
9615 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9616 .dac_nids = alc883_dac_nids,
9617 .dig_out_nid = ALC883_DIGOUT_NID,
9618 .dig_in_nid = ALC883_DIGIN_NID,
9619 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9620 .channel_mode = alc883_sixstack_modes,
9621 .input_mux = &alc883_capture_source,
9623 [ALC883_TARGA_DIG] = {
9624 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9625 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9626 alc883_targa_verbs},
9627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9628 .dac_nids = alc883_dac_nids,
9629 .dig_out_nid = ALC883_DIGOUT_NID,
9630 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9631 .channel_mode = alc883_3ST_6ch_modes,
9633 .input_mux = &alc883_capture_source,
9634 .unsol_event = alc883_targa_unsol_event,
9635 .setup = alc882_targa_setup,
9636 .init_hook = alc882_targa_automute,
9638 [ALC883_TARGA_2ch_DIG] = {
9639 .mixers = { alc883_targa_2ch_mixer},
9640 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9641 alc883_targa_verbs},
9642 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9643 .dac_nids = alc883_dac_nids,
9644 .adc_nids = alc883_adc_nids_alt,
9645 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9646 .capsrc_nids = alc883_capsrc_nids,
9647 .dig_out_nid = ALC883_DIGOUT_NID,
9648 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9649 .channel_mode = alc883_3ST_2ch_modes,
9650 .input_mux = &alc883_capture_source,
9651 .unsol_event = alc883_targa_unsol_event,
9652 .setup = alc882_targa_setup,
9653 .init_hook = alc882_targa_automute,
9655 [ALC883_TARGA_8ch_DIG] = {
9656 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9657 alc883_chmode_mixer },
9658 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9659 alc883_targa_verbs },
9660 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9661 .dac_nids = alc883_dac_nids,
9662 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9663 .adc_nids = alc883_adc_nids_rev,
9664 .capsrc_nids = alc883_capsrc_nids_rev,
9665 .dig_out_nid = ALC883_DIGOUT_NID,
9666 .dig_in_nid = ALC883_DIGIN_NID,
9667 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9668 .channel_mode = alc883_4ST_8ch_modes,
9670 .input_mux = &alc883_capture_source,
9671 .unsol_event = alc883_targa_unsol_event,
9672 .setup = alc882_targa_setup,
9673 .init_hook = alc882_targa_automute,
9676 .mixers = { alc883_base_mixer },
9677 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9678 * and the headphone jack. Turn this on and rely on the
9679 * standard mute methods whenever the user wants to turn
9680 * these outputs off.
9682 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9683 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9684 .dac_nids = alc883_dac_nids,
9685 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9686 .channel_mode = alc883_3ST_2ch_modes,
9687 .input_mux = &alc883_capture_source,
9689 [ALC883_ACER_ASPIRE] = {
9690 .mixers = { alc883_acer_aspire_mixer },
9691 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9692 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9693 .dac_nids = alc883_dac_nids,
9694 .dig_out_nid = ALC883_DIGOUT_NID,
9695 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9696 .channel_mode = alc883_3ST_2ch_modes,
9697 .input_mux = &alc883_capture_source,
9698 .unsol_event = alc_automute_amp_unsol_event,
9699 .setup = alc883_acer_aspire_setup,
9700 .init_hook = alc_automute_amp,
9702 [ALC888_ACER_ASPIRE_4930G] = {
9703 .mixers = { alc888_base_mixer,
9704 alc883_chmode_mixer },
9705 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9706 alc888_acer_aspire_4930g_verbs },
9707 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9708 .dac_nids = alc883_dac_nids,
9709 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9710 .adc_nids = alc883_adc_nids_rev,
9711 .capsrc_nids = alc883_capsrc_nids_rev,
9712 .dig_out_nid = ALC883_DIGOUT_NID,
9713 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9714 .channel_mode = alc883_3ST_6ch_modes,
9716 .const_channel_count = 6,
9718 ARRAY_SIZE(alc888_2_capture_sources),
9719 .input_mux = alc888_2_capture_sources,
9720 .unsol_event = alc_automute_amp_unsol_event,
9721 .setup = alc888_acer_aspire_4930g_setup,
9722 .init_hook = alc_automute_amp,
9724 [ALC888_ACER_ASPIRE_6530G] = {
9725 .mixers = { alc888_acer_aspire_6530_mixer },
9726 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9727 alc888_acer_aspire_6530g_verbs },
9728 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9729 .dac_nids = alc883_dac_nids,
9730 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9731 .adc_nids = alc883_adc_nids_rev,
9732 .capsrc_nids = alc883_capsrc_nids_rev,
9733 .dig_out_nid = ALC883_DIGOUT_NID,
9734 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9735 .channel_mode = alc883_3ST_2ch_modes,
9737 ARRAY_SIZE(alc888_2_capture_sources),
9738 .input_mux = alc888_acer_aspire_6530_sources,
9739 .unsol_event = alc_automute_amp_unsol_event,
9740 .setup = alc888_acer_aspire_6530g_setup,
9741 .init_hook = alc_automute_amp,
9743 [ALC888_ACER_ASPIRE_8930G] = {
9744 .mixers = { alc889_acer_aspire_8930g_mixer,
9745 alc883_chmode_mixer },
9746 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9747 alc889_acer_aspire_8930g_verbs,
9749 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9750 .dac_nids = alc883_dac_nids,
9751 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9752 .adc_nids = alc889_adc_nids,
9753 .capsrc_nids = alc889_capsrc_nids,
9754 .dig_out_nid = ALC883_DIGOUT_NID,
9755 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9756 .channel_mode = alc883_3ST_6ch_modes,
9758 .const_channel_count = 6,
9760 ARRAY_SIZE(alc889_capture_sources),
9761 .input_mux = alc889_capture_sources,
9762 .unsol_event = alc_automute_amp_unsol_event,
9763 .setup = alc889_acer_aspire_8930g_setup,
9764 .init_hook = alc_automute_amp,
9765 #ifdef CONFIG_SND_HDA_POWER_SAVE
9766 .power_hook = alc_power_eapd,
9769 [ALC888_ACER_ASPIRE_7730G] = {
9770 .mixers = { alc883_3ST_6ch_mixer,
9771 alc883_chmode_mixer },
9772 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9773 alc888_acer_aspire_7730G_verbs },
9774 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9775 .dac_nids = alc883_dac_nids,
9776 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9777 .adc_nids = alc883_adc_nids_rev,
9778 .capsrc_nids = alc883_capsrc_nids_rev,
9779 .dig_out_nid = ALC883_DIGOUT_NID,
9780 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9781 .channel_mode = alc883_3ST_6ch_modes,
9783 .const_channel_count = 6,
9784 .input_mux = &alc883_capture_source,
9785 .unsol_event = alc_automute_amp_unsol_event,
9786 .setup = alc888_acer_aspire_6530g_setup,
9787 .init_hook = alc_automute_amp,
9790 .mixers = { alc883_fivestack_mixer,
9791 alc883_chmode_mixer },
9792 .init_verbs = { alc883_init_verbs,
9793 alc883_medion_eapd_verbs },
9794 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9795 .dac_nids = alc883_dac_nids,
9796 .adc_nids = alc883_adc_nids_alt,
9797 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9798 .capsrc_nids = alc883_capsrc_nids,
9799 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9800 .channel_mode = alc883_sixstack_modes,
9801 .input_mux = &alc883_capture_source,
9803 [ALC883_MEDION_MD2] = {
9804 .mixers = { alc883_medion_md2_mixer},
9805 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9807 .dac_nids = alc883_dac_nids,
9808 .dig_out_nid = ALC883_DIGOUT_NID,
9809 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9810 .channel_mode = alc883_3ST_2ch_modes,
9811 .input_mux = &alc883_capture_source,
9812 .unsol_event = alc_automute_amp_unsol_event,
9813 .setup = alc883_medion_md2_setup,
9814 .init_hook = alc_automute_amp,
9816 [ALC883_LAPTOP_EAPD] = {
9817 .mixers = { alc883_base_mixer },
9818 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9819 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9820 .dac_nids = alc883_dac_nids,
9821 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9822 .channel_mode = alc883_3ST_2ch_modes,
9823 .input_mux = &alc883_capture_source,
9825 [ALC883_CLEVO_M540R] = {
9826 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9827 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9828 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9829 .dac_nids = alc883_dac_nids,
9830 .dig_out_nid = ALC883_DIGOUT_NID,
9831 .dig_in_nid = ALC883_DIGIN_NID,
9832 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9833 .channel_mode = alc883_3ST_6ch_clevo_modes,
9835 .input_mux = &alc883_capture_source,
9836 /* This machine has the hardware HP auto-muting, thus
9837 * we need no software mute via unsol event
9840 [ALC883_CLEVO_M720] = {
9841 .mixers = { alc883_clevo_m720_mixer },
9842 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9843 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9844 .dac_nids = alc883_dac_nids,
9845 .dig_out_nid = ALC883_DIGOUT_NID,
9846 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9847 .channel_mode = alc883_3ST_2ch_modes,
9848 .input_mux = &alc883_capture_source,
9849 .unsol_event = alc883_clevo_m720_unsol_event,
9850 .setup = alc883_clevo_m720_setup,
9851 .init_hook = alc883_clevo_m720_init_hook,
9853 [ALC883_LENOVO_101E_2ch] = {
9854 .mixers = { alc883_lenovo_101e_2ch_mixer},
9855 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9856 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9857 .dac_nids = alc883_dac_nids,
9858 .adc_nids = alc883_adc_nids_alt,
9859 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9860 .capsrc_nids = alc883_capsrc_nids,
9861 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9862 .channel_mode = alc883_3ST_2ch_modes,
9863 .input_mux = &alc883_lenovo_101e_capture_source,
9864 .unsol_event = alc883_lenovo_101e_unsol_event,
9865 .init_hook = alc883_lenovo_101e_all_automute,
9867 [ALC883_LENOVO_NB0763] = {
9868 .mixers = { alc883_lenovo_nb0763_mixer },
9869 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9870 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9871 .dac_nids = alc883_dac_nids,
9872 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9873 .channel_mode = alc883_3ST_2ch_modes,
9875 .input_mux = &alc883_lenovo_nb0763_capture_source,
9876 .unsol_event = alc_automute_amp_unsol_event,
9877 .setup = alc883_medion_md2_setup,
9878 .init_hook = alc_automute_amp,
9880 [ALC888_LENOVO_MS7195_DIG] = {
9881 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9882 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9883 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9884 .dac_nids = alc883_dac_nids,
9885 .dig_out_nid = ALC883_DIGOUT_NID,
9886 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9887 .channel_mode = alc883_3ST_6ch_modes,
9889 .input_mux = &alc883_capture_source,
9890 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9891 .init_hook = alc888_lenovo_ms7195_front_automute,
9893 [ALC883_HAIER_W66] = {
9894 .mixers = { alc883_targa_2ch_mixer},
9895 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9896 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9897 .dac_nids = alc883_dac_nids,
9898 .dig_out_nid = ALC883_DIGOUT_NID,
9899 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9900 .channel_mode = alc883_3ST_2ch_modes,
9901 .input_mux = &alc883_capture_source,
9902 .unsol_event = alc_automute_amp_unsol_event,
9903 .setup = alc883_haier_w66_setup,
9904 .init_hook = alc_automute_amp,
9907 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9908 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9909 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9910 .dac_nids = alc883_dac_nids,
9911 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9912 .channel_mode = alc888_3st_hp_modes,
9914 .input_mux = &alc883_capture_source,
9915 .unsol_event = alc_automute_amp_unsol_event,
9916 .setup = alc888_3st_hp_setup,
9917 .init_hook = alc_automute_amp,
9919 [ALC888_6ST_DELL] = {
9920 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9921 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9922 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9923 .dac_nids = alc883_dac_nids,
9924 .dig_out_nid = ALC883_DIGOUT_NID,
9925 .dig_in_nid = ALC883_DIGIN_NID,
9926 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9927 .channel_mode = alc883_sixstack_modes,
9928 .input_mux = &alc883_capture_source,
9929 .unsol_event = alc_automute_amp_unsol_event,
9930 .setup = alc888_6st_dell_setup,
9931 .init_hook = alc_automute_amp,
9934 .mixers = { alc883_mitac_mixer },
9935 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9936 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9937 .dac_nids = alc883_dac_nids,
9938 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9939 .channel_mode = alc883_3ST_2ch_modes,
9940 .input_mux = &alc883_capture_source,
9941 .unsol_event = alc_automute_amp_unsol_event,
9942 .setup = alc883_mitac_setup,
9943 .init_hook = alc_automute_amp,
9945 [ALC883_FUJITSU_PI2515] = {
9946 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9947 .init_verbs = { alc883_init_verbs,
9948 alc883_2ch_fujitsu_pi2515_verbs},
9949 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9950 .dac_nids = alc883_dac_nids,
9951 .dig_out_nid = ALC883_DIGOUT_NID,
9952 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9953 .channel_mode = alc883_3ST_2ch_modes,
9954 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9955 .unsol_event = alc_automute_amp_unsol_event,
9956 .setup = alc883_2ch_fujitsu_pi2515_setup,
9957 .init_hook = alc_automute_amp,
9959 [ALC888_FUJITSU_XA3530] = {
9960 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9961 .init_verbs = { alc883_init_verbs,
9962 alc888_fujitsu_xa3530_verbs },
9963 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9964 .dac_nids = alc883_dac_nids,
9965 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9966 .adc_nids = alc883_adc_nids_rev,
9967 .capsrc_nids = alc883_capsrc_nids_rev,
9968 .dig_out_nid = ALC883_DIGOUT_NID,
9969 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9970 .channel_mode = alc888_4ST_8ch_intel_modes,
9972 ARRAY_SIZE(alc888_2_capture_sources),
9973 .input_mux = alc888_2_capture_sources,
9974 .unsol_event = alc_automute_amp_unsol_event,
9975 .setup = alc888_fujitsu_xa3530_setup,
9976 .init_hook = alc_automute_amp,
9978 [ALC888_LENOVO_SKY] = {
9979 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9980 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9981 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9982 .dac_nids = alc883_dac_nids,
9983 .dig_out_nid = ALC883_DIGOUT_NID,
9984 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9985 .channel_mode = alc883_sixstack_modes,
9987 .input_mux = &alc883_lenovo_sky_capture_source,
9988 .unsol_event = alc_automute_amp_unsol_event,
9989 .setup = alc888_lenovo_sky_setup,
9990 .init_hook = alc_automute_amp,
9992 [ALC888_ASUS_M90V] = {
9993 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9994 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9995 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9996 .dac_nids = alc883_dac_nids,
9997 .dig_out_nid = ALC883_DIGOUT_NID,
9998 .dig_in_nid = ALC883_DIGIN_NID,
9999 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10000 .channel_mode = alc883_3ST_6ch_modes,
10002 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10003 .unsol_event = alc_sku_unsol_event,
10004 .setup = alc883_mode2_setup,
10005 .init_hook = alc_inithook,
10007 [ALC888_ASUS_EEE1601] = {
10008 .mixers = { alc883_asus_eee1601_mixer },
10009 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10010 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10011 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10012 .dac_nids = alc883_dac_nids,
10013 .dig_out_nid = ALC883_DIGOUT_NID,
10014 .dig_in_nid = ALC883_DIGIN_NID,
10015 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10016 .channel_mode = alc883_3ST_2ch_modes,
10018 .input_mux = &alc883_asus_eee1601_capture_source,
10019 .unsol_event = alc_sku_unsol_event,
10020 .init_hook = alc883_eee1601_inithook,
10022 [ALC1200_ASUS_P5Q] = {
10023 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10024 .init_verbs = { alc883_init_verbs },
10025 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10026 .dac_nids = alc883_dac_nids,
10027 .dig_out_nid = ALC1200_DIGOUT_NID,
10028 .dig_in_nid = ALC883_DIGIN_NID,
10029 .slave_dig_outs = alc1200_slave_dig_outs,
10030 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10031 .channel_mode = alc883_sixstack_modes,
10032 .input_mux = &alc883_capture_source,
10035 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10036 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10037 alc880_gpio1_init_verbs },
10038 .adc_nids = alc883_adc_nids,
10039 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10040 .capsrc_nids = alc883_capsrc_nids,
10041 .dac_nids = alc883_dac_nids,
10042 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10043 .channel_mode = alc889A_mb31_6ch_modes,
10044 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10045 .input_mux = &alc889A_mb31_capture_source,
10046 .dig_out_nid = ALC883_DIGOUT_NID,
10047 .unsol_event = alc889A_mb31_unsol_event,
10048 .init_hook = alc889A_mb31_automute,
10050 [ALC883_SONY_VAIO_TT] = {
10051 .mixers = { alc883_vaiott_mixer },
10052 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10053 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10054 .dac_nids = alc883_dac_nids,
10055 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10056 .channel_mode = alc883_3ST_2ch_modes,
10057 .input_mux = &alc883_capture_source,
10058 .unsol_event = alc_automute_amp_unsol_event,
10059 .setup = alc883_vaiott_setup,
10060 .init_hook = alc_automute_amp,
10069 PINFIX_ABIT_AW9D_MAX
10072 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10073 { 0x15, 0x01080104 }, /* side */
10074 { 0x16, 0x01011012 }, /* rear */
10075 { 0x17, 0x01016011 }, /* clfe */
10079 static const struct alc_fixup alc882_fixups[] = {
10080 [PINFIX_ABIT_AW9D_MAX] = {
10081 .pins = alc882_abit_aw9d_pinfix
10085 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10086 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10091 * BIOS auto configuration
10093 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10094 const struct auto_pin_cfg *cfg)
10096 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10099 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10100 hda_nid_t nid, int pin_type,
10103 /* set as output */
10104 struct alc_spec *spec = codec->spec;
10107 alc_set_pin_output(codec, nid, pin_type);
10108 if (spec->multiout.dac_nids[dac_idx] == 0x25)
10111 if (spec->multiout.num_dacs >= dac_idx)
10113 idx = spec->multiout.dac_nids[dac_idx] - 2;
10115 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10119 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10121 struct alc_spec *spec = codec->spec;
10124 for (i = 0; i <= HDA_SIDE; i++) {
10125 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10126 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10128 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10133 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10135 struct alc_spec *spec = codec->spec;
10138 pin = spec->autocfg.hp_pins[0];
10139 if (pin) /* connect to front */
10141 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10142 pin = spec->autocfg.speaker_pins[0];
10144 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10147 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10149 struct alc_spec *spec = codec->spec;
10152 for (i = 0; i < AUTO_PIN_LAST; i++) {
10153 hda_nid_t nid = spec->autocfg.input_pins[i];
10156 alc_set_input_pin(codec, nid, i);
10157 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10158 snd_hda_codec_write(codec, nid, 0,
10159 AC_VERB_SET_AMP_GAIN_MUTE,
10164 static void alc882_auto_init_input_src(struct hda_codec *codec)
10166 struct alc_spec *spec = codec->spec;
10169 for (c = 0; c < spec->num_adc_nids; c++) {
10170 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10171 hda_nid_t nid = spec->capsrc_nids[c];
10172 unsigned int mux_idx;
10173 const struct hda_input_mux *imux;
10174 int conns, mute, idx, item;
10176 conns = snd_hda_get_connections(codec, nid, conn_list,
10177 ARRAY_SIZE(conn_list));
10180 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10181 imux = &spec->input_mux[mux_idx];
10182 if (!imux->num_items && mux_idx > 0)
10183 imux = &spec->input_mux[0];
10184 for (idx = 0; idx < conns; idx++) {
10185 /* if the current connection is the selected one,
10186 * unmute it as default - otherwise mute it
10188 mute = AMP_IN_MUTE(idx);
10189 for (item = 0; item < imux->num_items; item++) {
10190 if (imux->items[item].index == idx) {
10191 if (spec->cur_mux[c] == item)
10192 mute = AMP_IN_UNMUTE(idx);
10196 /* check if we have a selector or mixer
10197 * we could check for the widget type instead, but
10198 * just check for Amp-In presence (in case of mixer
10199 * without amp-in there is something wrong, this
10200 * function shouldn't be used or capsrc nid is wrong)
10202 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10203 snd_hda_codec_write(codec, nid, 0,
10204 AC_VERB_SET_AMP_GAIN_MUTE,
10206 else if (mute != AMP_IN_MUTE(idx))
10207 snd_hda_codec_write(codec, nid, 0,
10208 AC_VERB_SET_CONNECT_SEL,
10214 /* add mic boosts if needed */
10215 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10217 struct alc_spec *spec = codec->spec;
10221 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10222 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10223 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10225 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10229 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10230 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10231 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10233 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10240 /* almost identical with ALC880 parser... */
10241 static int alc882_parse_auto_config(struct hda_codec *codec)
10243 struct alc_spec *spec = codec->spec;
10244 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10247 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10251 if (!spec->autocfg.line_outs)
10252 return 0; /* can't find valid BIOS pin config */
10254 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10257 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10260 err = alc880_auto_create_extra_out(spec,
10261 spec->autocfg.speaker_pins[0],
10265 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10269 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10273 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10275 /* check multiple SPDIF-out (for recent codecs) */
10276 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10278 err = snd_hda_get_connections(codec,
10279 spec->autocfg.dig_out_pins[i],
10284 spec->multiout.dig_out_nid = dig_nid;
10286 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10287 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10289 spec->slave_dig_outs[i - 1] = dig_nid;
10292 if (spec->autocfg.dig_in_pin)
10293 spec->dig_in_nid = ALC880_DIGIN_NID;
10295 if (spec->kctls.list)
10296 add_mixer(spec, spec->kctls.list);
10298 add_verb(spec, alc883_auto_init_verbs);
10299 /* if ADC 0x07 is available, initialize it, too */
10300 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10301 add_verb(spec, alc882_adc1_init_verbs);
10303 spec->num_mux_defs = 1;
10304 spec->input_mux = &spec->private_imux[0];
10306 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10308 err = alc_auto_add_mic_boost(codec);
10312 return 1; /* config found */
10315 /* additional initialization for auto-configuration model */
10316 static void alc882_auto_init(struct hda_codec *codec)
10318 struct alc_spec *spec = codec->spec;
10319 alc882_auto_init_multi_out(codec);
10320 alc882_auto_init_hp_out(codec);
10321 alc882_auto_init_analog_input(codec);
10322 alc882_auto_init_input_src(codec);
10323 if (spec->unsol_event)
10324 alc_inithook(codec);
10327 static int patch_alc882(struct hda_codec *codec)
10329 struct alc_spec *spec;
10330 int err, board_config;
10332 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10336 codec->spec = spec;
10338 switch (codec->vendor_id) {
10343 /* ALC883 and variants */
10344 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10348 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10352 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10353 board_config = snd_hda_check_board_codec_sid_config(codec,
10354 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10356 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10357 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10359 board_config = ALC882_AUTO;
10362 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10364 if (board_config == ALC882_AUTO) {
10365 /* automatic parse from the BIOS config */
10366 err = alc882_parse_auto_config(codec);
10372 "hda_codec: Cannot set up configuration "
10373 "from BIOS. Using base mode...\n");
10374 board_config = ALC882_3ST_DIG;
10378 err = snd_hda_attach_beep_device(codec, 0x1);
10384 if (board_config != ALC882_AUTO)
10385 setup_preset(codec, &alc882_presets[board_config]);
10387 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10388 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10389 /* FIXME: setup DAC5 */
10390 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10391 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10393 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10394 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10396 if (codec->vendor_id == 0x10ec0888)
10397 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10399 if (!spec->adc_nids && spec->input_mux) {
10401 spec->num_adc_nids = 0;
10402 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10403 const struct hda_input_mux *imux = spec->input_mux;
10405 hda_nid_t items[16];
10406 hda_nid_t nid = alc882_adc_nids[i];
10407 unsigned int wcap = get_wcaps(codec, nid);
10409 wcap = get_wcaps_type(wcap);
10410 if (wcap != AC_WID_AUD_IN)
10412 spec->private_adc_nids[spec->num_adc_nids] = nid;
10413 err = snd_hda_get_connections(codec, nid, &cap, 1);
10416 err = snd_hda_get_connections(codec, cap, items,
10417 ARRAY_SIZE(items));
10420 for (j = 0; j < imux->num_items; j++)
10421 if (imux->items[j].index >= err)
10423 if (j < imux->num_items)
10425 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10426 spec->num_adc_nids++;
10428 spec->adc_nids = spec->private_adc_nids;
10429 spec->capsrc_nids = spec->private_capsrc_nids;
10432 set_capture_mixer(codec);
10433 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10435 spec->vmaster_nid = 0x0c;
10437 codec->patch_ops = alc_patch_ops;
10438 if (board_config == ALC882_AUTO)
10439 spec->init_hook = alc882_auto_init;
10440 #ifdef CONFIG_SND_HDA_POWER_SAVE
10441 if (!spec->loopback.amplist)
10442 spec->loopback.amplist = alc882_loopbacks;
10453 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10454 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10456 #define alc262_dac_nids alc260_dac_nids
10457 #define alc262_adc_nids alc882_adc_nids
10458 #define alc262_adc_nids_alt alc882_adc_nids_alt
10459 #define alc262_capsrc_nids alc882_capsrc_nids
10460 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10462 #define alc262_modes alc260_modes
10463 #define alc262_capture_source alc882_capture_source
10465 static hda_nid_t alc262_dmic_adc_nids[1] = {
10470 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10472 static struct snd_kcontrol_new alc262_base_mixer[] = {
10473 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10474 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10475 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10476 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10477 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10478 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10479 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10480 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10481 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10482 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10483 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10484 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10485 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10486 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10487 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10488 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10492 /* update HP, line and mono-out pins according to the master switch */
10493 static void alc262_hp_master_update(struct hda_codec *codec)
10495 struct alc_spec *spec = codec->spec;
10496 int val = spec->master_sw;
10498 /* HP & line-out */
10499 snd_hda_codec_write_cache(codec, 0x1b, 0,
10500 AC_VERB_SET_PIN_WIDGET_CONTROL,
10502 snd_hda_codec_write_cache(codec, 0x15, 0,
10503 AC_VERB_SET_PIN_WIDGET_CONTROL,
10505 /* mono (speaker) depending on the HP jack sense */
10506 val = val && !spec->jack_present;
10507 snd_hda_codec_write_cache(codec, 0x16, 0,
10508 AC_VERB_SET_PIN_WIDGET_CONTROL,
10509 val ? PIN_OUT : 0);
10512 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10514 struct alc_spec *spec = codec->spec;
10516 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10517 alc262_hp_master_update(codec);
10520 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10522 if ((res >> 26) != ALC880_HP_EVENT)
10524 alc262_hp_bpc_automute(codec);
10527 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10529 struct alc_spec *spec = codec->spec;
10531 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10532 alc262_hp_master_update(codec);
10535 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10538 if ((res >> 26) != ALC880_HP_EVENT)
10540 alc262_hp_wildwest_automute(codec);
10543 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10545 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10546 struct snd_ctl_elem_value *ucontrol)
10548 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10549 struct alc_spec *spec = codec->spec;
10550 int val = !!*ucontrol->value.integer.value;
10552 if (val == spec->master_sw)
10554 spec->master_sw = val;
10555 alc262_hp_master_update(codec);
10559 #define ALC262_HP_MASTER_SWITCH \
10561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10562 .name = "Master Playback Switch", \
10563 .info = snd_ctl_boolean_mono_info, \
10564 .get = alc262_hp_master_sw_get, \
10565 .put = alc262_hp_master_sw_put, \
10568 .iface = NID_MAPPING, \
10569 .name = "Master Playback Switch", \
10570 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10574 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10575 ALC262_HP_MASTER_SWITCH,
10576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10577 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10579 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10581 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10585 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10586 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10587 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10588 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10589 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10590 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10591 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10592 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10593 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10594 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10598 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10599 ALC262_HP_MASTER_SWITCH,
10600 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10601 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10602 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10603 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10604 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10606 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10608 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10609 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10610 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10611 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10612 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10613 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10614 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10618 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10619 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10620 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10621 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10625 /* mute/unmute internal speaker according to the hp jack and mute state */
10626 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10628 struct alc_spec *spec = codec->spec;
10630 spec->autocfg.hp_pins[0] = 0x15;
10631 spec->autocfg.speaker_pins[0] = 0x14;
10634 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10635 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10636 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10637 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10641 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10645 static struct hda_verb alc262_hp_t5735_verbs[] = {
10646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10647 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10649 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10653 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10654 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10655 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10656 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10657 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10658 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10659 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10663 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10664 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10665 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10666 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10667 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10668 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10669 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10671 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10672 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10677 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10684 /* bind hp and internal speaker mute (with plug check) as master switch */
10685 static void alc262_hippo_master_update(struct hda_codec *codec)
10687 struct alc_spec *spec = codec->spec;
10688 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10689 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10690 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10694 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10695 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10696 HDA_AMP_MUTE, mute);
10697 /* mute internal speaker per jack sense */
10698 if (spec->jack_present)
10699 mute = HDA_AMP_MUTE;
10701 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10702 HDA_AMP_MUTE, mute);
10703 if (speaker_nid && speaker_nid != line_nid)
10704 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10705 HDA_AMP_MUTE, mute);
10708 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10710 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10711 struct snd_ctl_elem_value *ucontrol)
10713 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10714 struct alc_spec *spec = codec->spec;
10715 int val = !!*ucontrol->value.integer.value;
10717 if (val == spec->master_sw)
10719 spec->master_sw = val;
10720 alc262_hippo_master_update(codec);
10724 #define ALC262_HIPPO_MASTER_SWITCH \
10726 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10727 .name = "Master Playback Switch", \
10728 .info = snd_ctl_boolean_mono_info, \
10729 .get = alc262_hippo_master_sw_get, \
10730 .put = alc262_hippo_master_sw_put, \
10733 .iface = NID_MAPPING, \
10734 .name = "Master Playback Switch", \
10735 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10736 (SUBDEV_SPEAKER(0) << 16), \
10739 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10740 ALC262_HIPPO_MASTER_SWITCH,
10741 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10742 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10743 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10744 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10745 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10746 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10747 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10748 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10749 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10750 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10751 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10752 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10756 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10757 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10758 ALC262_HIPPO_MASTER_SWITCH,
10759 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10760 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10761 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10762 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10763 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10764 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10765 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10766 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10767 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10768 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10772 /* mute/unmute internal speaker according to the hp jack and mute state */
10773 static void alc262_hippo_automute(struct hda_codec *codec)
10775 struct alc_spec *spec = codec->spec;
10776 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10778 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10779 alc262_hippo_master_update(codec);
10782 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10784 if ((res >> 26) != ALC880_HP_EVENT)
10786 alc262_hippo_automute(codec);
10789 static void alc262_hippo_setup(struct hda_codec *codec)
10791 struct alc_spec *spec = codec->spec;
10793 spec->autocfg.hp_pins[0] = 0x15;
10794 spec->autocfg.speaker_pins[0] = 0x14;
10797 static void alc262_hippo1_setup(struct hda_codec *codec)
10799 struct alc_spec *spec = codec->spec;
10801 spec->autocfg.hp_pins[0] = 0x1b;
10802 spec->autocfg.speaker_pins[0] = 0x14;
10806 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10807 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10808 ALC262_HIPPO_MASTER_SWITCH,
10809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10811 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10812 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10816 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10817 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10818 ALC262_HIPPO_MASTER_SWITCH,
10819 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10822 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10823 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10827 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10828 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10829 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10830 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10831 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10832 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10833 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10834 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10835 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10836 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10837 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10838 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10839 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10843 static struct hda_verb alc262_tyan_verbs[] = {
10844 /* Headphone automute */
10845 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10846 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10847 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10849 /* P11 AUX_IN, white 4-pin connector */
10850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10851 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10852 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10853 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10858 /* unsolicited event for HP jack sensing */
10859 static void alc262_tyan_setup(struct hda_codec *codec)
10861 struct alc_spec *spec = codec->spec;
10863 spec->autocfg.hp_pins[0] = 0x1b;
10864 spec->autocfg.speaker_pins[0] = 0x15;
10868 #define alc262_capture_mixer alc882_capture_mixer
10869 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10872 * generic initialization of ADC, input mixers and output mixers
10874 static struct hda_verb alc262_init_verbs[] = {
10876 * Unmute ADC0-2 and set the default input to mic-in
10878 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10879 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10880 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10881 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10882 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10883 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10885 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10887 * Note: PASD motherboards uses the Line In 2 as the input for
10888 * front panel mic (mic 2)
10890 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10891 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10892 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10893 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10894 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10895 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10898 * Set up output mixers (0x0c - 0x0e)
10900 /* set vol=0 to output mixers */
10901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10903 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10904 /* set up input amps for analog loopback */
10905 /* Amp Indices: DAC = 0, mixer = 1 */
10906 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10908 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10910 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10913 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10914 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10915 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10916 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10917 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10918 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10920 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10921 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10922 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10924 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10926 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10927 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10929 /* FIXME: use matrix-type input source selection */
10930 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10931 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10932 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10933 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10934 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10935 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10937 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10938 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10939 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10940 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10942 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10943 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10944 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10950 static struct hda_verb alc262_eapd_verbs[] = {
10951 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10952 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10956 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10957 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10958 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10959 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10961 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10966 static struct hda_verb alc262_sony_unsol_verbs[] = {
10967 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10968 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10969 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10971 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10972 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10976 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10977 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10978 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10979 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10981 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10985 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10986 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10987 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10989 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10990 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10991 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10992 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10993 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10997 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10999 struct alc_spec *spec = codec->spec;
11001 spec->autocfg.hp_pins[0] = 0x15;
11002 spec->autocfg.speaker_pins[0] = 0x14;
11003 spec->ext_mic.pin = 0x18;
11004 spec->ext_mic.mux_idx = 0;
11005 spec->int_mic.pin = 0x12;
11006 spec->int_mic.mux_idx = 9;
11007 spec->auto_mic = 1;
11013 * 0x16 = internal speaker
11014 * 0x18 = external mic
11017 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11018 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11019 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11023 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11025 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11026 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11030 static struct hda_verb alc262_nec_verbs[] = {
11031 /* Unmute Speaker */
11032 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11035 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11036 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11038 /* External mic to headphone */
11039 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11040 /* External mic to speaker */
11041 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11047 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11048 * 0x1b = port replicator headphone out
11051 #define ALC_HP_EVENT 0x37
11053 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11054 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11055 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11056 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11057 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11061 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11062 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11063 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11067 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11068 /* Front Mic pin: input vref at 50% */
11069 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11070 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11074 static struct hda_input_mux alc262_fujitsu_capture_source = {
11078 { "Int Mic", 0x1 },
11083 static struct hda_input_mux alc262_HP_capture_source = {
11087 { "Front Mic", 0x1 },
11094 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11098 { "Front Mic", 0x2 },
11104 /* mute/unmute internal speaker according to the hp jacks and mute state */
11105 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11107 struct alc_spec *spec = codec->spec;
11110 if (force || !spec->sense_updated) {
11111 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11112 snd_hda_jack_detect(codec, 0x1b);
11113 spec->sense_updated = 1;
11115 /* unmute internal speaker only if both HPs are unplugged and
11116 * master switch is on
11118 if (spec->jack_present)
11119 mute = HDA_AMP_MUTE;
11121 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11122 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11123 HDA_AMP_MUTE, mute);
11126 /* unsolicited event for HP jack sensing */
11127 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11130 if ((res >> 26) != ALC_HP_EVENT)
11132 alc262_fujitsu_automute(codec, 1);
11135 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11137 alc262_fujitsu_automute(codec, 1);
11140 /* bind volumes of both NID 0x0c and 0x0d */
11141 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11142 .ops = &snd_hda_bind_vol,
11144 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11145 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11150 /* mute/unmute internal speaker according to the hp jack and mute state */
11151 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11153 struct alc_spec *spec = codec->spec;
11156 if (force || !spec->sense_updated) {
11157 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11158 spec->sense_updated = 1;
11160 if (spec->jack_present) {
11161 /* mute internal speaker */
11162 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11163 HDA_AMP_MUTE, HDA_AMP_MUTE);
11164 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11165 HDA_AMP_MUTE, HDA_AMP_MUTE);
11167 /* unmute internal speaker if necessary */
11168 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11169 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11170 HDA_AMP_MUTE, mute);
11171 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11172 HDA_AMP_MUTE, mute);
11176 /* unsolicited event for HP jack sensing */
11177 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11180 if ((res >> 26) != ALC_HP_EVENT)
11182 alc262_lenovo_3000_automute(codec, 1);
11185 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11186 int dir, int idx, long *valp)
11190 for (i = 0; i < 2; i++, valp++)
11191 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11193 *valp ? 0 : HDA_AMP_MUTE);
11197 /* bind hp and internal speaker mute (with plug check) */
11198 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11199 struct snd_ctl_elem_value *ucontrol)
11201 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11202 long *valp = ucontrol->value.integer.value;
11205 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11206 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11208 alc262_fujitsu_automute(codec, 0);
11212 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11213 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11215 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11216 .name = "Master Playback Switch",
11217 .subdevice = HDA_SUBDEV_AMP_FLAG,
11218 .info = snd_hda_mixer_amp_switch_info,
11219 .get = snd_hda_mixer_amp_switch_get,
11220 .put = alc262_fujitsu_master_sw_put,
11221 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11224 .iface = NID_MAPPING,
11225 .name = "Master Playback Switch",
11226 .private_value = 0x1b,
11228 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11229 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11230 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11233 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11234 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11235 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11239 /* bind hp and internal speaker mute (with plug check) */
11240 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11241 struct snd_ctl_elem_value *ucontrol)
11243 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11244 long *valp = ucontrol->value.integer.value;
11247 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11249 alc262_lenovo_3000_automute(codec, 0);
11253 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11254 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11256 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11257 .name = "Master Playback Switch",
11258 .subdevice = HDA_SUBDEV_AMP_FLAG,
11259 .info = snd_hda_mixer_amp_switch_info,
11260 .get = snd_hda_mixer_amp_switch_get,
11261 .put = alc262_lenovo_3000_master_sw_put,
11262 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11264 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11265 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11266 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11269 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11270 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11271 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11275 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11276 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11277 ALC262_HIPPO_MASTER_SWITCH,
11278 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11279 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11280 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11281 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11282 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11283 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11287 /* additional init verbs for Benq laptops */
11288 static struct hda_verb alc262_EAPD_verbs[] = {
11289 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11290 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11294 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11295 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11298 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11299 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11303 /* Samsung Q1 Ultra Vista model setup */
11304 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11305 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11306 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11307 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11308 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11309 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11310 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11314 static struct hda_verb alc262_ultra_verbs[] = {
11316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11320 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11321 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11322 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11323 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11325 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11326 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11328 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11331 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11332 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11333 /* ADC, choose mic */
11334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11347 /* mute/unmute internal speaker according to the hp jack and mute state */
11348 static void alc262_ultra_automute(struct hda_codec *codec)
11350 struct alc_spec *spec = codec->spec;
11354 /* auto-mute only when HP is used as HP */
11355 if (!spec->cur_mux[0]) {
11356 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11357 if (spec->jack_present)
11358 mute = HDA_AMP_MUTE;
11360 /* mute/unmute internal speaker */
11361 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11362 HDA_AMP_MUTE, mute);
11363 /* mute/unmute HP */
11364 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11365 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11368 /* unsolicited event for HP jack sensing */
11369 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11372 if ((res >> 26) != ALC880_HP_EVENT)
11374 alc262_ultra_automute(codec);
11377 static struct hda_input_mux alc262_ultra_capture_source = {
11381 { "Headphone", 0x7 },
11385 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11386 struct snd_ctl_elem_value *ucontrol)
11388 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11389 struct alc_spec *spec = codec->spec;
11392 ret = alc_mux_enum_put(kcontrol, ucontrol);
11395 /* reprogram the HP pin as mic or HP according to the input source */
11396 snd_hda_codec_write_cache(codec, 0x15, 0,
11397 AC_VERB_SET_PIN_WIDGET_CONTROL,
11398 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11399 alc262_ultra_automute(codec); /* mute/unmute HP */
11403 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11404 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11405 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11407 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11408 .name = "Capture Source",
11409 .info = alc_mux_enum_info,
11410 .get = alc_mux_enum_get,
11411 .put = alc262_ultra_mux_enum_put,
11414 .iface = NID_MAPPING,
11415 .name = "Capture Source",
11416 .private_value = 0x15,
11421 /* We use two mixers depending on the output pin; 0x16 is a mono output
11422 * and thus it's bound with a different mixer.
11423 * This function returns which mixer amp should be used.
11425 static int alc262_check_volbit(hda_nid_t nid)
11429 else if (nid == 0x16)
11435 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11436 const char *pfx, int *vbits)
11441 vbit = alc262_check_volbit(nid);
11444 if (*vbits & vbit) /* a volume control for this mixer already there */
11448 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11450 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11451 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11454 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11462 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11464 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11465 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11468 /* add playback controls from the parsed DAC table */
11469 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11470 const struct auto_pin_cfg *cfg)
11476 spec->multiout.num_dacs = 1; /* only use one dac */
11477 spec->multiout.dac_nids = spec->private_dac_nids;
11478 spec->multiout.dac_nids[0] = 2;
11480 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11482 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11486 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11489 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11492 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11496 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11497 alc262_check_volbit(cfg->speaker_pins[0]) |
11498 alc262_check_volbit(cfg->hp_pins[0]);
11499 if (vbits == 1 || vbits == 2)
11500 pfx = "Master"; /* only one mixer is used */
11501 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11506 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11509 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11513 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11520 #define alc262_auto_create_input_ctls \
11521 alc882_auto_create_input_ctls
11524 * generic initialization of ADC, input mixers and output mixers
11526 static struct hda_verb alc262_volume_init_verbs[] = {
11528 * Unmute ADC0-2 and set the default input to mic-in
11530 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11532 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11534 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11537 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11539 * Note: PASD motherboards uses the Line In 2 as the input for
11540 * front panel mic (mic 2)
11542 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11550 * Set up output mixers (0x0c - 0x0f)
11552 /* set vol=0 to output mixers */
11553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11554 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11555 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11557 /* set up input amps for analog loopback */
11558 /* Amp Indices: DAC = 0, mixer = 1 */
11559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11561 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11562 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11563 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11564 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11566 /* FIXME: use matrix-type input source selection */
11567 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11568 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11569 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11574 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11577 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11582 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11587 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11589 * Unmute ADC0-2 and set the default input to mic-in
11591 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11592 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11593 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11595 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11598 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11600 * Note: PASD motherboards uses the Line In 2 as the input for
11601 * front panel mic (mic 2)
11603 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11605 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11606 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11613 * Set up output mixers (0x0c - 0x0e)
11615 /* set vol=0 to output mixers */
11616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11617 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11620 /* set up input amps for analog loopback */
11621 /* Amp Indices: DAC = 0, mixer = 1 */
11622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11624 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11625 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11626 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11627 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11629 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11630 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11631 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11633 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11634 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11636 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11637 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11639 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11640 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11641 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11642 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11643 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11646 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11647 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11648 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11649 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11650 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11653 /* FIXME: use matrix-type input source selection */
11654 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11655 /* Input mixer1: only unmute Mic */
11656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11671 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11672 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11673 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11674 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11676 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11678 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11679 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11686 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11691 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11693 * Unmute ADC0-2 and set the default input to mic-in
11695 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11697 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11699 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11702 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11704 * Note: PASD motherboards uses the Line In 2 as the input for front
11705 * panel mic (mic 2)
11707 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11714 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11717 * Set up output mixers (0x0c - 0x0e)
11719 /* set vol=0 to output mixers */
11720 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11721 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11722 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11724 /* set up input amps for analog loopback */
11725 /* Amp Indices: DAC = 0, mixer = 1 */
11726 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11728 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11729 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11730 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11731 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11734 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11735 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11736 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11737 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11738 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11739 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11740 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11742 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11745 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11746 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11748 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11749 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11751 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11752 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11753 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11755 /* FIXME: use matrix-type input source selection */
11756 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11757 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11758 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11763 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11768 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11771 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11779 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11782 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11787 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11791 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11793 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11794 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11796 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11799 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11800 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11805 #ifdef CONFIG_SND_HDA_POWER_SAVE
11806 #define alc262_loopbacks alc880_loopbacks
11809 /* pcm configuration: identical with ALC880 */
11810 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11811 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11812 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11813 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11816 * BIOS auto configuration
11818 static int alc262_parse_auto_config(struct hda_codec *codec)
11820 struct alc_spec *spec = codec->spec;
11822 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11824 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11828 if (!spec->autocfg.line_outs) {
11829 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11830 spec->multiout.max_channels = 2;
11831 spec->no_analog = 1;
11834 return 0; /* can't find valid BIOS pin config */
11836 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11839 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11843 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11846 if (spec->autocfg.dig_outs) {
11847 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11848 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11850 if (spec->autocfg.dig_in_pin)
11851 spec->dig_in_nid = ALC262_DIGIN_NID;
11853 if (spec->kctls.list)
11854 add_mixer(spec, spec->kctls.list);
11856 add_verb(spec, alc262_volume_init_verbs);
11857 spec->num_mux_defs = 1;
11858 spec->input_mux = &spec->private_imux[0];
11860 err = alc_auto_add_mic_boost(codec);
11864 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11869 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11870 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11871 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11872 #define alc262_auto_init_input_src alc882_auto_init_input_src
11875 /* init callback for auto-configuration model -- overriding the default init */
11876 static void alc262_auto_init(struct hda_codec *codec)
11878 struct alc_spec *spec = codec->spec;
11879 alc262_auto_init_multi_out(codec);
11880 alc262_auto_init_hp_out(codec);
11881 alc262_auto_init_analog_input(codec);
11882 alc262_auto_init_input_src(codec);
11883 if (spec->unsol_event)
11884 alc_inithook(codec);
11888 * configuration and preset
11890 static const char *alc262_models[ALC262_MODEL_LAST] = {
11891 [ALC262_BASIC] = "basic",
11892 [ALC262_HIPPO] = "hippo",
11893 [ALC262_HIPPO_1] = "hippo_1",
11894 [ALC262_FUJITSU] = "fujitsu",
11895 [ALC262_HP_BPC] = "hp-bpc",
11896 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11897 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11898 [ALC262_HP_RP5700] = "hp-rp5700",
11899 [ALC262_BENQ_ED8] = "benq",
11900 [ALC262_BENQ_T31] = "benq-t31",
11901 [ALC262_SONY_ASSAMD] = "sony-assamd",
11902 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11903 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11904 [ALC262_ULTRA] = "ultra",
11905 [ALC262_LENOVO_3000] = "lenovo-3000",
11906 [ALC262_NEC] = "nec",
11907 [ALC262_TYAN] = "tyan",
11908 [ALC262_AUTO] = "auto",
11911 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11912 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11913 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11914 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11916 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11918 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11920 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11921 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11922 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11923 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11924 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11925 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11926 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11927 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11928 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11929 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11930 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11931 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11932 ALC262_HP_TC_T5735),
11933 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11934 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11935 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11936 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11937 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11938 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11939 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11940 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11941 #if 0 /* disable the quirk since model=auto works better in recent versions */
11942 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11943 ALC262_SONY_ASSAMD),
11945 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11946 ALC262_TOSHIBA_RX1),
11947 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11948 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11949 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11950 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11951 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11953 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11954 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11955 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11956 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11957 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11961 static struct alc_config_preset alc262_presets[] = {
11963 .mixers = { alc262_base_mixer },
11964 .init_verbs = { alc262_init_verbs },
11965 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11966 .dac_nids = alc262_dac_nids,
11968 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11969 .channel_mode = alc262_modes,
11970 .input_mux = &alc262_capture_source,
11973 .mixers = { alc262_hippo_mixer },
11974 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11975 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11976 .dac_nids = alc262_dac_nids,
11978 .dig_out_nid = ALC262_DIGOUT_NID,
11979 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11980 .channel_mode = alc262_modes,
11981 .input_mux = &alc262_capture_source,
11982 .unsol_event = alc262_hippo_unsol_event,
11983 .setup = alc262_hippo_setup,
11984 .init_hook = alc262_hippo_automute,
11986 [ALC262_HIPPO_1] = {
11987 .mixers = { alc262_hippo1_mixer },
11988 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11989 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11990 .dac_nids = alc262_dac_nids,
11992 .dig_out_nid = ALC262_DIGOUT_NID,
11993 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11994 .channel_mode = alc262_modes,
11995 .input_mux = &alc262_capture_source,
11996 .unsol_event = alc262_hippo_unsol_event,
11997 .setup = alc262_hippo1_setup,
11998 .init_hook = alc262_hippo_automute,
12000 [ALC262_FUJITSU] = {
12001 .mixers = { alc262_fujitsu_mixer },
12002 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12003 alc262_fujitsu_unsol_verbs },
12004 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12005 .dac_nids = alc262_dac_nids,
12007 .dig_out_nid = ALC262_DIGOUT_NID,
12008 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12009 .channel_mode = alc262_modes,
12010 .input_mux = &alc262_fujitsu_capture_source,
12011 .unsol_event = alc262_fujitsu_unsol_event,
12012 .init_hook = alc262_fujitsu_init_hook,
12014 [ALC262_HP_BPC] = {
12015 .mixers = { alc262_HP_BPC_mixer },
12016 .init_verbs = { alc262_HP_BPC_init_verbs },
12017 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12018 .dac_nids = alc262_dac_nids,
12020 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12021 .channel_mode = alc262_modes,
12022 .input_mux = &alc262_HP_capture_source,
12023 .unsol_event = alc262_hp_bpc_unsol_event,
12024 .init_hook = alc262_hp_bpc_automute,
12026 [ALC262_HP_BPC_D7000_WF] = {
12027 .mixers = { alc262_HP_BPC_WildWest_mixer },
12028 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12029 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12030 .dac_nids = alc262_dac_nids,
12032 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12033 .channel_mode = alc262_modes,
12034 .input_mux = &alc262_HP_D7000_capture_source,
12035 .unsol_event = alc262_hp_wildwest_unsol_event,
12036 .init_hook = alc262_hp_wildwest_automute,
12038 [ALC262_HP_BPC_D7000_WL] = {
12039 .mixers = { alc262_HP_BPC_WildWest_mixer,
12040 alc262_HP_BPC_WildWest_option_mixer },
12041 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12042 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12043 .dac_nids = alc262_dac_nids,
12045 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12046 .channel_mode = alc262_modes,
12047 .input_mux = &alc262_HP_D7000_capture_source,
12048 .unsol_event = alc262_hp_wildwest_unsol_event,
12049 .init_hook = alc262_hp_wildwest_automute,
12051 [ALC262_HP_TC_T5735] = {
12052 .mixers = { alc262_hp_t5735_mixer },
12053 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12054 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12055 .dac_nids = alc262_dac_nids,
12057 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12058 .channel_mode = alc262_modes,
12059 .input_mux = &alc262_capture_source,
12060 .unsol_event = alc_sku_unsol_event,
12061 .setup = alc262_hp_t5735_setup,
12062 .init_hook = alc_inithook,
12064 [ALC262_HP_RP5700] = {
12065 .mixers = { alc262_hp_rp5700_mixer },
12066 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12067 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12068 .dac_nids = alc262_dac_nids,
12069 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12070 .channel_mode = alc262_modes,
12071 .input_mux = &alc262_hp_rp5700_capture_source,
12073 [ALC262_BENQ_ED8] = {
12074 .mixers = { alc262_base_mixer },
12075 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12076 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12077 .dac_nids = alc262_dac_nids,
12079 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12080 .channel_mode = alc262_modes,
12081 .input_mux = &alc262_capture_source,
12083 [ALC262_SONY_ASSAMD] = {
12084 .mixers = { alc262_sony_mixer },
12085 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12086 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12087 .dac_nids = alc262_dac_nids,
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_hippo_setup,
12094 .init_hook = alc262_hippo_automute,
12096 [ALC262_BENQ_T31] = {
12097 .mixers = { alc262_benq_t31_mixer },
12098 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12099 alc_hp15_unsol_verbs },
12100 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12101 .dac_nids = alc262_dac_nids,
12103 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12104 .channel_mode = alc262_modes,
12105 .input_mux = &alc262_capture_source,
12106 .unsol_event = alc262_hippo_unsol_event,
12107 .setup = alc262_hippo_setup,
12108 .init_hook = alc262_hippo_automute,
12111 .mixers = { alc262_ultra_mixer },
12112 .cap_mixer = alc262_ultra_capture_mixer,
12113 .init_verbs = { alc262_ultra_verbs },
12114 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12115 .dac_nids = alc262_dac_nids,
12116 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12117 .channel_mode = alc262_modes,
12118 .input_mux = &alc262_ultra_capture_source,
12119 .adc_nids = alc262_adc_nids, /* ADC0 */
12120 .capsrc_nids = alc262_capsrc_nids,
12121 .num_adc_nids = 1, /* single ADC */
12122 .unsol_event = alc262_ultra_unsol_event,
12123 .init_hook = alc262_ultra_automute,
12125 [ALC262_LENOVO_3000] = {
12126 .mixers = { alc262_lenovo_3000_mixer },
12127 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12128 alc262_lenovo_3000_unsol_verbs,
12129 alc262_lenovo_3000_init_verbs },
12130 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12131 .dac_nids = alc262_dac_nids,
12133 .dig_out_nid = ALC262_DIGOUT_NID,
12134 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12135 .channel_mode = alc262_modes,
12136 .input_mux = &alc262_fujitsu_capture_source,
12137 .unsol_event = alc262_lenovo_3000_unsol_event,
12140 .mixers = { alc262_nec_mixer },
12141 .init_verbs = { alc262_nec_verbs },
12142 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12143 .dac_nids = alc262_dac_nids,
12145 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12146 .channel_mode = alc262_modes,
12147 .input_mux = &alc262_capture_source,
12149 [ALC262_TOSHIBA_S06] = {
12150 .mixers = { alc262_toshiba_s06_mixer },
12151 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12152 alc262_eapd_verbs },
12153 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12154 .capsrc_nids = alc262_dmic_capsrc_nids,
12155 .dac_nids = alc262_dac_nids,
12156 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12157 .num_adc_nids = 1, /* single ADC */
12158 .dig_out_nid = ALC262_DIGOUT_NID,
12159 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12160 .channel_mode = alc262_modes,
12161 .unsol_event = alc_sku_unsol_event,
12162 .setup = alc262_toshiba_s06_setup,
12163 .init_hook = alc_inithook,
12165 [ALC262_TOSHIBA_RX1] = {
12166 .mixers = { alc262_toshiba_rx1_mixer },
12167 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12168 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12169 .dac_nids = alc262_dac_nids,
12171 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12172 .channel_mode = alc262_modes,
12173 .input_mux = &alc262_capture_source,
12174 .unsol_event = alc262_hippo_unsol_event,
12175 .setup = alc262_hippo_setup,
12176 .init_hook = alc262_hippo_automute,
12179 .mixers = { alc262_tyan_mixer },
12180 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12181 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12182 .dac_nids = alc262_dac_nids,
12184 .dig_out_nid = ALC262_DIGOUT_NID,
12185 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12186 .channel_mode = alc262_modes,
12187 .input_mux = &alc262_capture_source,
12188 .unsol_event = alc_automute_amp_unsol_event,
12189 .setup = alc262_tyan_setup,
12190 .init_hook = alc_automute_amp,
12194 static int patch_alc262(struct hda_codec *codec)
12196 struct alc_spec *spec;
12200 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12204 codec->spec = spec;
12206 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12211 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12212 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12213 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12214 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12218 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12220 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12224 if (board_config < 0) {
12225 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12227 board_config = ALC262_AUTO;
12230 if (board_config == ALC262_AUTO) {
12231 /* automatic parse from the BIOS config */
12232 err = alc262_parse_auto_config(codec);
12238 "hda_codec: Cannot set up configuration "
12239 "from BIOS. Using base mode...\n");
12240 board_config = ALC262_BASIC;
12244 if (!spec->no_analog) {
12245 err = snd_hda_attach_beep_device(codec, 0x1);
12252 if (board_config != ALC262_AUTO)
12253 setup_preset(codec, &alc262_presets[board_config]);
12255 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12256 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12258 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12259 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12261 if (!spec->adc_nids && spec->input_mux) {
12263 /* check whether the digital-mic has to be supported */
12264 for (i = 0; i < spec->input_mux->num_items; i++) {
12265 if (spec->input_mux->items[i].index >= 9)
12268 if (i < spec->input_mux->num_items) {
12269 /* use only ADC0 */
12270 spec->adc_nids = alc262_dmic_adc_nids;
12271 spec->num_adc_nids = 1;
12272 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12274 /* all analog inputs */
12275 /* check whether NID 0x07 is valid */
12276 unsigned int wcap = get_wcaps(codec, 0x07);
12279 wcap = get_wcaps_type(wcap);
12280 if (wcap != AC_WID_AUD_IN) {
12281 spec->adc_nids = alc262_adc_nids_alt;
12282 spec->num_adc_nids =
12283 ARRAY_SIZE(alc262_adc_nids_alt);
12284 spec->capsrc_nids = alc262_capsrc_nids_alt;
12286 spec->adc_nids = alc262_adc_nids;
12287 spec->num_adc_nids =
12288 ARRAY_SIZE(alc262_adc_nids);
12289 spec->capsrc_nids = alc262_capsrc_nids;
12293 if (!spec->cap_mixer && !spec->no_analog)
12294 set_capture_mixer(codec);
12295 if (!spec->no_analog)
12296 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12298 spec->vmaster_nid = 0x0c;
12300 codec->patch_ops = alc_patch_ops;
12301 if (board_config == ALC262_AUTO)
12302 spec->init_hook = alc262_auto_init;
12303 #ifdef CONFIG_SND_HDA_POWER_SAVE
12304 if (!spec->loopback.amplist)
12305 spec->loopback.amplist = alc262_loopbacks;
12312 * ALC268 channel source setting (2 channel)
12314 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12315 #define alc268_modes alc260_modes
12317 static hda_nid_t alc268_dac_nids[2] = {
12322 static hda_nid_t alc268_adc_nids[2] = {
12327 static hda_nid_t alc268_adc_nids_alt[1] = {
12332 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12334 static struct snd_kcontrol_new alc268_base_mixer[] = {
12335 /* output mixer control */
12336 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12337 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12338 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12340 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12341 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12342 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12346 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12347 /* output mixer control */
12348 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12349 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12350 ALC262_HIPPO_MASTER_SWITCH,
12351 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12352 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12353 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12357 /* bind Beep switches of both NID 0x0f and 0x10 */
12358 static struct hda_bind_ctls alc268_bind_beep_sw = {
12359 .ops = &snd_hda_bind_sw,
12361 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12362 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12367 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12368 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12369 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12373 static struct hda_verb alc268_eapd_verbs[] = {
12374 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12375 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12379 /* Toshiba specific */
12380 static struct hda_verb alc268_toshiba_verbs[] = {
12381 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12385 /* Acer specific */
12386 /* bind volumes of both NID 0x02 and 0x03 */
12387 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12388 .ops = &snd_hda_bind_vol,
12390 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12391 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12396 /* mute/unmute internal speaker according to the hp jack and mute state */
12397 static void alc268_acer_automute(struct hda_codec *codec, int force)
12399 struct alc_spec *spec = codec->spec;
12402 if (force || !spec->sense_updated) {
12403 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12404 spec->sense_updated = 1;
12406 if (spec->jack_present)
12407 mute = HDA_AMP_MUTE; /* mute internal speaker */
12408 else /* unmute internal speaker if necessary */
12409 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12410 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12411 HDA_AMP_MUTE, mute);
12415 /* bind hp and internal speaker mute (with plug check) */
12416 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12417 struct snd_ctl_elem_value *ucontrol)
12419 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12420 long *valp = ucontrol->value.integer.value;
12423 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12425 alc268_acer_automute(codec, 0);
12429 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12430 /* output mixer control */
12431 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12433 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12434 .name = "Master Playback Switch",
12435 .subdevice = HDA_SUBDEV_AMP_FLAG,
12436 .info = snd_hda_mixer_amp_switch_info,
12437 .get = snd_hda_mixer_amp_switch_get,
12438 .put = alc268_acer_master_sw_put,
12439 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12441 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12445 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12446 /* output mixer control */
12447 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12449 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12450 .name = "Master Playback Switch",
12451 .subdevice = HDA_SUBDEV_AMP_FLAG,
12452 .info = snd_hda_mixer_amp_switch_info,
12453 .get = snd_hda_mixer_amp_switch_get,
12454 .put = alc268_acer_master_sw_put,
12455 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12457 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12458 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12459 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12463 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12464 /* output mixer control */
12465 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12467 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12468 .name = "Master Playback Switch",
12469 .subdevice = HDA_SUBDEV_AMP_FLAG,
12470 .info = snd_hda_mixer_amp_switch_info,
12471 .get = snd_hda_mixer_amp_switch_get,
12472 .put = alc268_acer_master_sw_put,
12473 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12475 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12476 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12480 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12481 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12482 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12483 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12484 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12485 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12490 static struct hda_verb alc268_acer_verbs[] = {
12491 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12492 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12493 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12494 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12495 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12496 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12497 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12501 /* unsolicited event for HP jack sensing */
12502 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12503 #define alc268_toshiba_setup alc262_hippo_setup
12504 #define alc268_toshiba_automute alc262_hippo_automute
12506 static void alc268_acer_unsol_event(struct hda_codec *codec,
12509 if ((res >> 26) != ALC880_HP_EVENT)
12511 alc268_acer_automute(codec, 1);
12514 static void alc268_acer_init_hook(struct hda_codec *codec)
12516 alc268_acer_automute(codec, 1);
12519 /* toggle speaker-output according to the hp-jack state */
12520 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12522 unsigned int present;
12523 unsigned char bits;
12525 present = snd_hda_jack_detect(codec, 0x15);
12526 bits = present ? HDA_AMP_MUTE : 0;
12527 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12528 HDA_AMP_MUTE, bits);
12529 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12530 HDA_AMP_MUTE, bits);
12533 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12536 switch (res >> 26) {
12537 case ALC880_HP_EVENT:
12538 alc268_aspire_one_speaker_automute(codec);
12540 case ALC880_MIC_EVENT:
12541 alc_mic_automute(codec);
12546 static void alc268_acer_lc_setup(struct hda_codec *codec)
12548 struct alc_spec *spec = codec->spec;
12549 spec->ext_mic.pin = 0x18;
12550 spec->ext_mic.mux_idx = 0;
12551 spec->int_mic.pin = 0x12;
12552 spec->int_mic.mux_idx = 6;
12553 spec->auto_mic = 1;
12556 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12558 alc268_aspire_one_speaker_automute(codec);
12559 alc_mic_automute(codec);
12562 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12563 /* output mixer control */
12564 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12565 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12566 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12567 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12568 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12569 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12573 static struct hda_verb alc268_dell_verbs[] = {
12574 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12576 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12577 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12581 /* mute/unmute internal speaker according to the hp jack and mute state */
12582 static void alc268_dell_setup(struct hda_codec *codec)
12584 struct alc_spec *spec = codec->spec;
12586 spec->autocfg.hp_pins[0] = 0x15;
12587 spec->autocfg.speaker_pins[0] = 0x14;
12588 spec->ext_mic.pin = 0x18;
12589 spec->ext_mic.mux_idx = 0;
12590 spec->int_mic.pin = 0x19;
12591 spec->int_mic.mux_idx = 1;
12592 spec->auto_mic = 1;
12595 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12596 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12597 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12598 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12599 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12600 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12601 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12602 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12603 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12607 static struct hda_verb alc267_quanta_il1_verbs[] = {
12608 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12609 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12613 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12615 struct alc_spec *spec = codec->spec;
12616 spec->autocfg.hp_pins[0] = 0x15;
12617 spec->autocfg.speaker_pins[0] = 0x14;
12618 spec->ext_mic.pin = 0x18;
12619 spec->ext_mic.mux_idx = 0;
12620 spec->int_mic.pin = 0x19;
12621 spec->int_mic.mux_idx = 1;
12622 spec->auto_mic = 1;
12626 * generic initialization of ADC, input mixers and output mixers
12628 static struct hda_verb alc268_base_init_verbs[] = {
12629 /* Unmute DAC0-1 and set vol = 0 */
12630 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12631 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12634 * Set up output mixers (0x0c - 0x0e)
12636 /* set vol=0 to output mixers */
12637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12638 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12640 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12641 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12645 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12646 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12647 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12649 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12650 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12652 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12654 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12655 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12656 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12658 /* set PCBEEP vol = 0, mute connections */
12659 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12660 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12661 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12663 /* Unmute Selector 23h,24h and set the default input to mic-in */
12665 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12667 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12668 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12674 * generic initialization of ADC, input mixers and output mixers
12676 static struct hda_verb alc268_volume_init_verbs[] = {
12677 /* set output DAC */
12678 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12679 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12681 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12682 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12683 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12684 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12685 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12687 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12688 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12689 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12692 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12694 /* set PCBEEP vol = 0, mute connections */
12695 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12696 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12697 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12702 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12703 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12704 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12708 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12709 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12710 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12715 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12716 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12717 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12718 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12719 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12724 static struct hda_input_mux alc268_capture_source = {
12728 { "Front Mic", 0x1 },
12734 static struct hda_input_mux alc268_acer_capture_source = {
12738 { "Internal Mic", 0x1 },
12743 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12747 { "Internal Mic", 0x6 },
12752 #ifdef CONFIG_SND_DEBUG
12753 static struct snd_kcontrol_new alc268_test_mixer[] = {
12754 /* Volume widgets */
12755 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12756 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12757 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12758 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12759 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12760 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12761 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12762 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12763 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12764 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12765 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12766 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12767 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12768 /* The below appears problematic on some hardwares */
12769 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12770 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12771 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12772 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12773 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12775 /* Modes for retasking pin widgets */
12776 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12777 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12778 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12779 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12781 /* Controls for GPIO pins, assuming they are configured as outputs */
12782 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12783 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12784 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12785 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12787 /* Switches to allow the digital SPDIF output pin to be enabled.
12788 * The ALC268 does not have an SPDIF input.
12790 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12792 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12793 * this output to turn on an external amplifier.
12795 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12796 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12802 /* create input playback/capture controls for the given pin */
12803 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12804 const char *ctlname, int idx)
12820 if (spec->multiout.dac_nids[0] != dac &&
12821 spec->multiout.dac_nids[1] != dac) {
12822 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12823 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12827 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12831 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12832 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12834 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12835 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12841 /* add playback controls from the parsed DAC table */
12842 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12843 const struct auto_pin_cfg *cfg)
12848 spec->multiout.dac_nids = spec->private_dac_nids;
12850 nid = cfg->line_out_pins[0];
12853 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12857 err = alc268_new_analog_output(spec, nid, name, 0);
12862 nid = cfg->speaker_pins[0];
12864 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12865 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12869 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12873 nid = cfg->hp_pins[0];
12875 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12880 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12882 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12883 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12890 /* create playback/capture controls for input pins */
12891 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12892 const struct auto_pin_cfg *cfg)
12894 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12897 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12898 hda_nid_t nid, int pin_type)
12902 alc_set_pin_output(codec, nid, pin_type);
12903 if (nid == 0x14 || nid == 0x16)
12907 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12910 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12912 struct alc_spec *spec = codec->spec;
12913 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12915 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12916 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12920 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12922 struct alc_spec *spec = codec->spec;
12925 pin = spec->autocfg.hp_pins[0];
12927 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12928 pin = spec->autocfg.speaker_pins[0];
12930 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12933 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12935 struct alc_spec *spec = codec->spec;
12936 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12937 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12938 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12939 unsigned int dac_vol1, dac_vol2;
12941 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12942 snd_hda_codec_write(codec, speaker_nid, 0,
12943 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12944 /* mute mixer inputs from 0x1d */
12945 snd_hda_codec_write(codec, 0x0f, 0,
12946 AC_VERB_SET_AMP_GAIN_MUTE,
12948 snd_hda_codec_write(codec, 0x10, 0,
12949 AC_VERB_SET_AMP_GAIN_MUTE,
12952 /* unmute mixer inputs from 0x1d */
12953 snd_hda_codec_write(codec, 0x0f, 0,
12954 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12955 snd_hda_codec_write(codec, 0x10, 0,
12956 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12959 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12960 if (line_nid == 0x14)
12961 dac_vol2 = AMP_OUT_ZERO;
12962 else if (line_nid == 0x15)
12963 dac_vol1 = AMP_OUT_ZERO;
12964 if (hp_nid == 0x14)
12965 dac_vol2 = AMP_OUT_ZERO;
12966 else if (hp_nid == 0x15)
12967 dac_vol1 = AMP_OUT_ZERO;
12968 if (line_nid != 0x16 || hp_nid != 0x16 ||
12969 spec->autocfg.line_out_pins[1] != 0x16 ||
12970 spec->autocfg.line_out_pins[2] != 0x16)
12971 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12973 snd_hda_codec_write(codec, 0x02, 0,
12974 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12975 snd_hda_codec_write(codec, 0x03, 0,
12976 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12979 /* pcm configuration: identical with ALC880 */
12980 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12981 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12982 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12983 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12986 * BIOS auto configuration
12988 static int alc268_parse_auto_config(struct hda_codec *codec)
12990 struct alc_spec *spec = codec->spec;
12992 static hda_nid_t alc268_ignore[] = { 0 };
12994 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12998 if (!spec->autocfg.line_outs) {
12999 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13000 spec->multiout.max_channels = 2;
13001 spec->no_analog = 1;
13004 return 0; /* can't find valid BIOS pin config */
13006 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13009 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13013 spec->multiout.max_channels = 2;
13016 /* digital only support output */
13017 if (spec->autocfg.dig_outs) {
13018 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13019 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13021 if (spec->kctls.list)
13022 add_mixer(spec, spec->kctls.list);
13024 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13025 add_mixer(spec, alc268_beep_mixer);
13027 add_verb(spec, alc268_volume_init_verbs);
13028 spec->num_mux_defs = 2;
13029 spec->input_mux = &spec->private_imux[0];
13031 err = alc_auto_add_mic_boost(codec);
13035 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13040 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13042 /* init callback for auto-configuration model -- overriding the default init */
13043 static void alc268_auto_init(struct hda_codec *codec)
13045 struct alc_spec *spec = codec->spec;
13046 alc268_auto_init_multi_out(codec);
13047 alc268_auto_init_hp_out(codec);
13048 alc268_auto_init_mono_speaker_out(codec);
13049 alc268_auto_init_analog_input(codec);
13050 if (spec->unsol_event)
13051 alc_inithook(codec);
13055 * configuration and preset
13057 static const char *alc268_models[ALC268_MODEL_LAST] = {
13058 [ALC267_QUANTA_IL1] = "quanta-il1",
13059 [ALC268_3ST] = "3stack",
13060 [ALC268_TOSHIBA] = "toshiba",
13061 [ALC268_ACER] = "acer",
13062 [ALC268_ACER_DMIC] = "acer-dmic",
13063 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13064 [ALC268_DELL] = "dell",
13065 [ALC268_ZEPTO] = "zepto",
13066 #ifdef CONFIG_SND_DEBUG
13067 [ALC268_TEST] = "test",
13069 [ALC268_AUTO] = "auto",
13072 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13073 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13074 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13075 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13076 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13077 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13078 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13079 ALC268_ACER_ASPIRE_ONE),
13080 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13081 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13082 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13083 /* almost compatible with toshiba but with optional digital outs;
13084 * auto-probing seems working fine
13086 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13088 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13089 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13090 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13091 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13092 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13093 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13097 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13098 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13099 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13100 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13101 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13106 static struct alc_config_preset alc268_presets[] = {
13107 [ALC267_QUANTA_IL1] = {
13108 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13109 alc268_capture_nosrc_mixer },
13110 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13111 alc267_quanta_il1_verbs },
13112 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13113 .dac_nids = alc268_dac_nids,
13114 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13115 .adc_nids = alc268_adc_nids_alt,
13117 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13118 .channel_mode = alc268_modes,
13119 .unsol_event = alc_sku_unsol_event,
13120 .setup = alc267_quanta_il1_setup,
13121 .init_hook = alc_inithook,
13124 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13125 alc268_beep_mixer },
13126 .init_verbs = { alc268_base_init_verbs },
13127 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13128 .dac_nids = alc268_dac_nids,
13129 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13130 .adc_nids = alc268_adc_nids_alt,
13131 .capsrc_nids = alc268_capsrc_nids,
13133 .dig_out_nid = ALC268_DIGOUT_NID,
13134 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13135 .channel_mode = alc268_modes,
13136 .input_mux = &alc268_capture_source,
13138 [ALC268_TOSHIBA] = {
13139 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13140 alc268_beep_mixer },
13141 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13142 alc268_toshiba_verbs },
13143 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13144 .dac_nids = alc268_dac_nids,
13145 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13146 .adc_nids = alc268_adc_nids_alt,
13147 .capsrc_nids = alc268_capsrc_nids,
13149 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13150 .channel_mode = alc268_modes,
13151 .input_mux = &alc268_capture_source,
13152 .unsol_event = alc268_toshiba_unsol_event,
13153 .setup = alc268_toshiba_setup,
13154 .init_hook = alc268_toshiba_automute,
13157 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13158 alc268_beep_mixer },
13159 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13160 alc268_acer_verbs },
13161 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13162 .dac_nids = alc268_dac_nids,
13163 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13164 .adc_nids = alc268_adc_nids_alt,
13165 .capsrc_nids = alc268_capsrc_nids,
13167 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13168 .channel_mode = alc268_modes,
13169 .input_mux = &alc268_acer_capture_source,
13170 .unsol_event = alc268_acer_unsol_event,
13171 .init_hook = alc268_acer_init_hook,
13173 [ALC268_ACER_DMIC] = {
13174 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13175 alc268_beep_mixer },
13176 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13177 alc268_acer_verbs },
13178 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13179 .dac_nids = alc268_dac_nids,
13180 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13181 .adc_nids = alc268_adc_nids_alt,
13182 .capsrc_nids = alc268_capsrc_nids,
13184 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13185 .channel_mode = alc268_modes,
13186 .input_mux = &alc268_acer_dmic_capture_source,
13187 .unsol_event = alc268_acer_unsol_event,
13188 .init_hook = alc268_acer_init_hook,
13190 [ALC268_ACER_ASPIRE_ONE] = {
13191 .mixers = { alc268_acer_aspire_one_mixer,
13193 alc268_capture_nosrc_mixer },
13194 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13195 alc268_acer_aspire_one_verbs },
13196 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13197 .dac_nids = alc268_dac_nids,
13198 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13199 .adc_nids = alc268_adc_nids_alt,
13200 .capsrc_nids = alc268_capsrc_nids,
13202 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13203 .channel_mode = alc268_modes,
13204 .unsol_event = alc268_acer_lc_unsol_event,
13205 .setup = alc268_acer_lc_setup,
13206 .init_hook = alc268_acer_lc_init_hook,
13209 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13210 alc268_capture_nosrc_mixer },
13211 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13212 alc268_dell_verbs },
13213 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13214 .dac_nids = alc268_dac_nids,
13215 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13216 .adc_nids = alc268_adc_nids_alt,
13217 .capsrc_nids = alc268_capsrc_nids,
13219 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13220 .channel_mode = alc268_modes,
13221 .unsol_event = alc_sku_unsol_event,
13222 .setup = alc268_dell_setup,
13223 .init_hook = alc_inithook,
13226 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13227 alc268_beep_mixer },
13228 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13229 alc268_toshiba_verbs },
13230 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13231 .dac_nids = alc268_dac_nids,
13232 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13233 .adc_nids = alc268_adc_nids_alt,
13234 .capsrc_nids = alc268_capsrc_nids,
13236 .dig_out_nid = ALC268_DIGOUT_NID,
13237 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13238 .channel_mode = alc268_modes,
13239 .input_mux = &alc268_capture_source,
13240 .setup = alc268_toshiba_setup,
13241 .init_hook = alc268_toshiba_automute,
13243 #ifdef CONFIG_SND_DEBUG
13245 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13246 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13247 alc268_volume_init_verbs },
13248 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13249 .dac_nids = alc268_dac_nids,
13250 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13251 .adc_nids = alc268_adc_nids_alt,
13252 .capsrc_nids = alc268_capsrc_nids,
13254 .dig_out_nid = ALC268_DIGOUT_NID,
13255 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13256 .channel_mode = alc268_modes,
13257 .input_mux = &alc268_capture_source,
13262 static int patch_alc268(struct hda_codec *codec)
13264 struct alc_spec *spec;
13266 int i, has_beep, err;
13268 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13272 codec->spec = spec;
13274 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13278 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13279 board_config = snd_hda_check_board_codec_sid_config(codec,
13280 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13282 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13283 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13285 board_config = ALC268_AUTO;
13288 if (board_config == ALC268_AUTO) {
13289 /* automatic parse from the BIOS config */
13290 err = alc268_parse_auto_config(codec);
13296 "hda_codec: Cannot set up configuration "
13297 "from BIOS. Using base mode...\n");
13298 board_config = ALC268_3ST;
13302 if (board_config != ALC268_AUTO)
13303 setup_preset(codec, &alc268_presets[board_config]);
13305 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13306 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13307 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13309 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13312 for (i = 0; i < spec->num_mixers; i++) {
13313 if (spec->mixers[i] == alc268_beep_mixer) {
13320 err = snd_hda_attach_beep_device(codec, 0x1);
13325 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13326 /* override the amp caps for beep generator */
13327 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13328 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13329 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13330 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13331 (0 << AC_AMPCAP_MUTE_SHIFT));
13334 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13335 /* check whether NID 0x07 is valid */
13336 unsigned int wcap = get_wcaps(codec, 0x07);
13339 spec->capsrc_nids = alc268_capsrc_nids;
13341 wcap = get_wcaps_type(wcap);
13342 if (spec->auto_mic ||
13343 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13344 spec->adc_nids = alc268_adc_nids_alt;
13345 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13346 if (spec->auto_mic)
13347 fixup_automic_adc(codec);
13348 if (spec->auto_mic || spec->input_mux->num_items == 1)
13349 add_mixer(spec, alc268_capture_nosrc_mixer);
13351 add_mixer(spec, alc268_capture_alt_mixer);
13353 spec->adc_nids = alc268_adc_nids;
13354 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13355 add_mixer(spec, alc268_capture_mixer);
13357 /* set default input source */
13358 for (i = 0; i < spec->num_adc_nids; i++)
13359 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13360 0, AC_VERB_SET_CONNECT_SEL,
13361 i < spec->num_mux_defs ?
13362 spec->input_mux[i].items[0].index :
13363 spec->input_mux->items[0].index);
13366 spec->vmaster_nid = 0x02;
13368 codec->patch_ops = alc_patch_ops;
13369 if (board_config == ALC268_AUTO)
13370 spec->init_hook = alc268_auto_init;
13376 * ALC269 channel source setting (2 channel)
13378 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13380 #define alc269_dac_nids alc260_dac_nids
13382 static hda_nid_t alc269_adc_nids[1] = {
13387 static hda_nid_t alc269_capsrc_nids[1] = {
13391 static hda_nid_t alc269vb_adc_nids[1] = {
13396 static hda_nid_t alc269vb_capsrc_nids[1] = {
13400 static hda_nid_t alc269_adc_candidates[] = {
13404 #define alc269_modes alc260_modes
13405 #define alc269_capture_source alc880_lg_lw_capture_source
13407 static struct snd_kcontrol_new alc269_base_mixer[] = {
13408 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13409 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13410 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13411 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13413 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13415 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13416 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13417 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13419 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13423 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13424 /* output mixer control */
13425 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13427 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13428 .name = "Master Playback Switch",
13429 .subdevice = HDA_SUBDEV_AMP_FLAG,
13430 .info = snd_hda_mixer_amp_switch_info,
13431 .get = snd_hda_mixer_amp_switch_get,
13432 .put = alc268_acer_master_sw_put,
13433 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13436 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13437 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13438 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13439 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13440 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13444 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13445 /* output mixer control */
13446 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13448 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13449 .name = "Master Playback Switch",
13450 .subdevice = HDA_SUBDEV_AMP_FLAG,
13451 .info = snd_hda_mixer_amp_switch_info,
13452 .get = snd_hda_mixer_amp_switch_get,
13453 .put = alc268_acer_master_sw_put,
13454 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13457 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13458 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13459 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13460 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13461 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13462 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13463 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13464 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13468 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13469 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13470 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13471 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13472 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13476 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13477 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13478 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13479 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13480 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13484 /* capture mixer elements */
13485 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13486 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13487 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13488 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13489 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13493 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13494 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13495 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13496 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13500 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13501 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13502 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13503 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13504 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13508 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13509 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13510 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13511 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13516 #define alc269_fujitsu_mixer alc269_laptop_mixer
13518 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13519 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13520 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13521 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13522 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13523 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13524 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13528 static struct hda_verb alc269_lifebook_verbs[] = {
13529 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13530 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13531 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13532 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13533 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13534 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13535 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13536 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13537 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13538 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13542 /* toggle speaker-output according to the hp-jack state */
13543 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13545 unsigned int present;
13546 unsigned char bits;
13548 present = snd_hda_jack_detect(codec, 0x15);
13549 bits = present ? HDA_AMP_MUTE : 0;
13550 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13551 HDA_AMP_MUTE, bits);
13552 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13553 HDA_AMP_MUTE, bits);
13555 snd_hda_codec_write(codec, 0x20, 0,
13556 AC_VERB_SET_COEF_INDEX, 0x0c);
13557 snd_hda_codec_write(codec, 0x20, 0,
13558 AC_VERB_SET_PROC_COEF, 0x680);
13560 snd_hda_codec_write(codec, 0x20, 0,
13561 AC_VERB_SET_COEF_INDEX, 0x0c);
13562 snd_hda_codec_write(codec, 0x20, 0,
13563 AC_VERB_SET_PROC_COEF, 0x480);
13566 /* toggle speaker-output according to the hp-jacks state */
13567 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13569 unsigned int present;
13570 unsigned char bits;
13572 /* Check laptop headphone socket */
13573 present = snd_hda_jack_detect(codec, 0x15);
13575 /* Check port replicator headphone socket */
13576 present |= snd_hda_jack_detect(codec, 0x1a);
13578 bits = present ? HDA_AMP_MUTE : 0;
13579 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13580 HDA_AMP_MUTE, bits);
13581 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13582 HDA_AMP_MUTE, bits);
13584 snd_hda_codec_write(codec, 0x20, 0,
13585 AC_VERB_SET_COEF_INDEX, 0x0c);
13586 snd_hda_codec_write(codec, 0x20, 0,
13587 AC_VERB_SET_PROC_COEF, 0x680);
13589 snd_hda_codec_write(codec, 0x20, 0,
13590 AC_VERB_SET_COEF_INDEX, 0x0c);
13591 snd_hda_codec_write(codec, 0x20, 0,
13592 AC_VERB_SET_PROC_COEF, 0x480);
13595 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13597 unsigned int present_laptop;
13598 unsigned int present_dock;
13600 present_laptop = snd_hda_jack_detect(codec, 0x18);
13601 present_dock = snd_hda_jack_detect(codec, 0x1b);
13603 /* Laptop mic port overrides dock mic port, design decision */
13605 snd_hda_codec_write(codec, 0x23, 0,
13606 AC_VERB_SET_CONNECT_SEL, 0x3);
13607 if (present_laptop)
13608 snd_hda_codec_write(codec, 0x23, 0,
13609 AC_VERB_SET_CONNECT_SEL, 0x0);
13610 if (!present_dock && !present_laptop)
13611 snd_hda_codec_write(codec, 0x23, 0,
13612 AC_VERB_SET_CONNECT_SEL, 0x1);
13615 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13618 switch (res >> 26) {
13619 case ALC880_HP_EVENT:
13620 alc269_quanta_fl1_speaker_automute(codec);
13622 case ALC880_MIC_EVENT:
13623 alc_mic_automute(codec);
13628 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13631 if ((res >> 26) == ALC880_HP_EVENT)
13632 alc269_lifebook_speaker_automute(codec);
13633 if ((res >> 26) == ALC880_MIC_EVENT)
13634 alc269_lifebook_mic_autoswitch(codec);
13637 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13639 struct alc_spec *spec = codec->spec;
13640 spec->autocfg.hp_pins[0] = 0x15;
13641 spec->autocfg.speaker_pins[0] = 0x14;
13642 spec->ext_mic.pin = 0x18;
13643 spec->ext_mic.mux_idx = 0;
13644 spec->int_mic.pin = 0x19;
13645 spec->int_mic.mux_idx = 1;
13646 spec->auto_mic = 1;
13649 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13651 alc269_quanta_fl1_speaker_automute(codec);
13652 alc_mic_automute(codec);
13655 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13657 alc269_lifebook_speaker_automute(codec);
13658 alc269_lifebook_mic_autoswitch(codec);
13661 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13662 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13663 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13664 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13665 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13666 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13667 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13668 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13672 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13673 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13674 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13675 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13676 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13677 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13678 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13682 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13683 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13684 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13685 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13686 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13687 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13688 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13689 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13693 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13694 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13695 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13696 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13697 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13698 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13699 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13700 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13704 /* toggle speaker-output according to the hp-jack state */
13705 static void alc269_speaker_automute(struct hda_codec *codec)
13707 struct alc_spec *spec = codec->spec;
13708 unsigned int nid = spec->autocfg.hp_pins[0];
13709 unsigned int present;
13710 unsigned char bits;
13712 present = snd_hda_jack_detect(codec, nid);
13713 bits = present ? HDA_AMP_MUTE : 0;
13714 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13715 HDA_AMP_MUTE, bits);
13716 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13717 HDA_AMP_MUTE, bits);
13720 /* unsolicited event for HP jack sensing */
13721 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13724 switch (res >> 26) {
13725 case ALC880_HP_EVENT:
13726 alc269_speaker_automute(codec);
13728 case ALC880_MIC_EVENT:
13729 alc_mic_automute(codec);
13734 static void alc269_laptop_dmic_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 = 0x12;
13742 spec->int_mic.mux_idx = 5;
13743 spec->auto_mic = 1;
13746 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13748 struct alc_spec *spec = codec->spec;
13749 spec->autocfg.hp_pins[0] = 0x15;
13750 spec->autocfg.speaker_pins[0] = 0x14;
13751 spec->ext_mic.pin = 0x18;
13752 spec->ext_mic.mux_idx = 0;
13753 spec->int_mic.pin = 0x12;
13754 spec->int_mic.mux_idx = 6;
13755 spec->auto_mic = 1;
13758 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13760 struct alc_spec *spec = codec->spec;
13761 spec->autocfg.hp_pins[0] = 0x15;
13762 spec->autocfg.speaker_pins[0] = 0x14;
13763 spec->ext_mic.pin = 0x18;
13764 spec->ext_mic.mux_idx = 0;
13765 spec->int_mic.pin = 0x19;
13766 spec->int_mic.mux_idx = 1;
13767 spec->auto_mic = 1;
13770 static void alc269_laptop_inithook(struct hda_codec *codec)
13772 alc269_speaker_automute(codec);
13773 alc_mic_automute(codec);
13777 * generic initialization of ADC, input mixers and output mixers
13779 static struct hda_verb alc269_init_verbs[] = {
13781 * Unmute ADC0 and set the default input to mic-in
13783 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13786 * Set up output mixers (0x02 - 0x03)
13788 /* set vol=0 to output mixers */
13789 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13790 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13792 /* set up input amps for analog loopback */
13793 /* Amp Indices: DAC = 0, mixer = 1 */
13794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13795 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13796 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13797 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13798 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13799 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13801 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13803 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13804 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13805 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13806 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13812 /* FIXME: use Mux-type input source selection */
13813 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13814 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13815 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13818 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13822 static struct hda_verb alc269vb_init_verbs[] = {
13824 * Unmute ADC0 and set the default input to mic-in
13826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13829 * Set up output mixers (0x02 - 0x03)
13831 /* set vol=0 to output mixers */
13832 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13833 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13835 /* set up input amps for analog loopback */
13836 /* Amp Indices: DAC = 0, mixer = 1 */
13837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13839 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13840 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13841 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13842 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13844 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13845 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13846 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13847 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13848 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13849 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13850 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13852 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13853 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13855 /* FIXME: use Mux-type input source selection */
13856 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13857 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13858 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13861 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13865 #define alc269_auto_create_multi_out_ctls \
13866 alc268_auto_create_multi_out_ctls
13867 #define alc269_auto_create_input_ctls \
13868 alc268_auto_create_input_ctls
13870 #ifdef CONFIG_SND_HDA_POWER_SAVE
13871 #define alc269_loopbacks alc880_loopbacks
13874 /* pcm configuration: identical with ALC880 */
13875 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13876 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13877 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13878 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13880 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13884 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13885 /* NID is set in alc_build_pcms */
13887 .open = alc880_playback_pcm_open,
13888 .prepare = alc880_playback_pcm_prepare,
13889 .cleanup = alc880_playback_pcm_cleanup
13893 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13897 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13898 /* NID is set in alc_build_pcms */
13902 * BIOS auto configuration
13904 static int alc269_parse_auto_config(struct hda_codec *codec)
13906 struct alc_spec *spec = codec->spec;
13908 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13910 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13915 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13918 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13922 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13924 if (spec->autocfg.dig_outs)
13925 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13927 if (spec->kctls.list)
13928 add_mixer(spec, spec->kctls.list);
13930 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
13931 add_verb(spec, alc269vb_init_verbs);
13932 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
13934 add_verb(spec, alc269_init_verbs);
13935 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13938 spec->num_mux_defs = 1;
13939 spec->input_mux = &spec->private_imux[0];
13940 fillup_priv_adc_nids(codec, alc269_adc_candidates,
13941 sizeof(alc269_adc_candidates));
13943 /* set default input source */
13944 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
13945 0, AC_VERB_SET_CONNECT_SEL,
13946 spec->input_mux->items[0].index);
13948 err = alc_auto_add_mic_boost(codec);
13952 if (!spec->cap_mixer && !spec->no_analog)
13953 set_capture_mixer(codec);
13958 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13959 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13960 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13963 /* init callback for auto-configuration model -- overriding the default init */
13964 static void alc269_auto_init(struct hda_codec *codec)
13966 struct alc_spec *spec = codec->spec;
13967 alc269_auto_init_multi_out(codec);
13968 alc269_auto_init_hp_out(codec);
13969 alc269_auto_init_analog_input(codec);
13970 if (spec->unsol_event)
13971 alc_inithook(codec);
13975 * configuration and preset
13977 static const char *alc269_models[ALC269_MODEL_LAST] = {
13978 [ALC269_BASIC] = "basic",
13979 [ALC269_QUANTA_FL1] = "quanta",
13980 [ALC269_AMIC] = "laptop-amic",
13981 [ALC269_DMIC] = "laptop-dmic",
13982 [ALC269_FUJITSU] = "fujitsu",
13983 [ALC269_LIFEBOOK] = "lifebook",
13984 [ALC269_AUTO] = "auto",
13987 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13988 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13989 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13991 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
13992 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
13993 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
13994 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
13995 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
13996 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
13997 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
13998 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
13999 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14000 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14001 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14002 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14003 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14004 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14005 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14006 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14007 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14008 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14009 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14010 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14011 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14012 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14013 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14014 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14015 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14016 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14017 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14018 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14019 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14020 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14021 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14022 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14023 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14024 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14025 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14026 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14027 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14029 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14031 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14032 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14033 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
14034 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14035 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14036 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14037 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14038 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14039 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14040 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14044 static struct alc_config_preset alc269_presets[] = {
14046 .mixers = { alc269_base_mixer },
14047 .init_verbs = { alc269_init_verbs },
14048 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14049 .dac_nids = alc269_dac_nids,
14051 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14052 .channel_mode = alc269_modes,
14053 .input_mux = &alc269_capture_source,
14055 [ALC269_QUANTA_FL1] = {
14056 .mixers = { alc269_quanta_fl1_mixer },
14057 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14058 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14059 .dac_nids = alc269_dac_nids,
14061 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14062 .channel_mode = alc269_modes,
14063 .input_mux = &alc269_capture_source,
14064 .unsol_event = alc269_quanta_fl1_unsol_event,
14065 .setup = alc269_quanta_fl1_setup,
14066 .init_hook = alc269_quanta_fl1_init_hook,
14069 .mixers = { alc269_laptop_mixer },
14070 .cap_mixer = alc269_laptop_analog_capture_mixer,
14071 .init_verbs = { alc269_init_verbs,
14072 alc269_laptop_amic_init_verbs },
14073 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14074 .dac_nids = alc269_dac_nids,
14076 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14077 .channel_mode = alc269_modes,
14078 .unsol_event = alc269_laptop_unsol_event,
14079 .setup = alc269_laptop_amic_setup,
14080 .init_hook = alc269_laptop_inithook,
14083 .mixers = { alc269_laptop_mixer },
14084 .cap_mixer = alc269_laptop_digital_capture_mixer,
14085 .init_verbs = { alc269_init_verbs,
14086 alc269_laptop_dmic_init_verbs },
14087 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14088 .dac_nids = alc269_dac_nids,
14090 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14091 .channel_mode = alc269_modes,
14092 .unsol_event = alc269_laptop_unsol_event,
14093 .setup = alc269_laptop_dmic_setup,
14094 .init_hook = alc269_laptop_inithook,
14096 [ALC269VB_AMIC] = {
14097 .mixers = { alc269vb_laptop_mixer },
14098 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14099 .init_verbs = { alc269vb_init_verbs,
14100 alc269vb_laptop_amic_init_verbs },
14101 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14102 .dac_nids = alc269_dac_nids,
14104 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14105 .channel_mode = alc269_modes,
14106 .unsol_event = alc269_laptop_unsol_event,
14107 .setup = alc269_laptop_amic_setup,
14108 .init_hook = alc269_laptop_inithook,
14110 [ALC269VB_DMIC] = {
14111 .mixers = { alc269vb_laptop_mixer },
14112 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14113 .init_verbs = { alc269vb_init_verbs,
14114 alc269vb_laptop_dmic_init_verbs },
14115 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14116 .dac_nids = alc269_dac_nids,
14118 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14119 .channel_mode = alc269_modes,
14120 .unsol_event = alc269_laptop_unsol_event,
14121 .setup = alc269vb_laptop_dmic_setup,
14122 .init_hook = alc269_laptop_inithook,
14124 [ALC269_FUJITSU] = {
14125 .mixers = { alc269_fujitsu_mixer },
14126 .cap_mixer = alc269_laptop_digital_capture_mixer,
14127 .init_verbs = { alc269_init_verbs,
14128 alc269_laptop_dmic_init_verbs },
14129 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14130 .dac_nids = alc269_dac_nids,
14132 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14133 .channel_mode = alc269_modes,
14134 .unsol_event = alc269_laptop_unsol_event,
14135 .setup = alc269_laptop_dmic_setup,
14136 .init_hook = alc269_laptop_inithook,
14138 [ALC269_LIFEBOOK] = {
14139 .mixers = { alc269_lifebook_mixer },
14140 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14141 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14142 .dac_nids = alc269_dac_nids,
14144 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14145 .channel_mode = alc269_modes,
14146 .input_mux = &alc269_capture_source,
14147 .unsol_event = alc269_lifebook_unsol_event,
14148 .init_hook = alc269_lifebook_init_hook,
14152 static int patch_alc269(struct hda_codec *codec)
14154 struct alc_spec *spec;
14157 int is_alc269vb = 0;
14159 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14163 codec->spec = spec;
14165 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14167 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14168 kfree(codec->chip_name);
14169 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
14170 if (!codec->chip_name) {
14177 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14181 if (board_config < 0) {
14182 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14184 board_config = ALC269_AUTO;
14187 if (board_config == ALC269_AUTO) {
14188 /* automatic parse from the BIOS config */
14189 err = alc269_parse_auto_config(codec);
14195 "hda_codec: Cannot set up configuration "
14196 "from BIOS. Using base mode...\n");
14197 board_config = ALC269_BASIC;
14201 err = snd_hda_attach_beep_device(codec, 0x1);
14207 if (board_config != ALC269_AUTO)
14208 setup_preset(codec, &alc269_presets[board_config]);
14210 if (board_config == ALC269_QUANTA_FL1) {
14211 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14212 * fix the sample rate of analog I/O to 44.1kHz
14214 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14215 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14217 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14218 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14220 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14221 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14223 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14224 if (!is_alc269vb) {
14225 spec->adc_nids = alc269_adc_nids;
14226 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14227 spec->capsrc_nids = alc269_capsrc_nids;
14229 spec->adc_nids = alc269vb_adc_nids;
14230 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14231 spec->capsrc_nids = alc269vb_capsrc_nids;
14235 if (!spec->cap_mixer)
14236 set_capture_mixer(codec);
14237 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14239 spec->vmaster_nid = 0x02;
14241 codec->patch_ops = alc_patch_ops;
14242 if (board_config == ALC269_AUTO)
14243 spec->init_hook = alc269_auto_init;
14244 #ifdef CONFIG_SND_HDA_POWER_SAVE
14245 if (!spec->loopback.amplist)
14246 spec->loopback.amplist = alc269_loopbacks;
14253 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14257 * set the path ways for 2 channel output
14258 * need to set the codec line out and mic 1 pin widgets to inputs
14260 static struct hda_verb alc861_threestack_ch2_init[] = {
14261 /* set pin widget 1Ah (line in) for input */
14262 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14263 /* set pin widget 18h (mic1/2) for input, for mic also enable
14266 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14268 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14270 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14271 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14277 * need to set the codec line out and mic 1 pin widgets to outputs
14279 static struct hda_verb alc861_threestack_ch6_init[] = {
14280 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14281 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14282 /* set pin widget 18h (mic1) for output (CLFE)*/
14283 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14285 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14286 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14288 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14290 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14291 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14296 static struct hda_channel_mode alc861_threestack_modes[2] = {
14297 { 2, alc861_threestack_ch2_init },
14298 { 6, alc861_threestack_ch6_init },
14300 /* Set mic1 as input and unmute the mixer */
14301 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14302 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14303 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14306 /* Set mic1 as output and mute mixer */
14307 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14308 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14309 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14313 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14314 { 2, alc861_uniwill_m31_ch2_init },
14315 { 4, alc861_uniwill_m31_ch4_init },
14318 /* Set mic1 and line-in as input and unmute the mixer */
14319 static struct hda_verb alc861_asus_ch2_init[] = {
14320 /* set pin widget 1Ah (line in) for input */
14321 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14322 /* set pin widget 18h (mic1/2) for input, for mic also enable
14325 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14327 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14329 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14330 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14334 /* Set mic1 nad line-in as output and mute mixer */
14335 static struct hda_verb alc861_asus_ch6_init[] = {
14336 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14337 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14338 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14339 /* set pin widget 18h (mic1) for output (CLFE)*/
14340 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14341 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14342 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14343 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14345 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14347 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14348 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14353 static struct hda_channel_mode alc861_asus_modes[2] = {
14354 { 2, alc861_asus_ch2_init },
14355 { 6, alc861_asus_ch6_init },
14360 static struct snd_kcontrol_new alc861_base_mixer[] = {
14361 /* output mixer control */
14362 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14363 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14364 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14365 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14366 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14368 /*Input mixer control */
14369 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14370 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14371 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14372 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14373 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14374 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14376 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14377 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14378 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14383 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14384 /* output mixer control */
14385 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14386 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14387 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14388 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14389 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14391 /* Input mixer control */
14392 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14393 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14394 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14395 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14396 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14397 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14399 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14400 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14401 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14404 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14405 .name = "Channel Mode",
14406 .info = alc_ch_mode_info,
14407 .get = alc_ch_mode_get,
14408 .put = alc_ch_mode_put,
14409 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14414 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14415 /* output mixer control */
14416 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14418 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14423 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14424 /* output mixer control */
14425 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14426 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14427 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14428 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14429 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14431 /* Input mixer control */
14432 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14433 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14434 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14435 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14436 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14437 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14439 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14440 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14441 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14444 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14445 .name = "Channel Mode",
14446 .info = alc_ch_mode_info,
14447 .get = alc_ch_mode_get,
14448 .put = alc_ch_mode_put,
14449 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14454 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14455 /* output mixer control */
14456 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14457 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14458 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14459 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14460 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14462 /* Input mixer control */
14463 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14464 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14465 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14466 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14467 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14468 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14469 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14470 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14471 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14472 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14475 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14476 .name = "Channel Mode",
14477 .info = alc_ch_mode_info,
14478 .get = alc_ch_mode_get,
14479 .put = alc_ch_mode_put,
14480 .private_value = ARRAY_SIZE(alc861_asus_modes),
14485 /* additional mixer */
14486 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14487 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14488 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14493 * generic initialization of ADC, input mixers and output mixers
14495 static struct hda_verb alc861_base_init_verbs[] = {
14497 * Unmute ADC0 and set the default input to mic-in
14499 /* port-A for surround (rear panel) */
14500 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14501 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14502 /* port-B for mic-in (rear panel) with vref */
14503 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14504 /* port-C for line-in (rear panel) */
14505 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14506 /* port-D for Front */
14507 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14508 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14509 /* port-E for HP out (front panel) */
14510 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14511 /* route front PCM to HP */
14512 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14513 /* port-F for mic-in (front panel) with vref */
14514 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14515 /* port-G for CLFE (rear panel) */
14516 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14517 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14518 /* port-H for side (rear panel) */
14519 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14520 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14522 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14523 /* route front mic to ADC1*/
14524 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14525 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14527 /* Unmute DAC0~3 & spdif out*/
14528 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14529 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14530 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14531 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14534 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14535 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14536 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14537 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14538 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14540 /* Unmute Stereo Mixer 15 */
14541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14542 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14543 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14544 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14546 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14547 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14548 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14549 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14551 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14552 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14554 /* hp used DAC 3 (Front) */
14555 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14556 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14561 static struct hda_verb alc861_threestack_init_verbs[] = {
14563 * Unmute ADC0 and set the default input to mic-in
14565 /* port-A for surround (rear panel) */
14566 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14567 /* port-B for mic-in (rear panel) with vref */
14568 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14569 /* port-C for line-in (rear panel) */
14570 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14571 /* port-D for Front */
14572 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14573 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14574 /* port-E for HP out (front panel) */
14575 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14576 /* route front PCM to HP */
14577 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14578 /* port-F for mic-in (front panel) with vref */
14579 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14580 /* port-G for CLFE (rear panel) */
14581 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14582 /* port-H for side (rear panel) */
14583 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14585 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14586 /* route front mic to ADC1*/
14587 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14588 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14589 /* Unmute DAC0~3 & spdif out*/
14590 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14591 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14592 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14593 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14596 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14597 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14598 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14599 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14600 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14602 /* Unmute Stereo Mixer 15 */
14603 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14604 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14605 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14606 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14608 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14609 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14610 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14611 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14612 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14613 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14614 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14615 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14616 /* hp used DAC 3 (Front) */
14617 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14618 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14622 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14624 * Unmute ADC0 and set the default input to mic-in
14626 /* port-A for surround (rear panel) */
14627 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14628 /* port-B for mic-in (rear panel) with vref */
14629 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14630 /* port-C for line-in (rear panel) */
14631 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14632 /* port-D for Front */
14633 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14634 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14635 /* port-E for HP out (front panel) */
14636 /* this has to be set to VREF80 */
14637 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14638 /* route front PCM to HP */
14639 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14640 /* port-F for mic-in (front panel) with vref */
14641 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14642 /* port-G for CLFE (rear panel) */
14643 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14644 /* port-H for side (rear panel) */
14645 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14647 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14648 /* route front mic to ADC1*/
14649 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14650 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14651 /* Unmute DAC0~3 & spdif out*/
14652 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14653 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14654 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14655 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14656 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14658 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14659 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14660 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14661 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14662 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14664 /* Unmute Stereo Mixer 15 */
14665 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14667 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14668 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14670 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14672 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14673 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14674 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14675 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14676 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14677 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14678 /* hp used DAC 3 (Front) */
14679 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14680 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14684 static struct hda_verb alc861_asus_init_verbs[] = {
14686 * Unmute ADC0 and set the default input to mic-in
14688 /* port-A for surround (rear panel)
14689 * according to codec#0 this is the HP jack
14691 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14692 /* route front PCM to HP */
14693 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14694 /* port-B for mic-in (rear panel) with vref */
14695 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14696 /* port-C for line-in (rear panel) */
14697 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14698 /* port-D for Front */
14699 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14700 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14701 /* port-E for HP out (front panel) */
14702 /* this has to be set to VREF80 */
14703 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14704 /* route front PCM to HP */
14705 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14706 /* port-F for mic-in (front panel) with vref */
14707 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14708 /* port-G for CLFE (rear panel) */
14709 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14710 /* port-H for side (rear panel) */
14711 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14713 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14714 /* route front mic to ADC1*/
14715 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14716 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14717 /* Unmute DAC0~3 & spdif out*/
14718 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14719 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14720 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14721 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14723 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14724 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14725 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14726 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14727 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14729 /* Unmute Stereo Mixer 15 */
14730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14735 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14736 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14737 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14738 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14739 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14741 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14743 /* hp used DAC 3 (Front) */
14744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14745 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14749 /* additional init verbs for ASUS laptops */
14750 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14751 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14752 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14757 * generic initialization of ADC, input mixers and output mixers
14759 static struct hda_verb alc861_auto_init_verbs[] = {
14761 * Unmute ADC0 and set the default input to mic-in
14763 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14764 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14766 /* Unmute DAC0~3 & spdif out*/
14767 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14768 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14769 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14770 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14771 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14773 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14774 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14775 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14776 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14777 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14779 /* Unmute Stereo Mixer 15 */
14780 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14781 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14782 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14783 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14785 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14786 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14787 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14788 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14790 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14791 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14792 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14794 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14796 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14797 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14798 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14799 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14800 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14801 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14803 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14808 static struct hda_verb alc861_toshiba_init_verbs[] = {
14809 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14814 /* toggle speaker-output according to the hp-jack state */
14815 static void alc861_toshiba_automute(struct hda_codec *codec)
14817 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14819 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14820 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14821 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14822 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14825 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14828 if ((res >> 26) == ALC880_HP_EVENT)
14829 alc861_toshiba_automute(codec);
14832 /* pcm configuration: identical with ALC880 */
14833 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14834 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14835 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14836 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14839 #define ALC861_DIGOUT_NID 0x07
14841 static struct hda_channel_mode alc861_8ch_modes[1] = {
14845 static hda_nid_t alc861_dac_nids[4] = {
14846 /* front, surround, clfe, side */
14847 0x03, 0x06, 0x05, 0x04
14850 static hda_nid_t alc660_dac_nids[3] = {
14851 /* front, clfe, surround */
14855 static hda_nid_t alc861_adc_nids[1] = {
14860 static struct hda_input_mux alc861_capture_source = {
14864 { "Front Mic", 0x3 },
14871 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14873 struct alc_spec *spec = codec->spec;
14874 hda_nid_t mix, srcs[5];
14877 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14879 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14882 for (i = 0; i < num; i++) {
14884 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14885 if (type != AC_WID_AUD_OUT)
14887 for (j = 0; j < spec->multiout.num_dacs; j++)
14888 if (spec->multiout.dac_nids[j] == srcs[i])
14890 if (j >= spec->multiout.num_dacs)
14896 /* fill in the dac_nids table from the parsed pin configuration */
14897 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14898 const struct auto_pin_cfg *cfg)
14900 struct alc_spec *spec = codec->spec;
14902 hda_nid_t nid, dac;
14904 spec->multiout.dac_nids = spec->private_dac_nids;
14905 for (i = 0; i < cfg->line_outs; i++) {
14906 nid = cfg->line_out_pins[i];
14907 dac = alc861_look_for_dac(codec, nid);
14910 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14915 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14916 hda_nid_t nid, unsigned int chs)
14918 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14919 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14922 /* add playback controls from the parsed DAC table */
14923 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14924 const struct auto_pin_cfg *cfg)
14926 struct alc_spec *spec = codec->spec;
14927 static const char *chname[4] = {
14928 "Front", "Surround", NULL /*CLFE*/, "Side"
14933 if (cfg->line_outs == 1) {
14934 const char *pfx = NULL;
14937 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14940 nid = spec->multiout.dac_nids[0];
14941 return alc861_create_out_sw(codec, pfx, nid, 3);
14945 for (i = 0; i < cfg->line_outs; i++) {
14946 nid = spec->multiout.dac_nids[i];
14951 err = alc861_create_out_sw(codec, "Center", nid, 1);
14954 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14958 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14966 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14968 struct alc_spec *spec = codec->spec;
14975 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14976 nid = alc861_look_for_dac(codec, pin);
14978 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14981 spec->multiout.hp_nid = nid;
14987 /* create playback/capture controls for input pins */
14988 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14989 const struct auto_pin_cfg *cfg)
14991 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14994 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14996 int pin_type, hda_nid_t dac)
14998 hda_nid_t mix, srcs[5];
15001 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15003 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15005 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15007 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15010 for (i = 0; i < num; i++) {
15012 if (srcs[i] == dac || srcs[i] == 0x15)
15013 mute = AMP_IN_UNMUTE(i);
15015 mute = AMP_IN_MUTE(i);
15016 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15021 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15023 struct alc_spec *spec = codec->spec;
15026 for (i = 0; i < spec->autocfg.line_outs; i++) {
15027 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15028 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15030 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15031 spec->multiout.dac_nids[i]);
15035 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15037 struct alc_spec *spec = codec->spec;
15039 if (spec->autocfg.hp_outs)
15040 alc861_auto_set_output_and_unmute(codec,
15041 spec->autocfg.hp_pins[0],
15043 spec->multiout.hp_nid);
15044 if (spec->autocfg.speaker_outs)
15045 alc861_auto_set_output_and_unmute(codec,
15046 spec->autocfg.speaker_pins[0],
15048 spec->multiout.dac_nids[0]);
15051 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15053 struct alc_spec *spec = codec->spec;
15056 for (i = 0; i < AUTO_PIN_LAST; i++) {
15057 hda_nid_t nid = spec->autocfg.input_pins[i];
15058 if (nid >= 0x0c && nid <= 0x11)
15059 alc_set_input_pin(codec, nid, i);
15063 /* parse the BIOS configuration and set up the alc_spec */
15064 /* return 1 if successful, 0 if the proper config is not found,
15065 * or a negative error code
15067 static int alc861_parse_auto_config(struct hda_codec *codec)
15069 struct alc_spec *spec = codec->spec;
15071 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15073 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15077 if (!spec->autocfg.line_outs)
15078 return 0; /* can't find valid BIOS pin config */
15080 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15083 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15086 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15089 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15093 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15095 if (spec->autocfg.dig_outs)
15096 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15098 if (spec->kctls.list)
15099 add_mixer(spec, spec->kctls.list);
15101 add_verb(spec, alc861_auto_init_verbs);
15103 spec->num_mux_defs = 1;
15104 spec->input_mux = &spec->private_imux[0];
15106 spec->adc_nids = alc861_adc_nids;
15107 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15108 set_capture_mixer(codec);
15110 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15115 /* additional initialization for auto-configuration model */
15116 static void alc861_auto_init(struct hda_codec *codec)
15118 struct alc_spec *spec = codec->spec;
15119 alc861_auto_init_multi_out(codec);
15120 alc861_auto_init_hp_out(codec);
15121 alc861_auto_init_analog_input(codec);
15122 if (spec->unsol_event)
15123 alc_inithook(codec);
15126 #ifdef CONFIG_SND_HDA_POWER_SAVE
15127 static struct hda_amp_list alc861_loopbacks[] = {
15128 { 0x15, HDA_INPUT, 0 },
15129 { 0x15, HDA_INPUT, 1 },
15130 { 0x15, HDA_INPUT, 2 },
15131 { 0x15, HDA_INPUT, 3 },
15138 * configuration and preset
15140 static const char *alc861_models[ALC861_MODEL_LAST] = {
15141 [ALC861_3ST] = "3stack",
15142 [ALC660_3ST] = "3stack-660",
15143 [ALC861_3ST_DIG] = "3stack-dig",
15144 [ALC861_6ST_DIG] = "6stack-dig",
15145 [ALC861_UNIWILL_M31] = "uniwill-m31",
15146 [ALC861_TOSHIBA] = "toshiba",
15147 [ALC861_ASUS] = "asus",
15148 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15149 [ALC861_AUTO] = "auto",
15152 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15153 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15154 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15155 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15156 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15157 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15158 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15159 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15160 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15161 * Any other models that need this preset?
15163 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15164 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15165 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15166 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15167 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15168 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15169 /* FIXME: the below seems conflict */
15170 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15171 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15172 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15176 static struct alc_config_preset alc861_presets[] = {
15178 .mixers = { alc861_3ST_mixer },
15179 .init_verbs = { alc861_threestack_init_verbs },
15180 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15181 .dac_nids = alc861_dac_nids,
15182 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15183 .channel_mode = alc861_threestack_modes,
15185 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15186 .adc_nids = alc861_adc_nids,
15187 .input_mux = &alc861_capture_source,
15189 [ALC861_3ST_DIG] = {
15190 .mixers = { alc861_base_mixer },
15191 .init_verbs = { alc861_threestack_init_verbs },
15192 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15193 .dac_nids = alc861_dac_nids,
15194 .dig_out_nid = ALC861_DIGOUT_NID,
15195 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15196 .channel_mode = alc861_threestack_modes,
15198 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15199 .adc_nids = alc861_adc_nids,
15200 .input_mux = &alc861_capture_source,
15202 [ALC861_6ST_DIG] = {
15203 .mixers = { alc861_base_mixer },
15204 .init_verbs = { alc861_base_init_verbs },
15205 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15206 .dac_nids = alc861_dac_nids,
15207 .dig_out_nid = ALC861_DIGOUT_NID,
15208 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15209 .channel_mode = alc861_8ch_modes,
15210 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15211 .adc_nids = alc861_adc_nids,
15212 .input_mux = &alc861_capture_source,
15215 .mixers = { alc861_3ST_mixer },
15216 .init_verbs = { alc861_threestack_init_verbs },
15217 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15218 .dac_nids = alc660_dac_nids,
15219 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15220 .channel_mode = alc861_threestack_modes,
15222 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15223 .adc_nids = alc861_adc_nids,
15224 .input_mux = &alc861_capture_source,
15226 [ALC861_UNIWILL_M31] = {
15227 .mixers = { alc861_uniwill_m31_mixer },
15228 .init_verbs = { alc861_uniwill_m31_init_verbs },
15229 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15230 .dac_nids = alc861_dac_nids,
15231 .dig_out_nid = ALC861_DIGOUT_NID,
15232 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15233 .channel_mode = alc861_uniwill_m31_modes,
15235 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15236 .adc_nids = alc861_adc_nids,
15237 .input_mux = &alc861_capture_source,
15239 [ALC861_TOSHIBA] = {
15240 .mixers = { alc861_toshiba_mixer },
15241 .init_verbs = { alc861_base_init_verbs,
15242 alc861_toshiba_init_verbs },
15243 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15244 .dac_nids = alc861_dac_nids,
15245 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15246 .channel_mode = alc883_3ST_2ch_modes,
15247 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15248 .adc_nids = alc861_adc_nids,
15249 .input_mux = &alc861_capture_source,
15250 .unsol_event = alc861_toshiba_unsol_event,
15251 .init_hook = alc861_toshiba_automute,
15254 .mixers = { alc861_asus_mixer },
15255 .init_verbs = { alc861_asus_init_verbs },
15256 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15257 .dac_nids = alc861_dac_nids,
15258 .dig_out_nid = ALC861_DIGOUT_NID,
15259 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15260 .channel_mode = alc861_asus_modes,
15263 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15264 .adc_nids = alc861_adc_nids,
15265 .input_mux = &alc861_capture_source,
15267 [ALC861_ASUS_LAPTOP] = {
15268 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15269 .init_verbs = { alc861_asus_init_verbs,
15270 alc861_asus_laptop_init_verbs },
15271 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15272 .dac_nids = alc861_dac_nids,
15273 .dig_out_nid = ALC861_DIGOUT_NID,
15274 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15275 .channel_mode = alc883_3ST_2ch_modes,
15277 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15278 .adc_nids = alc861_adc_nids,
15279 .input_mux = &alc861_capture_source,
15283 /* Pin config fixes */
15285 PINFIX_FSC_AMILO_PI1505,
15288 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15289 { 0x0b, 0x0221101f }, /* HP */
15290 { 0x0f, 0x90170310 }, /* speaker */
15294 static const struct alc_fixup alc861_fixups[] = {
15295 [PINFIX_FSC_AMILO_PI1505] = {
15296 .pins = alc861_fsc_amilo_pi1505_pinfix
15300 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15301 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15305 static int patch_alc861(struct hda_codec *codec)
15307 struct alc_spec *spec;
15311 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15315 codec->spec = spec;
15317 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15321 if (board_config < 0) {
15322 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15324 board_config = ALC861_AUTO;
15327 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15329 if (board_config == ALC861_AUTO) {
15330 /* automatic parse from the BIOS config */
15331 err = alc861_parse_auto_config(codec);
15337 "hda_codec: Cannot set up configuration "
15338 "from BIOS. Using base mode...\n");
15339 board_config = ALC861_3ST_DIG;
15343 err = snd_hda_attach_beep_device(codec, 0x23);
15349 if (board_config != ALC861_AUTO)
15350 setup_preset(codec, &alc861_presets[board_config]);
15352 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15353 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15355 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15356 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15358 if (!spec->cap_mixer)
15359 set_capture_mixer(codec);
15360 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15362 spec->vmaster_nid = 0x03;
15364 codec->patch_ops = alc_patch_ops;
15365 if (board_config == ALC861_AUTO) {
15366 spec->init_hook = alc861_auto_init;
15367 #ifdef CONFIG_SND_HDA_POWER_SAVE
15368 spec->power_hook = alc_power_eapd;
15371 #ifdef CONFIG_SND_HDA_POWER_SAVE
15372 if (!spec->loopback.amplist)
15373 spec->loopback.amplist = alc861_loopbacks;
15380 * ALC861-VD support
15384 * In addition, an independent DAC
15386 #define ALC861VD_DIGOUT_NID 0x06
15388 static hda_nid_t alc861vd_dac_nids[4] = {
15389 /* front, surr, clfe, side surr */
15390 0x02, 0x03, 0x04, 0x05
15393 /* dac_nids for ALC660vd are in a different order - according to
15394 * Realtek's driver.
15395 * This should probably result in a different mixer for 6stack models
15396 * of ALC660vd codecs, but for now there is only 3stack mixer
15397 * - and it is the same as in 861vd.
15398 * adc_nids in ALC660vd are (is) the same as in 861vd
15400 static hda_nid_t alc660vd_dac_nids[3] = {
15401 /* front, rear, clfe, rear_surr */
15405 static hda_nid_t alc861vd_adc_nids[1] = {
15410 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15413 /* FIXME: should be a matrix-type input source selection */
15414 static struct hda_input_mux alc861vd_capture_source = {
15418 { "Front Mic", 0x1 },
15424 static struct hda_input_mux alc861vd_dallas_capture_source = {
15427 { "Ext Mic", 0x0 },
15428 { "Int Mic", 0x1 },
15432 static struct hda_input_mux alc861vd_hp_capture_source = {
15435 { "Front Mic", 0x0 },
15436 { "ATAPI Mic", 0x1 },
15443 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15450 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15451 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15452 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15453 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15454 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15461 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15462 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15463 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15464 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15465 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15469 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15470 { 6, alc861vd_6stack_ch6_init },
15471 { 8, alc861vd_6stack_ch8_init },
15474 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15476 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15477 .name = "Channel Mode",
15478 .info = alc_ch_mode_info,
15479 .get = alc_ch_mode_get,
15480 .put = alc_ch_mode_put,
15485 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15486 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15488 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15489 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15490 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15492 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15493 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15495 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15497 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15499 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15500 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15502 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15503 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15507 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15508 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15509 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15511 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15512 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15513 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15515 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15516 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15518 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15519 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15524 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15525 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15526 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15528 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15530 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15534 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15535 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15536 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15538 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15539 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15541 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15542 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15547 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15548 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15549 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15550 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15552 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15554 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15555 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15556 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15558 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15559 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15560 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15562 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15563 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15568 /* Pin assignment: Speaker=0x14, HP = 0x15,
15569 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15571 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15572 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15573 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15574 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15575 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15576 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15577 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15578 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15579 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15580 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15581 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15585 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15586 * Front Mic=0x18, ATAPI Mic = 0x19,
15588 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15589 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15590 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15591 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15592 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15593 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15594 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15595 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15596 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15602 * generic initialization of ADC, input mixers and output mixers
15604 static struct hda_verb alc861vd_volume_init_verbs[] = {
15606 * Unmute ADC0 and set the default input to mic-in
15608 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15609 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15611 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15612 * the analog-loopback mixer widget
15614 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15616 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15617 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15618 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15619 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15621 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15628 * Set up output mixers (0x02 - 0x05)
15630 /* set vol=0 to output mixers */
15631 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15632 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15633 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15634 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15636 /* set up input amps for analog loopback */
15637 /* Amp Indices: DAC = 0, mixer = 1 */
15638 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15640 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15641 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15642 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15643 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15644 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15645 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15651 * 3-stack pin configuration:
15652 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15654 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15656 * Set pin mode and muting
15658 /* set front pin widgets 0x14 for output */
15659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15660 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15661 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15663 /* Mic (rear) pin: input vref at 80% */
15664 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15665 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15666 /* Front Mic pin: input vref at 80% */
15667 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15668 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15669 /* Line In pin: input */
15670 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15671 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15672 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15674 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15675 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15676 /* CD pin widget for input */
15677 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15683 * 6-stack pin configuration:
15685 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15687 * Set pin mode and muting
15689 /* set front pin widgets 0x14 for output */
15690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15692 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15694 /* Rear Pin: output 1 (0x0d) */
15695 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15696 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15697 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15698 /* CLFE Pin: output 2 (0x0e) */
15699 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15700 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15701 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15702 /* Side Pin: output 3 (0x0f) */
15703 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15704 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15705 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15707 /* Mic (rear) pin: input vref at 80% */
15708 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15709 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15710 /* Front Mic pin: input vref at 80% */
15711 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15712 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15713 /* Line In pin: input */
15714 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15715 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15716 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15717 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15718 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15719 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15720 /* CD pin widget for input */
15721 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15726 static struct hda_verb alc861vd_eapd_verbs[] = {
15727 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15731 static struct hda_verb alc660vd_eapd_verbs[] = {
15732 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15733 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15737 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15741 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15742 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15746 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15748 unsigned int present;
15749 unsigned char bits;
15751 present = snd_hda_jack_detect(codec, 0x18);
15752 bits = present ? HDA_AMP_MUTE : 0;
15754 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15755 HDA_AMP_MUTE, bits);
15758 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15760 struct alc_spec *spec = codec->spec;
15761 spec->autocfg.hp_pins[0] = 0x1b;
15762 spec->autocfg.speaker_pins[0] = 0x14;
15765 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15767 alc_automute_amp(codec);
15768 alc861vd_lenovo_mic_automute(codec);
15771 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15774 switch (res >> 26) {
15775 case ALC880_MIC_EVENT:
15776 alc861vd_lenovo_mic_automute(codec);
15779 alc_automute_amp_unsol_event(codec, res);
15784 static struct hda_verb alc861vd_dallas_verbs[] = {
15785 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15786 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15787 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15788 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15790 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15791 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15792 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15793 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15794 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15795 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15796 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15797 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15799 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15800 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15803 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15804 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15805 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15806 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15808 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15809 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15810 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15811 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15812 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15813 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15814 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15815 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15820 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15822 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15823 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15824 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15829 /* toggle speaker-output according to the hp-jack state */
15830 static void alc861vd_dallas_setup(struct hda_codec *codec)
15832 struct alc_spec *spec = codec->spec;
15834 spec->autocfg.hp_pins[0] = 0x15;
15835 spec->autocfg.speaker_pins[0] = 0x14;
15838 #ifdef CONFIG_SND_HDA_POWER_SAVE
15839 #define alc861vd_loopbacks alc880_loopbacks
15842 /* pcm configuration: identical with ALC880 */
15843 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15844 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15845 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15846 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15849 * configuration and preset
15851 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15852 [ALC660VD_3ST] = "3stack-660",
15853 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15854 [ALC660VD_ASUS_V1S] = "asus-v1s",
15855 [ALC861VD_3ST] = "3stack",
15856 [ALC861VD_3ST_DIG] = "3stack-digout",
15857 [ALC861VD_6ST_DIG] = "6stack-digout",
15858 [ALC861VD_LENOVO] = "lenovo",
15859 [ALC861VD_DALLAS] = "dallas",
15860 [ALC861VD_HP] = "hp",
15861 [ALC861VD_AUTO] = "auto",
15864 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15865 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15866 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15867 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15868 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15869 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15870 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15871 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15872 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15873 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15874 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15875 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15876 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15877 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15878 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15879 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15883 static struct alc_config_preset alc861vd_presets[] = {
15885 .mixers = { alc861vd_3st_mixer },
15886 .init_verbs = { alc861vd_volume_init_verbs,
15887 alc861vd_3stack_init_verbs },
15888 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15889 .dac_nids = alc660vd_dac_nids,
15890 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15891 .channel_mode = alc861vd_3stack_2ch_modes,
15892 .input_mux = &alc861vd_capture_source,
15894 [ALC660VD_3ST_DIG] = {
15895 .mixers = { alc861vd_3st_mixer },
15896 .init_verbs = { alc861vd_volume_init_verbs,
15897 alc861vd_3stack_init_verbs },
15898 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15899 .dac_nids = alc660vd_dac_nids,
15900 .dig_out_nid = ALC861VD_DIGOUT_NID,
15901 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15902 .channel_mode = alc861vd_3stack_2ch_modes,
15903 .input_mux = &alc861vd_capture_source,
15906 .mixers = { alc861vd_3st_mixer },
15907 .init_verbs = { alc861vd_volume_init_verbs,
15908 alc861vd_3stack_init_verbs },
15909 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15910 .dac_nids = alc861vd_dac_nids,
15911 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15912 .channel_mode = alc861vd_3stack_2ch_modes,
15913 .input_mux = &alc861vd_capture_source,
15915 [ALC861VD_3ST_DIG] = {
15916 .mixers = { alc861vd_3st_mixer },
15917 .init_verbs = { alc861vd_volume_init_verbs,
15918 alc861vd_3stack_init_verbs },
15919 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15920 .dac_nids = alc861vd_dac_nids,
15921 .dig_out_nid = ALC861VD_DIGOUT_NID,
15922 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15923 .channel_mode = alc861vd_3stack_2ch_modes,
15924 .input_mux = &alc861vd_capture_source,
15926 [ALC861VD_6ST_DIG] = {
15927 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15928 .init_verbs = { alc861vd_volume_init_verbs,
15929 alc861vd_6stack_init_verbs },
15930 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15931 .dac_nids = alc861vd_dac_nids,
15932 .dig_out_nid = ALC861VD_DIGOUT_NID,
15933 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15934 .channel_mode = alc861vd_6stack_modes,
15935 .input_mux = &alc861vd_capture_source,
15937 [ALC861VD_LENOVO] = {
15938 .mixers = { alc861vd_lenovo_mixer },
15939 .init_verbs = { alc861vd_volume_init_verbs,
15940 alc861vd_3stack_init_verbs,
15941 alc861vd_eapd_verbs,
15942 alc861vd_lenovo_unsol_verbs },
15943 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15944 .dac_nids = alc660vd_dac_nids,
15945 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15946 .channel_mode = alc861vd_3stack_2ch_modes,
15947 .input_mux = &alc861vd_capture_source,
15948 .unsol_event = alc861vd_lenovo_unsol_event,
15949 .setup = alc861vd_lenovo_setup,
15950 .init_hook = alc861vd_lenovo_init_hook,
15952 [ALC861VD_DALLAS] = {
15953 .mixers = { alc861vd_dallas_mixer },
15954 .init_verbs = { alc861vd_dallas_verbs },
15955 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15956 .dac_nids = alc861vd_dac_nids,
15957 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15958 .channel_mode = alc861vd_3stack_2ch_modes,
15959 .input_mux = &alc861vd_dallas_capture_source,
15960 .unsol_event = alc_automute_amp_unsol_event,
15961 .setup = alc861vd_dallas_setup,
15962 .init_hook = alc_automute_amp,
15965 .mixers = { alc861vd_hp_mixer },
15966 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15967 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15968 .dac_nids = alc861vd_dac_nids,
15969 .dig_out_nid = ALC861VD_DIGOUT_NID,
15970 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15971 .channel_mode = alc861vd_3stack_2ch_modes,
15972 .input_mux = &alc861vd_hp_capture_source,
15973 .unsol_event = alc_automute_amp_unsol_event,
15974 .setup = alc861vd_dallas_setup,
15975 .init_hook = alc_automute_amp,
15977 [ALC660VD_ASUS_V1S] = {
15978 .mixers = { alc861vd_lenovo_mixer },
15979 .init_verbs = { alc861vd_volume_init_verbs,
15980 alc861vd_3stack_init_verbs,
15981 alc861vd_eapd_verbs,
15982 alc861vd_lenovo_unsol_verbs },
15983 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15984 .dac_nids = alc660vd_dac_nids,
15985 .dig_out_nid = ALC861VD_DIGOUT_NID,
15986 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15987 .channel_mode = alc861vd_3stack_2ch_modes,
15988 .input_mux = &alc861vd_capture_source,
15989 .unsol_event = alc861vd_lenovo_unsol_event,
15990 .setup = alc861vd_lenovo_setup,
15991 .init_hook = alc861vd_lenovo_init_hook,
15996 * BIOS auto configuration
15998 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15999 const struct auto_pin_cfg *cfg)
16001 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16005 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16006 hda_nid_t nid, int pin_type, int dac_idx)
16008 alc_set_pin_output(codec, nid, pin_type);
16011 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16013 struct alc_spec *spec = codec->spec;
16016 for (i = 0; i <= HDA_SIDE; i++) {
16017 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16018 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16020 alc861vd_auto_set_output_and_unmute(codec, nid,
16026 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16028 struct alc_spec *spec = codec->spec;
16031 pin = spec->autocfg.hp_pins[0];
16032 if (pin) /* connect to front and use dac 0 */
16033 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16034 pin = spec->autocfg.speaker_pins[0];
16036 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16039 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16041 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16043 struct alc_spec *spec = codec->spec;
16046 for (i = 0; i < AUTO_PIN_LAST; i++) {
16047 hda_nid_t nid = spec->autocfg.input_pins[i];
16048 if (alc_is_input_pin(codec, nid)) {
16049 alc_set_input_pin(codec, nid, i);
16050 if (nid != ALC861VD_PIN_CD_NID &&
16051 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16052 snd_hda_codec_write(codec, nid, 0,
16053 AC_VERB_SET_AMP_GAIN_MUTE,
16059 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16061 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16062 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16064 /* add playback controls from the parsed DAC table */
16065 /* Based on ALC880 version. But ALC861VD has separate,
16066 * different NIDs for mute/unmute switch and volume control */
16067 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16068 const struct auto_pin_cfg *cfg)
16070 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16071 hda_nid_t nid_v, nid_s;
16074 for (i = 0; i < cfg->line_outs; i++) {
16075 if (!spec->multiout.dac_nids[i])
16077 nid_v = alc861vd_idx_to_mixer_vol(
16079 spec->multiout.dac_nids[i]));
16080 nid_s = alc861vd_idx_to_mixer_switch(
16082 spec->multiout.dac_nids[i]));
16086 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16088 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16092 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16094 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16098 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16100 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16104 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16106 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16112 if (cfg->line_outs == 1 &&
16113 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16120 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16121 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16125 if (cfg->line_outs == 1 &&
16126 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16128 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16129 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16138 /* add playback controls for speaker and HP outputs */
16139 /* Based on ALC880 version. But ALC861VD has separate,
16140 * different NIDs for mute/unmute switch and volume control */
16141 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16142 hda_nid_t pin, const char *pfx)
16144 hda_nid_t nid_v, nid_s;
16150 if (alc880_is_fixed_pin(pin)) {
16151 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16152 /* specify the DAC as the extra output */
16153 if (!spec->multiout.hp_nid)
16154 spec->multiout.hp_nid = nid_v;
16156 spec->multiout.extra_out_nid[0] = nid_v;
16157 /* control HP volume/switch on the output mixer amp */
16158 nid_v = alc861vd_idx_to_mixer_vol(
16159 alc880_fixed_pin_idx(pin));
16160 nid_s = alc861vd_idx_to_mixer_switch(
16161 alc880_fixed_pin_idx(pin));
16163 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16164 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16167 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16168 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16171 } else if (alc880_is_multi_pin(pin)) {
16172 /* set manual connection */
16173 /* we have only a switch on HP-out PIN */
16174 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16175 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16182 /* parse the BIOS configuration and set up the alc_spec
16183 * return 1 if successful, 0 if the proper config is not found,
16184 * or a negative error code
16185 * Based on ALC880 version - had to change it to override
16186 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16187 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16189 struct alc_spec *spec = codec->spec;
16191 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16193 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16197 if (!spec->autocfg.line_outs)
16198 return 0; /* can't find valid BIOS pin config */
16200 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16203 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16206 err = alc861vd_auto_create_extra_out(spec,
16207 spec->autocfg.speaker_pins[0],
16211 err = alc861vd_auto_create_extra_out(spec,
16212 spec->autocfg.hp_pins[0],
16216 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16220 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16222 if (spec->autocfg.dig_outs)
16223 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16225 if (spec->kctls.list)
16226 add_mixer(spec, spec->kctls.list);
16228 add_verb(spec, alc861vd_volume_init_verbs);
16230 spec->num_mux_defs = 1;
16231 spec->input_mux = &spec->private_imux[0];
16233 err = alc_auto_add_mic_boost(codec);
16237 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16242 /* additional initialization for auto-configuration model */
16243 static void alc861vd_auto_init(struct hda_codec *codec)
16245 struct alc_spec *spec = codec->spec;
16246 alc861vd_auto_init_multi_out(codec);
16247 alc861vd_auto_init_hp_out(codec);
16248 alc861vd_auto_init_analog_input(codec);
16249 alc861vd_auto_init_input_src(codec);
16250 if (spec->unsol_event)
16251 alc_inithook(codec);
16255 ALC660VD_FIX_ASUS_GPIO1
16259 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16260 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16261 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16262 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16266 static const struct alc_fixup alc861vd_fixups[] = {
16267 [ALC660VD_FIX_ASUS_GPIO1] = {
16268 .verbs = alc660vd_fix_asus_gpio1_verbs,
16272 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16273 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16277 static int patch_alc861vd(struct hda_codec *codec)
16279 struct alc_spec *spec;
16280 int err, board_config;
16282 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16286 codec->spec = spec;
16288 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16292 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16293 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16295 board_config = ALC861VD_AUTO;
16298 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16300 if (board_config == ALC861VD_AUTO) {
16301 /* automatic parse from the BIOS config */
16302 err = alc861vd_parse_auto_config(codec);
16308 "hda_codec: Cannot set up configuration "
16309 "from BIOS. Using base mode...\n");
16310 board_config = ALC861VD_3ST;
16314 err = snd_hda_attach_beep_device(codec, 0x23);
16320 if (board_config != ALC861VD_AUTO)
16321 setup_preset(codec, &alc861vd_presets[board_config]);
16323 if (codec->vendor_id == 0x10ec0660) {
16324 /* always turn on EAPD */
16325 add_verb(spec, alc660vd_eapd_verbs);
16328 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16329 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16331 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16332 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16334 if (!spec->adc_nids) {
16335 spec->adc_nids = alc861vd_adc_nids;
16336 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16338 if (!spec->capsrc_nids)
16339 spec->capsrc_nids = alc861vd_capsrc_nids;
16341 set_capture_mixer(codec);
16342 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16344 spec->vmaster_nid = 0x02;
16346 codec->patch_ops = alc_patch_ops;
16348 if (board_config == ALC861VD_AUTO)
16349 spec->init_hook = alc861vd_auto_init;
16350 #ifdef CONFIG_SND_HDA_POWER_SAVE
16351 if (!spec->loopback.amplist)
16352 spec->loopback.amplist = alc861vd_loopbacks;
16361 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16362 * configuration. Each pin widget can choose any input DACs and a mixer.
16363 * Each ADC is connected from a mixer of all inputs. This makes possible
16364 * 6-channel independent captures.
16366 * In addition, an independent DAC for the multi-playback (not used in this
16369 #define ALC662_DIGOUT_NID 0x06
16370 #define ALC662_DIGIN_NID 0x0a
16372 static hda_nid_t alc662_dac_nids[4] = {
16373 /* front, rear, clfe, rear_surr */
16377 static hda_nid_t alc272_dac_nids[2] = {
16381 static hda_nid_t alc662_adc_nids[2] = {
16386 static hda_nid_t alc272_adc_nids[1] = {
16391 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16392 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16396 /* FIXME: should be a matrix-type input source selection */
16397 static struct hda_input_mux alc662_capture_source = {
16401 { "Front Mic", 0x1 },
16407 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16415 static struct hda_input_mux alc663_capture_source = {
16419 { "Front Mic", 0x1 },
16424 #if 0 /* set to 1 for testing other input sources below */
16425 static struct hda_input_mux alc272_nc10_capture_source = {
16428 { "Autoselect Mic", 0x0 },
16429 { "Internal Mic", 0x1 },
16430 { "In-0x02", 0x2 },
16431 { "In-0x03", 0x3 },
16432 { "In-0x04", 0x4 },
16433 { "In-0x05", 0x5 },
16434 { "In-0x06", 0x6 },
16435 { "In-0x07", 0x7 },
16436 { "In-0x08", 0x8 },
16437 { "In-0x09", 0x9 },
16438 { "In-0x0a", 0x0a },
16439 { "In-0x0b", 0x0b },
16440 { "In-0x0c", 0x0c },
16441 { "In-0x0d", 0x0d },
16442 { "In-0x0e", 0x0e },
16443 { "In-0x0f", 0x0f },
16451 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16458 static struct hda_verb alc662_3ST_ch2_init[] = {
16459 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16460 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16461 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16462 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16469 static struct hda_verb alc662_3ST_ch6_init[] = {
16470 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16471 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16472 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16473 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16474 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16475 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16479 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16480 { 2, alc662_3ST_ch2_init },
16481 { 6, alc662_3ST_ch6_init },
16487 static struct hda_verb alc662_sixstack_ch6_init[] = {
16488 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16489 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16490 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16497 static struct hda_verb alc662_sixstack_ch8_init[] = {
16498 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16499 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16500 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16504 static struct hda_channel_mode alc662_5stack_modes[2] = {
16505 { 2, alc662_sixstack_ch6_init },
16506 { 6, alc662_sixstack_ch8_init },
16509 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16510 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16513 static struct snd_kcontrol_new alc662_base_mixer[] = {
16514 /* output mixer control */
16515 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16516 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16517 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16518 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16519 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16520 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16521 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16522 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16523 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16525 /*Input mixer control */
16526 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16527 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16528 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16529 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16530 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16531 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16532 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16533 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16537 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16538 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16539 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16540 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16541 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16542 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16543 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16544 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16546 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16547 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16548 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16552 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16553 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16554 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16555 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16556 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16557 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16558 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16559 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16560 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16562 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16563 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16564 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16565 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16567 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16568 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16569 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16573 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16574 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16575 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16576 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16577 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16579 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16580 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16581 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16582 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16586 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16587 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16588 ALC262_HIPPO_MASTER_SWITCH,
16590 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16591 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16592 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16594 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16595 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16596 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16600 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16601 ALC262_HIPPO_MASTER_SWITCH,
16602 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16603 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16604 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16605 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16606 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16607 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16608 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16609 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16610 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16614 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16615 .ops = &snd_hda_bind_vol,
16617 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16618 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16623 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16624 .ops = &snd_hda_bind_sw,
16626 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16627 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16632 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16633 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16634 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16640 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16641 .ops = &snd_hda_bind_sw,
16643 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16644 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16645 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16650 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16651 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16652 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16653 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16654 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16655 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16656 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16661 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16662 .ops = &snd_hda_bind_sw,
16664 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16665 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16666 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16671 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16672 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16673 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
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("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16677 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16681 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16682 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16683 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16684 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16687 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16688 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16692 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16693 .ops = &snd_hda_bind_vol,
16695 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16696 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16701 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16702 .ops = &snd_hda_bind_sw,
16704 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16705 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16710 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16711 HDA_BIND_VOL("Master Playback Volume",
16712 &alc663_asus_two_bind_master_vol),
16713 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16714 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16715 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16717 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16721 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16722 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16723 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16724 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16725 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16726 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16727 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16731 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16732 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16733 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16734 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16735 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16736 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16739 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16740 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16741 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16745 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16746 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16747 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16748 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16751 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16752 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16753 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16754 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16755 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16759 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16760 .ops = &snd_hda_bind_sw,
16762 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16763 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16764 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16765 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16766 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16771 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16772 .ops = &snd_hda_bind_sw,
16774 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16775 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16780 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16781 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16782 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16783 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16784 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16785 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16786 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16787 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16789 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16793 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16794 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16795 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16796 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16797 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16798 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16805 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16808 .name = "Channel Mode",
16809 .info = alc_ch_mode_info,
16810 .get = alc_ch_mode_get,
16811 .put = alc_ch_mode_put,
16816 static struct hda_verb alc662_init_verbs[] = {
16817 /* ADC: mute amp left and right */
16818 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16819 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16823 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16825 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16826 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16828 /* Front Pin: output 0 (0x0c) */
16829 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16830 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16832 /* Rear Pin: output 1 (0x0d) */
16833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16836 /* CLFE Pin: output 2 (0x0e) */
16837 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16838 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16840 /* Mic (rear) pin: input vref at 80% */
16841 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16842 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16843 /* Front Mic pin: input vref at 80% */
16844 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16845 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16846 /* Line In pin: input */
16847 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16848 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16849 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16850 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16851 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16852 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16853 /* CD pin widget for input */
16854 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16856 /* FIXME: use matrix-type input source selection */
16857 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16859 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16860 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16862 /* always trun on EAPD */
16863 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16864 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16869 static struct hda_verb alc663_init_verbs[] = {
16870 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16871 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16872 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16873 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16874 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16875 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16879 static struct hda_verb alc272_init_verbs[] = {
16880 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16881 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16882 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16883 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16884 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16885 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16886 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16891 static struct hda_verb alc662_sue_init_verbs[] = {
16892 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16893 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16897 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16898 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16899 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16903 /* Set Unsolicited Event*/
16904 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16905 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16906 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16910 static struct hda_verb alc663_m51va_init_verbs[] = {
16911 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16912 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16913 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16914 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16915 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16916 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16918 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16919 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16923 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16924 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16925 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16926 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16927 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16928 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16929 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16930 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16934 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16935 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16938 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16939 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16940 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16941 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16942 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16946 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16947 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16948 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16949 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16950 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16951 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16952 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16953 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16957 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16958 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16959 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16960 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16961 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16962 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16963 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16964 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16967 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16968 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16969 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16973 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16974 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16975 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16976 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16977 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16979 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16980 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16983 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16984 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16985 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16989 static struct hda_verb alc663_g71v_init_verbs[] = {
16990 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16991 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16992 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16994 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16995 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16996 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16998 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16999 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17000 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17004 static struct hda_verb alc663_g50v_init_verbs[] = {
17005 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17006 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17007 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17009 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17010 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17014 static struct hda_verb alc662_ecs_init_verbs[] = {
17015 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17016 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17017 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17018 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17022 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17023 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17024 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17025 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17026 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17027 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17028 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17029 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17030 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17031 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17032 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17033 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17037 static struct hda_verb alc272_dell_init_verbs[] = {
17038 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17039 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
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 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17046 {0x23, 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_mode7_init_verbs[] = {
17053 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17054 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17055 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17056 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17057 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17058 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17059 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17060 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17061 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17062 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17065 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17066 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17067 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17071 static struct hda_verb alc663_mode8_init_verbs[] = {
17072 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17073 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17075 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17076 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17077 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17078 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17079 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17080 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17081 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17082 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17085 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17086 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17087 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17091 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17092 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17093 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17097 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17098 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17099 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17103 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17105 unsigned int present;
17106 unsigned char bits;
17108 present = snd_hda_jack_detect(codec, 0x14);
17109 bits = present ? HDA_AMP_MUTE : 0;
17111 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17112 HDA_AMP_MUTE, bits);
17115 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17117 unsigned int present;
17118 unsigned char bits;
17120 present = snd_hda_jack_detect(codec, 0x1b);
17121 bits = present ? HDA_AMP_MUTE : 0;
17123 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17124 HDA_AMP_MUTE, bits);
17125 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17126 HDA_AMP_MUTE, bits);
17129 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17132 if ((res >> 26) == ALC880_HP_EVENT)
17133 alc662_lenovo_101e_all_automute(codec);
17134 if ((res >> 26) == ALC880_FRONT_EVENT)
17135 alc662_lenovo_101e_ispeaker_automute(codec);
17138 /* unsolicited event for HP jack sensing */
17139 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17142 if ((res >> 26) == ALC880_MIC_EVENT)
17143 alc_mic_automute(codec);
17145 alc262_hippo_unsol_event(codec, res);
17148 static void alc662_eeepc_setup(struct hda_codec *codec)
17150 struct alc_spec *spec = codec->spec;
17152 alc262_hippo1_setup(codec);
17153 spec->ext_mic.pin = 0x18;
17154 spec->ext_mic.mux_idx = 0;
17155 spec->int_mic.pin = 0x19;
17156 spec->int_mic.mux_idx = 1;
17157 spec->auto_mic = 1;
17160 static void alc662_eeepc_inithook(struct hda_codec *codec)
17162 alc262_hippo_automute(codec);
17163 alc_mic_automute(codec);
17166 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17168 struct alc_spec *spec = codec->spec;
17170 spec->autocfg.hp_pins[0] = 0x14;
17171 spec->autocfg.speaker_pins[0] = 0x1b;
17174 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17176 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17178 unsigned int present;
17179 unsigned char bits;
17181 present = snd_hda_jack_detect(codec, 0x21);
17182 bits = present ? HDA_AMP_MUTE : 0;
17183 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17184 HDA_AMP_MUTE, bits);
17185 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17186 HDA_AMP_MUTE, bits);
17189 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17191 unsigned int present;
17192 unsigned char bits;
17194 present = snd_hda_jack_detect(codec, 0x21);
17195 bits = present ? HDA_AMP_MUTE : 0;
17196 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17197 HDA_AMP_MUTE, bits);
17198 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17199 HDA_AMP_MUTE, bits);
17200 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17201 HDA_AMP_MUTE, bits);
17202 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17203 HDA_AMP_MUTE, bits);
17206 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17208 unsigned int present;
17209 unsigned char bits;
17211 present = snd_hda_jack_detect(codec, 0x15);
17212 bits = present ? HDA_AMP_MUTE : 0;
17213 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17214 HDA_AMP_MUTE, bits);
17215 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17216 HDA_AMP_MUTE, bits);
17217 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17218 HDA_AMP_MUTE, bits);
17219 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17220 HDA_AMP_MUTE, bits);
17223 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17225 unsigned int present;
17226 unsigned char bits;
17228 present = snd_hda_jack_detect(codec, 0x1b);
17229 bits = present ? 0 : PIN_OUT;
17230 snd_hda_codec_write(codec, 0x14, 0,
17231 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17234 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17236 unsigned int present1, present2;
17238 present1 = snd_hda_jack_detect(codec, 0x21);
17239 present2 = snd_hda_jack_detect(codec, 0x15);
17241 if (present1 || present2) {
17242 snd_hda_codec_write_cache(codec, 0x14, 0,
17243 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17245 snd_hda_codec_write_cache(codec, 0x14, 0,
17246 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17250 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17252 unsigned int present1, present2;
17254 present1 = snd_hda_jack_detect(codec, 0x1b);
17255 present2 = snd_hda_jack_detect(codec, 0x15);
17257 if (present1 || present2) {
17258 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17259 HDA_AMP_MUTE, HDA_AMP_MUTE);
17260 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17261 HDA_AMP_MUTE, HDA_AMP_MUTE);
17263 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17265 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17270 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17272 unsigned int present1, present2;
17274 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17275 AC_VERB_GET_PIN_SENSE, 0)
17276 & AC_PINSENSE_PRESENCE;
17277 present2 = snd_hda_codec_read(codec, 0x21, 0,
17278 AC_VERB_GET_PIN_SENSE, 0)
17279 & AC_PINSENSE_PRESENCE;
17281 if (present1 || present2) {
17282 snd_hda_codec_write_cache(codec, 0x14, 0,
17283 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17284 snd_hda_codec_write_cache(codec, 0x17, 0,
17285 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17287 snd_hda_codec_write_cache(codec, 0x14, 0,
17288 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17289 snd_hda_codec_write_cache(codec, 0x17, 0,
17290 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17294 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17296 unsigned int present1, present2;
17298 present1 = snd_hda_codec_read(codec, 0x21, 0,
17299 AC_VERB_GET_PIN_SENSE, 0)
17300 & AC_PINSENSE_PRESENCE;
17301 present2 = snd_hda_codec_read(codec, 0x15, 0,
17302 AC_VERB_GET_PIN_SENSE, 0)
17303 & AC_PINSENSE_PRESENCE;
17305 if (present1 || present2) {
17306 snd_hda_codec_write_cache(codec, 0x14, 0,
17307 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17308 snd_hda_codec_write_cache(codec, 0x17, 0,
17309 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17311 snd_hda_codec_write_cache(codec, 0x14, 0,
17312 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17313 snd_hda_codec_write_cache(codec, 0x17, 0,
17314 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17318 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17321 switch (res >> 26) {
17322 case ALC880_HP_EVENT:
17323 alc663_m51va_speaker_automute(codec);
17325 case ALC880_MIC_EVENT:
17326 alc_mic_automute(codec);
17331 static void alc663_m51va_setup(struct hda_codec *codec)
17333 struct alc_spec *spec = codec->spec;
17334 spec->ext_mic.pin = 0x18;
17335 spec->ext_mic.mux_idx = 0;
17336 spec->int_mic.pin = 0x12;
17337 spec->int_mic.mux_idx = 9;
17338 spec->auto_mic = 1;
17341 static void alc663_m51va_inithook(struct hda_codec *codec)
17343 alc663_m51va_speaker_automute(codec);
17344 alc_mic_automute(codec);
17347 /* ***************** Mode1 ******************************/
17348 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17350 static void alc663_mode1_setup(struct hda_codec *codec)
17352 struct alc_spec *spec = codec->spec;
17353 spec->ext_mic.pin = 0x18;
17354 spec->ext_mic.mux_idx = 0;
17355 spec->int_mic.pin = 0x19;
17356 spec->int_mic.mux_idx = 1;
17357 spec->auto_mic = 1;
17360 #define alc663_mode1_inithook alc663_m51va_inithook
17362 /* ***************** Mode2 ******************************/
17363 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17366 switch (res >> 26) {
17367 case ALC880_HP_EVENT:
17368 alc662_f5z_speaker_automute(codec);
17370 case ALC880_MIC_EVENT:
17371 alc_mic_automute(codec);
17376 #define alc662_mode2_setup alc663_mode1_setup
17378 static void alc662_mode2_inithook(struct hda_codec *codec)
17380 alc662_f5z_speaker_automute(codec);
17381 alc_mic_automute(codec);
17383 /* ***************** Mode3 ******************************/
17384 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17387 switch (res >> 26) {
17388 case ALC880_HP_EVENT:
17389 alc663_two_hp_m1_speaker_automute(codec);
17391 case ALC880_MIC_EVENT:
17392 alc_mic_automute(codec);
17397 #define alc663_mode3_setup alc663_mode1_setup
17399 static void alc663_mode3_inithook(struct hda_codec *codec)
17401 alc663_two_hp_m1_speaker_automute(codec);
17402 alc_mic_automute(codec);
17404 /* ***************** Mode4 ******************************/
17405 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17408 switch (res >> 26) {
17409 case ALC880_HP_EVENT:
17410 alc663_21jd_two_speaker_automute(codec);
17412 case ALC880_MIC_EVENT:
17413 alc_mic_automute(codec);
17418 #define alc663_mode4_setup alc663_mode1_setup
17420 static void alc663_mode4_inithook(struct hda_codec *codec)
17422 alc663_21jd_two_speaker_automute(codec);
17423 alc_mic_automute(codec);
17425 /* ***************** Mode5 ******************************/
17426 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17429 switch (res >> 26) {
17430 case ALC880_HP_EVENT:
17431 alc663_15jd_two_speaker_automute(codec);
17433 case ALC880_MIC_EVENT:
17434 alc_mic_automute(codec);
17439 #define alc663_mode5_setup alc663_mode1_setup
17441 static void alc663_mode5_inithook(struct hda_codec *codec)
17443 alc663_15jd_two_speaker_automute(codec);
17444 alc_mic_automute(codec);
17446 /* ***************** Mode6 ******************************/
17447 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17450 switch (res >> 26) {
17451 case ALC880_HP_EVENT:
17452 alc663_two_hp_m2_speaker_automute(codec);
17454 case ALC880_MIC_EVENT:
17455 alc_mic_automute(codec);
17460 #define alc663_mode6_setup alc663_mode1_setup
17462 static void alc663_mode6_inithook(struct hda_codec *codec)
17464 alc663_two_hp_m2_speaker_automute(codec);
17465 alc_mic_automute(codec);
17468 /* ***************** Mode7 ******************************/
17469 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17472 switch (res >> 26) {
17473 case ALC880_HP_EVENT:
17474 alc663_two_hp_m7_speaker_automute(codec);
17476 case ALC880_MIC_EVENT:
17477 alc_mic_automute(codec);
17482 #define alc663_mode7_setup alc663_mode1_setup
17484 static void alc663_mode7_inithook(struct hda_codec *codec)
17486 alc663_two_hp_m7_speaker_automute(codec);
17487 alc_mic_automute(codec);
17490 /* ***************** Mode8 ******************************/
17491 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17494 switch (res >> 26) {
17495 case ALC880_HP_EVENT:
17496 alc663_two_hp_m8_speaker_automute(codec);
17498 case ALC880_MIC_EVENT:
17499 alc_mic_automute(codec);
17504 #define alc663_mode8_setup alc663_m51va_setup
17506 static void alc663_mode8_inithook(struct hda_codec *codec)
17508 alc663_two_hp_m8_speaker_automute(codec);
17509 alc_mic_automute(codec);
17512 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17514 unsigned int present;
17515 unsigned char bits;
17517 present = snd_hda_jack_detect(codec, 0x21);
17518 bits = present ? HDA_AMP_MUTE : 0;
17519 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17520 HDA_AMP_MUTE, bits);
17521 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17522 HDA_AMP_MUTE, bits);
17525 static void alc663_g71v_front_automute(struct hda_codec *codec)
17527 unsigned int present;
17528 unsigned char bits;
17530 present = snd_hda_jack_detect(codec, 0x15);
17531 bits = present ? HDA_AMP_MUTE : 0;
17532 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17533 HDA_AMP_MUTE, bits);
17536 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17539 switch (res >> 26) {
17540 case ALC880_HP_EVENT:
17541 alc663_g71v_hp_automute(codec);
17543 case ALC880_FRONT_EVENT:
17544 alc663_g71v_front_automute(codec);
17546 case ALC880_MIC_EVENT:
17547 alc_mic_automute(codec);
17552 #define alc663_g71v_setup alc663_m51va_setup
17554 static void alc663_g71v_inithook(struct hda_codec *codec)
17556 alc663_g71v_front_automute(codec);
17557 alc663_g71v_hp_automute(codec);
17558 alc_mic_automute(codec);
17561 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17564 switch (res >> 26) {
17565 case ALC880_HP_EVENT:
17566 alc663_m51va_speaker_automute(codec);
17568 case ALC880_MIC_EVENT:
17569 alc_mic_automute(codec);
17574 #define alc663_g50v_setup alc663_m51va_setup
17576 static void alc663_g50v_inithook(struct hda_codec *codec)
17578 alc663_m51va_speaker_automute(codec);
17579 alc_mic_automute(codec);
17582 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17583 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17584 ALC262_HIPPO_MASTER_SWITCH,
17586 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17587 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17588 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17590 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17591 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17592 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17596 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17597 /* Master Playback automatically created from Speaker and Headphone */
17598 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17599 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17600 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17601 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17603 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17604 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17605 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17607 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17608 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17609 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17613 #ifdef CONFIG_SND_HDA_POWER_SAVE
17614 #define alc662_loopbacks alc880_loopbacks
17618 /* pcm configuration: identical with ALC880 */
17619 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17620 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17621 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17622 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17625 * configuration and preset
17627 static const char *alc662_models[ALC662_MODEL_LAST] = {
17628 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17629 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17630 [ALC662_3ST_6ch] = "3stack-6ch",
17631 [ALC662_5ST_DIG] = "6stack-dig",
17632 [ALC662_LENOVO_101E] = "lenovo-101e",
17633 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17634 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17635 [ALC662_ECS] = "ecs",
17636 [ALC663_ASUS_M51VA] = "m51va",
17637 [ALC663_ASUS_G71V] = "g71v",
17638 [ALC663_ASUS_H13] = "h13",
17639 [ALC663_ASUS_G50V] = "g50v",
17640 [ALC663_ASUS_MODE1] = "asus-mode1",
17641 [ALC662_ASUS_MODE2] = "asus-mode2",
17642 [ALC663_ASUS_MODE3] = "asus-mode3",
17643 [ALC663_ASUS_MODE4] = "asus-mode4",
17644 [ALC663_ASUS_MODE5] = "asus-mode5",
17645 [ALC663_ASUS_MODE6] = "asus-mode6",
17646 [ALC663_ASUS_MODE7] = "asus-mode7",
17647 [ALC663_ASUS_MODE8] = "asus-mode8",
17648 [ALC272_DELL] = "dell",
17649 [ALC272_DELL_ZM1] = "dell-zm1",
17650 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17651 [ALC662_AUTO] = "auto",
17654 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17655 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17656 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17657 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17658 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17659 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17660 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17661 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17662 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17663 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17664 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17665 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17666 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17667 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17668 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17669 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17670 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17671 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17672 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17673 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17674 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17675 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17676 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17677 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17678 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17679 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17680 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17681 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17682 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17683 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17684 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17685 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17686 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17687 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17688 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17689 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17690 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17691 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17692 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17693 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17694 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17695 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17696 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17697 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17698 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17699 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17700 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17701 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17702 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17703 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17704 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17705 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17706 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17707 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17708 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17709 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17710 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17711 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17712 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17713 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17714 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17715 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17716 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17717 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17718 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17719 ALC662_3ST_6ch_DIG),
17720 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17721 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17722 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17723 ALC662_3ST_6ch_DIG),
17724 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17725 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17726 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17727 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17728 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17729 ALC662_3ST_6ch_DIG),
17730 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17732 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17736 static struct alc_config_preset alc662_presets[] = {
17737 [ALC662_3ST_2ch_DIG] = {
17738 .mixers = { alc662_3ST_2ch_mixer },
17739 .init_verbs = { alc662_init_verbs },
17740 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17741 .dac_nids = alc662_dac_nids,
17742 .dig_out_nid = ALC662_DIGOUT_NID,
17743 .dig_in_nid = ALC662_DIGIN_NID,
17744 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17745 .channel_mode = alc662_3ST_2ch_modes,
17746 .input_mux = &alc662_capture_source,
17748 [ALC662_3ST_6ch_DIG] = {
17749 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17750 .init_verbs = { alc662_init_verbs },
17751 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17752 .dac_nids = alc662_dac_nids,
17753 .dig_out_nid = ALC662_DIGOUT_NID,
17754 .dig_in_nid = ALC662_DIGIN_NID,
17755 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17756 .channel_mode = alc662_3ST_6ch_modes,
17758 .input_mux = &alc662_capture_source,
17760 [ALC662_3ST_6ch] = {
17761 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17762 .init_verbs = { alc662_init_verbs },
17763 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17764 .dac_nids = alc662_dac_nids,
17765 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17766 .channel_mode = alc662_3ST_6ch_modes,
17768 .input_mux = &alc662_capture_source,
17770 [ALC662_5ST_DIG] = {
17771 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17772 .init_verbs = { alc662_init_verbs },
17773 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17774 .dac_nids = alc662_dac_nids,
17775 .dig_out_nid = ALC662_DIGOUT_NID,
17776 .dig_in_nid = ALC662_DIGIN_NID,
17777 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17778 .channel_mode = alc662_5stack_modes,
17779 .input_mux = &alc662_capture_source,
17781 [ALC662_LENOVO_101E] = {
17782 .mixers = { alc662_lenovo_101e_mixer },
17783 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17784 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17785 .dac_nids = alc662_dac_nids,
17786 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17787 .channel_mode = alc662_3ST_2ch_modes,
17788 .input_mux = &alc662_lenovo_101e_capture_source,
17789 .unsol_event = alc662_lenovo_101e_unsol_event,
17790 .init_hook = alc662_lenovo_101e_all_automute,
17792 [ALC662_ASUS_EEEPC_P701] = {
17793 .mixers = { alc662_eeepc_p701_mixer },
17794 .init_verbs = { alc662_init_verbs,
17795 alc662_eeepc_sue_init_verbs },
17796 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17797 .dac_nids = alc662_dac_nids,
17798 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17799 .channel_mode = alc662_3ST_2ch_modes,
17800 .unsol_event = alc662_eeepc_unsol_event,
17801 .setup = alc662_eeepc_setup,
17802 .init_hook = alc662_eeepc_inithook,
17804 [ALC662_ASUS_EEEPC_EP20] = {
17805 .mixers = { alc662_eeepc_ep20_mixer,
17806 alc662_chmode_mixer },
17807 .init_verbs = { alc662_init_verbs,
17808 alc662_eeepc_ep20_sue_init_verbs },
17809 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17810 .dac_nids = alc662_dac_nids,
17811 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17812 .channel_mode = alc662_3ST_6ch_modes,
17813 .input_mux = &alc662_lenovo_101e_capture_source,
17814 .unsol_event = alc662_eeepc_unsol_event,
17815 .setup = alc662_eeepc_ep20_setup,
17816 .init_hook = alc662_eeepc_ep20_inithook,
17819 .mixers = { alc662_ecs_mixer },
17820 .init_verbs = { alc662_init_verbs,
17821 alc662_ecs_init_verbs },
17822 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17823 .dac_nids = alc662_dac_nids,
17824 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17825 .channel_mode = alc662_3ST_2ch_modes,
17826 .unsol_event = alc662_eeepc_unsol_event,
17827 .setup = alc662_eeepc_setup,
17828 .init_hook = alc662_eeepc_inithook,
17830 [ALC663_ASUS_M51VA] = {
17831 .mixers = { alc663_m51va_mixer },
17832 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17833 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17834 .dac_nids = alc662_dac_nids,
17835 .dig_out_nid = ALC662_DIGOUT_NID,
17836 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17837 .channel_mode = alc662_3ST_2ch_modes,
17838 .unsol_event = alc663_m51va_unsol_event,
17839 .setup = alc663_m51va_setup,
17840 .init_hook = alc663_m51va_inithook,
17842 [ALC663_ASUS_G71V] = {
17843 .mixers = { alc663_g71v_mixer },
17844 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17845 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17846 .dac_nids = alc662_dac_nids,
17847 .dig_out_nid = ALC662_DIGOUT_NID,
17848 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17849 .channel_mode = alc662_3ST_2ch_modes,
17850 .unsol_event = alc663_g71v_unsol_event,
17851 .setup = alc663_g71v_setup,
17852 .init_hook = alc663_g71v_inithook,
17854 [ALC663_ASUS_H13] = {
17855 .mixers = { alc663_m51va_mixer },
17856 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17857 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17858 .dac_nids = alc662_dac_nids,
17859 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17860 .channel_mode = alc662_3ST_2ch_modes,
17861 .unsol_event = alc663_m51va_unsol_event,
17862 .init_hook = alc663_m51va_inithook,
17864 [ALC663_ASUS_G50V] = {
17865 .mixers = { alc663_g50v_mixer },
17866 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17867 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17868 .dac_nids = alc662_dac_nids,
17869 .dig_out_nid = ALC662_DIGOUT_NID,
17870 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17871 .channel_mode = alc662_3ST_6ch_modes,
17872 .input_mux = &alc663_capture_source,
17873 .unsol_event = alc663_g50v_unsol_event,
17874 .setup = alc663_g50v_setup,
17875 .init_hook = alc663_g50v_inithook,
17877 [ALC663_ASUS_MODE1] = {
17878 .mixers = { alc663_m51va_mixer },
17879 .cap_mixer = alc662_auto_capture_mixer,
17880 .init_verbs = { alc662_init_verbs,
17881 alc663_21jd_amic_init_verbs },
17882 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17884 .dac_nids = alc662_dac_nids,
17885 .dig_out_nid = ALC662_DIGOUT_NID,
17886 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17887 .channel_mode = alc662_3ST_2ch_modes,
17888 .unsol_event = alc663_mode1_unsol_event,
17889 .setup = alc663_mode1_setup,
17890 .init_hook = alc663_mode1_inithook,
17892 [ALC662_ASUS_MODE2] = {
17893 .mixers = { alc662_1bjd_mixer },
17894 .cap_mixer = alc662_auto_capture_mixer,
17895 .init_verbs = { alc662_init_verbs,
17896 alc662_1bjd_amic_init_verbs },
17897 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17898 .dac_nids = alc662_dac_nids,
17899 .dig_out_nid = ALC662_DIGOUT_NID,
17900 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17901 .channel_mode = alc662_3ST_2ch_modes,
17902 .unsol_event = alc662_mode2_unsol_event,
17903 .setup = alc662_mode2_setup,
17904 .init_hook = alc662_mode2_inithook,
17906 [ALC663_ASUS_MODE3] = {
17907 .mixers = { alc663_two_hp_m1_mixer },
17908 .cap_mixer = alc662_auto_capture_mixer,
17909 .init_verbs = { alc662_init_verbs,
17910 alc663_two_hp_amic_m1_init_verbs },
17911 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17913 .dac_nids = alc662_dac_nids,
17914 .dig_out_nid = ALC662_DIGOUT_NID,
17915 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17916 .channel_mode = alc662_3ST_2ch_modes,
17917 .unsol_event = alc663_mode3_unsol_event,
17918 .setup = alc663_mode3_setup,
17919 .init_hook = alc663_mode3_inithook,
17921 [ALC663_ASUS_MODE4] = {
17922 .mixers = { alc663_asus_21jd_clfe_mixer },
17923 .cap_mixer = alc662_auto_capture_mixer,
17924 .init_verbs = { alc662_init_verbs,
17925 alc663_21jd_amic_init_verbs},
17926 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17928 .dac_nids = alc662_dac_nids,
17929 .dig_out_nid = ALC662_DIGOUT_NID,
17930 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17931 .channel_mode = alc662_3ST_2ch_modes,
17932 .unsol_event = alc663_mode4_unsol_event,
17933 .setup = alc663_mode4_setup,
17934 .init_hook = alc663_mode4_inithook,
17936 [ALC663_ASUS_MODE5] = {
17937 .mixers = { alc663_asus_15jd_clfe_mixer },
17938 .cap_mixer = alc662_auto_capture_mixer,
17939 .init_verbs = { alc662_init_verbs,
17940 alc663_15jd_amic_init_verbs },
17941 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17943 .dac_nids = alc662_dac_nids,
17944 .dig_out_nid = ALC662_DIGOUT_NID,
17945 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17946 .channel_mode = alc662_3ST_2ch_modes,
17947 .unsol_event = alc663_mode5_unsol_event,
17948 .setup = alc663_mode5_setup,
17949 .init_hook = alc663_mode5_inithook,
17951 [ALC663_ASUS_MODE6] = {
17952 .mixers = { alc663_two_hp_m2_mixer },
17953 .cap_mixer = alc662_auto_capture_mixer,
17954 .init_verbs = { alc662_init_verbs,
17955 alc663_two_hp_amic_m2_init_verbs },
17956 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17958 .dac_nids = alc662_dac_nids,
17959 .dig_out_nid = ALC662_DIGOUT_NID,
17960 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17961 .channel_mode = alc662_3ST_2ch_modes,
17962 .unsol_event = alc663_mode6_unsol_event,
17963 .setup = alc663_mode6_setup,
17964 .init_hook = alc663_mode6_inithook,
17966 [ALC663_ASUS_MODE7] = {
17967 .mixers = { alc663_mode7_mixer },
17968 .cap_mixer = alc662_auto_capture_mixer,
17969 .init_verbs = { alc662_init_verbs,
17970 alc663_mode7_init_verbs },
17971 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17973 .dac_nids = alc662_dac_nids,
17974 .dig_out_nid = ALC662_DIGOUT_NID,
17975 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17976 .channel_mode = alc662_3ST_2ch_modes,
17977 .unsol_event = alc663_mode7_unsol_event,
17978 .setup = alc663_mode7_setup,
17979 .init_hook = alc663_mode7_inithook,
17981 [ALC663_ASUS_MODE8] = {
17982 .mixers = { alc663_mode8_mixer },
17983 .cap_mixer = alc662_auto_capture_mixer,
17984 .init_verbs = { alc662_init_verbs,
17985 alc663_mode8_init_verbs },
17986 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17988 .dac_nids = alc662_dac_nids,
17989 .dig_out_nid = ALC662_DIGOUT_NID,
17990 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17991 .channel_mode = alc662_3ST_2ch_modes,
17992 .unsol_event = alc663_mode8_unsol_event,
17993 .setup = alc663_mode8_setup,
17994 .init_hook = alc663_mode8_inithook,
17997 .mixers = { alc663_m51va_mixer },
17998 .cap_mixer = alc272_auto_capture_mixer,
17999 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18000 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18001 .dac_nids = alc662_dac_nids,
18002 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18003 .adc_nids = alc272_adc_nids,
18004 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18005 .capsrc_nids = alc272_capsrc_nids,
18006 .channel_mode = alc662_3ST_2ch_modes,
18007 .unsol_event = alc663_m51va_unsol_event,
18008 .setup = alc663_m51va_setup,
18009 .init_hook = alc663_m51va_inithook,
18011 [ALC272_DELL_ZM1] = {
18012 .mixers = { alc663_m51va_mixer },
18013 .cap_mixer = alc662_auto_capture_mixer,
18014 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18015 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18016 .dac_nids = alc662_dac_nids,
18017 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18018 .adc_nids = alc662_adc_nids,
18020 .capsrc_nids = alc662_capsrc_nids,
18021 .channel_mode = alc662_3ST_2ch_modes,
18022 .unsol_event = alc663_m51va_unsol_event,
18023 .setup = alc663_m51va_setup,
18024 .init_hook = alc663_m51va_inithook,
18026 [ALC272_SAMSUNG_NC10] = {
18027 .mixers = { alc272_nc10_mixer },
18028 .init_verbs = { alc662_init_verbs,
18029 alc663_21jd_amic_init_verbs },
18030 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18031 .dac_nids = alc272_dac_nids,
18032 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18033 .channel_mode = alc662_3ST_2ch_modes,
18034 /*.input_mux = &alc272_nc10_capture_source,*/
18035 .unsol_event = alc663_mode4_unsol_event,
18036 .setup = alc663_mode4_setup,
18037 .init_hook = alc663_mode4_inithook,
18043 * BIOS auto configuration
18046 /* convert from MIX nid to DAC */
18047 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18051 else if (nid >= 0x0c && nid <= 0x0e)
18052 return nid - 0x0c + 0x02;
18057 /* get MIX nid connected to the given pin targeted to DAC */
18058 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18064 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18065 for (i = 0; i < num; i++) {
18066 if (alc662_mix_to_dac(mix[i]) == dac)
18072 /* look for an empty DAC slot */
18073 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18075 struct alc_spec *spec = codec->spec;
18079 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18082 for (i = 0; i < num; i++) {
18083 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18086 for (j = 0; j < spec->multiout.num_dacs; j++)
18087 if (spec->multiout.dac_nids[j] == nid)
18089 if (j >= spec->multiout.num_dacs)
18095 /* fill in the dac_nids table from the parsed pin configuration */
18096 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18097 const struct auto_pin_cfg *cfg)
18099 struct alc_spec *spec = codec->spec;
18103 spec->multiout.dac_nids = spec->private_dac_nids;
18104 for (i = 0; i < cfg->line_outs; i++) {
18105 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18108 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18113 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18114 hda_nid_t nid, unsigned int chs)
18116 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18117 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18120 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18121 hda_nid_t nid, unsigned int chs)
18123 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18124 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18127 #define alc662_add_stereo_vol(spec, pfx, nid) \
18128 alc662_add_vol_ctl(spec, pfx, nid, 3)
18129 #define alc662_add_stereo_sw(spec, pfx, nid) \
18130 alc662_add_sw_ctl(spec, pfx, nid, 3)
18132 /* add playback controls from the parsed DAC table */
18133 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18134 const struct auto_pin_cfg *cfg)
18136 struct alc_spec *spec = codec->spec;
18137 static const char *chname[4] = {
18138 "Front", "Surround", NULL /*CLFE*/, "Side"
18140 hda_nid_t nid, mix;
18143 for (i = 0; i < cfg->line_outs; i++) {
18144 nid = spec->multiout.dac_nids[i];
18147 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18152 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18155 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18158 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18161 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18166 if (cfg->line_outs == 1 &&
18167 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18174 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18177 if (cfg->line_outs == 1 &&
18178 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18180 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18188 /* add playback controls for speaker and HP outputs */
18189 /* return DAC nid if any new DAC is assigned */
18190 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18193 struct alc_spec *spec = codec->spec;
18194 hda_nid_t nid, mix;
18199 nid = alc662_look_for_dac(codec, pin);
18201 /* the corresponding DAC is already occupied */
18202 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18203 return 0; /* no way */
18204 /* create a switch only */
18205 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18206 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18209 mix = alc662_dac_to_mix(codec, pin, nid);
18212 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18215 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18221 /* create playback/capture controls for input pins */
18222 #define alc662_auto_create_input_ctls \
18223 alc882_auto_create_input_ctls
18225 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18226 hda_nid_t nid, int pin_type,
18232 alc_set_pin_output(codec, nid, pin_type);
18233 /* need the manual connection? */
18234 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18237 for (i = 0; i < num; i++) {
18238 if (alc662_mix_to_dac(srcs[i]) != dac)
18240 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18245 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18247 struct alc_spec *spec = codec->spec;
18248 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18251 for (i = 0; i <= HDA_SIDE; i++) {
18252 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18254 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18255 spec->multiout.dac_nids[i]);
18259 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18261 struct alc_spec *spec = codec->spec;
18264 pin = spec->autocfg.hp_pins[0];
18266 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18267 spec->multiout.hp_nid);
18268 pin = spec->autocfg.speaker_pins[0];
18270 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18271 spec->multiout.extra_out_nid[0]);
18274 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18276 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18278 struct alc_spec *spec = codec->spec;
18281 for (i = 0; i < AUTO_PIN_LAST; i++) {
18282 hda_nid_t nid = spec->autocfg.input_pins[i];
18283 if (alc_is_input_pin(codec, nid)) {
18284 alc_set_input_pin(codec, nid, i);
18285 if (nid != ALC662_PIN_CD_NID &&
18286 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18287 snd_hda_codec_write(codec, nid, 0,
18288 AC_VERB_SET_AMP_GAIN_MUTE,
18294 #define alc662_auto_init_input_src alc882_auto_init_input_src
18296 static int alc662_parse_auto_config(struct hda_codec *codec)
18298 struct alc_spec *spec = codec->spec;
18300 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18302 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18306 if (!spec->autocfg.line_outs)
18307 return 0; /* can't find valid BIOS pin config */
18309 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18312 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18315 err = alc662_auto_create_extra_out(codec,
18316 spec->autocfg.speaker_pins[0],
18321 spec->multiout.extra_out_nid[0] = err;
18322 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18327 spec->multiout.hp_nid = err;
18328 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18332 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18334 if (spec->autocfg.dig_outs)
18335 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18337 if (spec->kctls.list)
18338 add_mixer(spec, spec->kctls.list);
18340 spec->num_mux_defs = 1;
18341 spec->input_mux = &spec->private_imux[0];
18343 add_verb(spec, alc662_init_verbs);
18344 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18345 codec->vendor_id == 0x10ec0665)
18346 add_verb(spec, alc663_init_verbs);
18348 if (codec->vendor_id == 0x10ec0272)
18349 add_verb(spec, alc272_init_verbs);
18351 err = alc_auto_add_mic_boost(codec);
18355 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18356 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18357 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18359 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18364 /* additional initialization for auto-configuration model */
18365 static void alc662_auto_init(struct hda_codec *codec)
18367 struct alc_spec *spec = codec->spec;
18368 alc662_auto_init_multi_out(codec);
18369 alc662_auto_init_hp_out(codec);
18370 alc662_auto_init_analog_input(codec);
18371 alc662_auto_init_input_src(codec);
18372 if (spec->unsol_event)
18373 alc_inithook(codec);
18376 static int patch_alc662(struct hda_codec *codec)
18378 struct alc_spec *spec;
18379 int err, board_config;
18381 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18385 codec->spec = spec;
18387 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18389 if (alc_read_coef_idx(codec, 0)==0x8020){
18390 kfree(codec->chip_name);
18391 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18392 if (!codec->chip_name) {
18398 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18401 if (board_config < 0) {
18402 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18404 board_config = ALC662_AUTO;
18407 if (board_config == ALC662_AUTO) {
18408 /* automatic parse from the BIOS config */
18409 err = alc662_parse_auto_config(codec);
18415 "hda_codec: Cannot set up configuration "
18416 "from BIOS. Using base mode...\n");
18417 board_config = ALC662_3ST_2ch_DIG;
18421 err = snd_hda_attach_beep_device(codec, 0x1);
18427 if (board_config != ALC662_AUTO)
18428 setup_preset(codec, &alc662_presets[board_config]);
18430 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18431 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18433 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18434 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18436 if (!spec->adc_nids) {
18437 spec->adc_nids = alc662_adc_nids;
18438 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18440 if (!spec->capsrc_nids)
18441 spec->capsrc_nids = alc662_capsrc_nids;
18443 if (!spec->cap_mixer)
18444 set_capture_mixer(codec);
18446 switch (codec->vendor_id) {
18448 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18453 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18456 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18459 spec->vmaster_nid = 0x02;
18461 codec->patch_ops = alc_patch_ops;
18462 if (board_config == ALC662_AUTO)
18463 spec->init_hook = alc662_auto_init;
18464 #ifdef CONFIG_SND_HDA_POWER_SAVE
18465 if (!spec->loopback.amplist)
18466 spec->loopback.amplist = alc662_loopbacks;
18472 static int patch_alc888(struct hda_codec *codec)
18474 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18475 kfree(codec->chip_name);
18476 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18477 if (!codec->chip_name) {
18481 return patch_alc662(codec);
18483 return patch_alc882(codec);
18489 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18490 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18491 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18492 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18493 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18494 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18495 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18496 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18497 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18498 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18499 .patch = patch_alc861 },
18500 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18501 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18502 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18503 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18504 .patch = patch_alc882 },
18505 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18506 .patch = patch_alc662 },
18507 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18508 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18509 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18510 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18511 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18512 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18513 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18514 .patch = patch_alc882 },
18515 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18516 .patch = patch_alc882 },
18517 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18518 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18519 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18520 .patch = patch_alc882 },
18521 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18522 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18523 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18524 {} /* terminator */
18527 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18529 MODULE_LICENSE("GPL");
18530 MODULE_DESCRIPTION("Realtek HD-audio codec");
18532 static struct hda_codec_preset_list realtek_list = {
18533 .preset = snd_hda_preset_realtek,
18534 .owner = THIS_MODULE,
18537 static int __init patch_realtek_init(void)
18539 return snd_hda_add_codec_preset(&realtek_list);
18542 static void __exit patch_realtek_exit(void)
18544 snd_hda_delete_codec_preset(&realtek_list);
18547 module_init(patch_realtek_init)
18548 module_exit(patch_realtek_exit)