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 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4988 #define set_beep_amp(spec, nid, idx, dir) \
4989 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4991 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4995 * OK, here we have finally the patch for ALC880
4998 static int patch_alc880(struct hda_codec *codec)
5000 struct alc_spec *spec;
5004 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5010 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5013 if (board_config < 0) {
5014 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5016 board_config = ALC880_AUTO;
5019 if (board_config == ALC880_AUTO) {
5020 /* automatic parse from the BIOS config */
5021 err = alc880_parse_auto_config(codec);
5027 "hda_codec: Cannot set up configuration "
5028 "from BIOS. Using 3-stack mode...\n");
5029 board_config = ALC880_3ST;
5033 err = snd_hda_attach_beep_device(codec, 0x1);
5039 if (board_config != ALC880_AUTO)
5040 setup_preset(codec, &alc880_presets[board_config]);
5042 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5043 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5044 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5046 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5047 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5049 if (!spec->adc_nids && spec->input_mux) {
5050 /* check whether NID 0x07 is valid */
5051 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5053 wcap = get_wcaps_type(wcap);
5054 if (wcap != AC_WID_AUD_IN) {
5055 spec->adc_nids = alc880_adc_nids_alt;
5056 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5058 spec->adc_nids = alc880_adc_nids;
5059 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5062 set_capture_mixer(codec);
5063 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5065 spec->vmaster_nid = 0x0c;
5067 codec->patch_ops = alc_patch_ops;
5068 if (board_config == ALC880_AUTO)
5069 spec->init_hook = alc880_auto_init;
5070 #ifdef CONFIG_SND_HDA_POWER_SAVE
5071 if (!spec->loopback.amplist)
5072 spec->loopback.amplist = alc880_loopbacks;
5083 static hda_nid_t alc260_dac_nids[1] = {
5088 static hda_nid_t alc260_adc_nids[1] = {
5093 static hda_nid_t alc260_adc_nids_alt[1] = {
5098 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5099 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5101 static hda_nid_t alc260_dual_adc_nids[2] = {
5106 #define ALC260_DIGOUT_NID 0x03
5107 #define ALC260_DIGIN_NID 0x06
5109 static struct hda_input_mux alc260_capture_source = {
5113 { "Front Mic", 0x1 },
5119 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5120 * headphone jack and the internal CD lines since these are the only pins at
5121 * which audio can appear. For flexibility, also allow the option of
5122 * recording the mixer output on the second ADC (ADC0 doesn't have a
5123 * connection to the mixer output).
5125 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5129 { "Mic/Line", 0x0 },
5131 { "Headphone", 0x2 },
5137 { "Mic/Line", 0x0 },
5139 { "Headphone", 0x2 },
5146 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5147 * the Fujitsu S702x, but jacks are marked differently.
5149 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5156 { "Headphone", 0x5 },
5165 { "Headphone", 0x6 },
5171 /* Maxdata Favorit 100XS */
5172 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5176 { "Line/Mic", 0x0 },
5183 { "Line/Mic", 0x0 },
5191 * This is just place-holder, so there's something for alc_build_pcms to look
5192 * at when it calculates the maximum number of channels. ALC260 has no mixer
5193 * element which allows changing the channel mode, so the verb list is
5196 static struct hda_channel_mode alc260_modes[1] = {
5201 /* Mixer combinations
5203 * basic: base_output + input + pc_beep + capture
5204 * HP: base_output + input + capture_alt
5205 * HP_3013: hp_3013 + input + capture
5206 * fujitsu: fujitsu + capture
5207 * acer: acer + capture
5210 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5211 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5212 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5213 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5214 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5215 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5216 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5220 static struct snd_kcontrol_new alc260_input_mixer[] = {
5221 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5222 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5223 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5224 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5226 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5227 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5228 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5232 /* update HP, line and mono out pins according to the master switch */
5233 static void alc260_hp_master_update(struct hda_codec *codec,
5234 hda_nid_t hp, hda_nid_t line,
5237 struct alc_spec *spec = codec->spec;
5238 unsigned int val = spec->master_sw ? PIN_HP : 0;
5239 /* change HP and line-out pins */
5240 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5242 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5244 /* mono (speaker) depending on the HP jack sense */
5245 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5246 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5250 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5251 struct snd_ctl_elem_value *ucontrol)
5253 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5254 struct alc_spec *spec = codec->spec;
5255 *ucontrol->value.integer.value = spec->master_sw;
5259 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5260 struct snd_ctl_elem_value *ucontrol)
5262 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5263 struct alc_spec *spec = codec->spec;
5264 int val = !!*ucontrol->value.integer.value;
5265 hda_nid_t hp, line, mono;
5267 if (val == spec->master_sw)
5269 spec->master_sw = val;
5270 hp = (kcontrol->private_value >> 16) & 0xff;
5271 line = (kcontrol->private_value >> 8) & 0xff;
5272 mono = kcontrol->private_value & 0xff;
5273 alc260_hp_master_update(codec, hp, line, mono);
5277 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5279 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5280 .name = "Master Playback Switch",
5281 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5282 .info = snd_ctl_boolean_mono_info,
5283 .get = alc260_hp_master_sw_get,
5284 .put = alc260_hp_master_sw_put,
5285 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5287 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5288 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5289 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5290 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5291 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5293 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5297 static struct hda_verb alc260_hp_unsol_verbs[] = {
5298 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5302 static void alc260_hp_automute(struct hda_codec *codec)
5304 struct alc_spec *spec = codec->spec;
5306 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5307 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5310 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5312 if ((res >> 26) == ALC880_HP_EVENT)
5313 alc260_hp_automute(codec);
5316 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5318 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5319 .name = "Master Playback Switch",
5320 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5321 .info = snd_ctl_boolean_mono_info,
5322 .get = alc260_hp_master_sw_get,
5323 .put = alc260_hp_master_sw_put,
5324 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5326 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5327 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5328 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5329 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5330 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5331 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5332 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5333 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5337 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5338 .ops = &snd_hda_bind_vol,
5340 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5341 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5342 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5347 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5348 .ops = &snd_hda_bind_sw,
5350 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5351 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5356 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5357 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5358 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5359 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5364 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5365 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5369 static void alc260_hp_3013_automute(struct hda_codec *codec)
5371 struct alc_spec *spec = codec->spec;
5373 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5374 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5377 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5380 if ((res >> 26) == ALC880_HP_EVENT)
5381 alc260_hp_3013_automute(codec);
5384 static void alc260_hp_3012_automute(struct hda_codec *codec)
5386 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5388 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5390 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5392 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5396 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5399 if ((res >> 26) == ALC880_HP_EVENT)
5400 alc260_hp_3012_automute(codec);
5403 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5404 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5406 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5407 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5408 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5409 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5410 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5411 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5412 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5413 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5414 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5415 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5416 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5420 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5421 * versions of the ALC260 don't act on requests to enable mic bias from NID
5422 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5423 * datasheet doesn't mention this restriction. At this stage it's not clear
5424 * whether this behaviour is intentional or is a hardware bug in chip
5425 * revisions available in early 2006. Therefore for now allow the
5426 * "Headphone Jack Mode" control to span all choices, but if it turns out
5427 * that the lack of mic bias for this NID is intentional we could change the
5428 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5430 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5431 * don't appear to make the mic bias available from the "line" jack, even
5432 * though the NID used for this jack (0x14) can supply it. The theory is
5433 * that perhaps Acer have included blocking capacitors between the ALC260
5434 * and the output jack. If this turns out to be the case for all such
5435 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5436 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5438 * The C20x Tablet series have a mono internal speaker which is controlled
5439 * via the chip's Mono sum widget and pin complex, so include the necessary
5440 * controls for such models. On models without a "mono speaker" the control
5441 * won't do anything.
5443 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5444 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5445 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5446 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5447 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5449 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5451 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5452 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5454 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5455 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5456 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5457 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5458 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5462 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5464 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5465 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5466 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5467 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5468 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5469 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5470 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5474 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5475 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5477 static struct snd_kcontrol_new alc260_will_mixer[] = {
5478 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5479 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5480 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5481 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5482 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5483 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5484 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5485 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5486 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5487 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5491 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5492 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5494 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5495 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5496 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5498 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5499 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5500 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5501 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5502 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5503 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5504 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5509 * initialization verbs
5511 static struct hda_verb alc260_init_verbs[] = {
5512 /* Line In pin widget for input */
5513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5514 /* CD pin widget for input */
5515 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5516 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5517 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5518 /* Mic2 (front panel) pin widget for input and vref at 80% */
5519 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5520 /* LINE-2 is used for line-out in rear */
5521 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5522 /* select line-out */
5523 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5525 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5527 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5529 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5530 /* mute capture amp left and right */
5531 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5532 /* set connection select to line in (default select for this ADC) */
5533 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5534 /* mute capture amp left and right */
5535 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5536 /* set connection select to line in (default select for this ADC) */
5537 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5538 /* set vol=0 Line-Out mixer amp left and right */
5539 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5540 /* unmute pin widget amp left and right (no gain on this amp) */
5541 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5542 /* set vol=0 HP mixer amp left and right */
5543 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5544 /* unmute pin widget amp left and right (no gain on this amp) */
5545 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5546 /* set vol=0 Mono mixer amp left and right */
5547 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5548 /* unmute pin widget amp left and right (no gain on this amp) */
5549 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5550 /* unmute LINE-2 out pin */
5551 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5552 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5555 /* mute analog inputs */
5556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5560 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5561 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5562 /* mute Front out path */
5563 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5564 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5565 /* mute Headphone out path */
5566 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5567 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5568 /* mute Mono out path */
5569 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5570 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5574 #if 0 /* should be identical with alc260_init_verbs? */
5575 static struct hda_verb alc260_hp_init_verbs[] = {
5576 /* Headphone and output */
5577 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5579 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5580 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5581 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5582 /* Mic2 (front panel) pin widget for input and vref at 80% */
5583 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5584 /* Line In pin widget for input */
5585 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5586 /* Line-2 pin widget for output */
5587 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5588 /* CD pin widget for input */
5589 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5590 /* unmute amp left and right */
5591 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5592 /* set connection select to line in (default select for this ADC) */
5593 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5594 /* unmute Line-Out mixer amp left and right (volume = 0) */
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5596 /* mute pin widget amp left and right (no gain on this amp) */
5597 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5598 /* unmute HP mixer amp left and right (volume = 0) */
5599 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5600 /* mute pin widget amp left and right (no gain on this amp) */
5601 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5602 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5605 /* mute analog inputs */
5606 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5607 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5608 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5609 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5611 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5612 /* Unmute Front out path */
5613 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5615 /* Unmute Headphone out path */
5616 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5617 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5618 /* Unmute Mono out path */
5619 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5620 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5625 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5626 /* Line out and output */
5627 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5629 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5630 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5631 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5632 /* Mic2 (front panel) pin widget for input and vref at 80% */
5633 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5634 /* Line In pin widget for input */
5635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5636 /* Headphone pin widget for output */
5637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5638 /* CD pin widget for input */
5639 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5640 /* unmute amp left and right */
5641 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5642 /* set connection select to line in (default select for this ADC) */
5643 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5644 /* unmute Line-Out mixer amp left and right (volume = 0) */
5645 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5646 /* mute pin widget amp left and right (no gain on this amp) */
5647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5648 /* unmute HP mixer amp left and right (volume = 0) */
5649 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5650 /* mute pin widget amp left and right (no gain on this amp) */
5651 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5652 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5655 /* mute analog inputs */
5656 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5658 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5659 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5660 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5661 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5662 /* Unmute Front out path */
5663 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5664 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5665 /* Unmute Headphone out path */
5666 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5667 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5668 /* Unmute Mono out path */
5669 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5670 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5674 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5675 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5676 * audio = 0x16, internal speaker = 0x10.
5678 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5679 /* Disable all GPIOs */
5680 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5681 /* Internal speaker is connected to headphone pin */
5682 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5683 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5685 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5686 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5687 /* Ensure all other unused pins are disabled and muted. */
5688 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5689 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5690 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5691 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5692 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5693 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5695 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5697 /* Disable digital (SPDIF) pins */
5698 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5699 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5701 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5702 * when acting as an output.
5704 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5706 /* Start with output sum widgets muted and their output gains at min */
5707 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5708 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5709 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5710 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5711 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5712 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5713 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5714 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5715 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5717 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5718 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5719 /* Unmute Line1 pin widget output buffer since it starts as an output.
5720 * If the pin mode is changed by the user the pin mode control will
5721 * take care of enabling the pin's input/output buffers as needed.
5722 * Therefore there's no need to enable the input buffer at this
5725 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5726 /* Unmute input buffer of pin widget used for Line-in (no equiv
5729 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5731 /* Mute capture amp left and right */
5732 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5733 /* Set ADC connection select to match default mixer setting - line
5736 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5738 /* Do the same for the second ADC: mute capture input amp and
5739 * set ADC connection to line in (on mic1 pin)
5741 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5742 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5744 /* Mute all inputs to mixer widget (even unconnected ones) */
5745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5757 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5758 * similar laptops (adapted from Fujitsu init verbs).
5760 static struct hda_verb alc260_acer_init_verbs[] = {
5761 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5762 * the headphone jack. Turn this on and rely on the standard mute
5763 * methods whenever the user wants to turn these outputs off.
5765 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5766 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5767 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5768 /* Internal speaker/Headphone jack is connected to Line-out pin */
5769 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5770 /* Internal microphone/Mic jack is connected to Mic1 pin */
5771 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5772 /* Line In jack is connected to Line1 pin */
5773 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5774 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5775 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5776 /* Ensure all other unused pins are disabled and muted. */
5777 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5778 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5779 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5780 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5782 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5783 /* Disable digital (SPDIF) pins */
5784 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5785 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5787 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5788 * bus when acting as outputs.
5790 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5791 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5793 /* Start with output sum widgets muted and their output gains at min */
5794 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5795 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5796 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5797 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5798 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5799 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5800 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5801 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5802 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5804 /* Unmute Line-out pin widget amp left and right
5805 * (no equiv mixer ctrl)
5807 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5808 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5809 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5810 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5811 * inputs. If the pin mode is changed by the user the pin mode control
5812 * will take care of enabling the pin's input/output buffers as needed.
5813 * Therefore there's no need to enable the input buffer at this
5816 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5817 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5819 /* Mute capture amp left and right */
5820 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5821 /* Set ADC connection select to match default mixer setting - mic
5824 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5826 /* Do similar with the second ADC: mute capture input amp and
5827 * set ADC connection to mic to match ALSA's default state.
5829 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5830 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5832 /* Mute all inputs to mixer widget (even unconnected ones) */
5833 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5834 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5835 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5836 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5837 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5838 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5839 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5840 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5845 /* Initialisation sequence for Maxdata Favorit 100XS
5846 * (adapted from Acer init verbs).
5848 static struct hda_verb alc260_favorit100_init_verbs[] = {
5849 /* GPIO 0 enables the output jack.
5850 * Turn this on and rely on the standard mute
5851 * methods whenever the user wants to turn these outputs off.
5853 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5854 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5855 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5856 /* Line/Mic input jack is connected to Mic1 pin */
5857 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5858 /* Ensure all other unused pins are disabled and muted. */
5859 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5860 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5861 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5862 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5863 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5864 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5865 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5866 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5867 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5868 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5869 /* Disable digital (SPDIF) pins */
5870 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5871 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5873 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5874 * bus when acting as outputs.
5876 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5877 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5879 /* Start with output sum widgets muted and their output gains at min */
5880 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5881 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5882 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5883 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5884 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5885 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5886 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5887 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5888 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5890 /* Unmute Line-out pin widget amp left and right
5891 * (no equiv mixer ctrl)
5893 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5894 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5895 * inputs. If the pin mode is changed by the user the pin mode control
5896 * will take care of enabling the pin's input/output buffers as needed.
5897 * Therefore there's no need to enable the input buffer at this
5900 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5902 /* Mute capture amp left and right */
5903 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5904 /* Set ADC connection select to match default mixer setting - mic
5907 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5909 /* Do similar with the second ADC: mute capture input amp and
5910 * set ADC connection to mic to match ALSA's default state.
5912 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5913 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5915 /* Mute all inputs to mixer widget (even unconnected ones) */
5916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5921 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5922 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5923 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5928 static struct hda_verb alc260_will_verbs[] = {
5929 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5930 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5931 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5932 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5933 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5934 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5938 static struct hda_verb alc260_replacer_672v_verbs[] = {
5939 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5940 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5941 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5943 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5944 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5945 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5947 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5951 /* toggle speaker-output according to the hp-jack state */
5952 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5954 unsigned int present;
5956 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5957 present = snd_hda_jack_detect(codec, 0x0f);
5959 snd_hda_codec_write_cache(codec, 0x01, 0,
5960 AC_VERB_SET_GPIO_DATA, 1);
5961 snd_hda_codec_write_cache(codec, 0x0f, 0,
5962 AC_VERB_SET_PIN_WIDGET_CONTROL,
5965 snd_hda_codec_write_cache(codec, 0x01, 0,
5966 AC_VERB_SET_GPIO_DATA, 0);
5967 snd_hda_codec_write_cache(codec, 0x0f, 0,
5968 AC_VERB_SET_PIN_WIDGET_CONTROL,
5973 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5976 if ((res >> 26) == ALC880_HP_EVENT)
5977 alc260_replacer_672v_automute(codec);
5980 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5981 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5982 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5983 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5984 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5985 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5987 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5988 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5989 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5990 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5994 /* Test configuration for debugging, modelled after the ALC880 test
5997 #ifdef CONFIG_SND_DEBUG
5998 static hda_nid_t alc260_test_dac_nids[1] = {
6001 static hda_nid_t alc260_test_adc_nids[2] = {
6004 /* For testing the ALC260, each input MUX needs its own definition since
6005 * the signal assignments are different. This assumes that the first ADC
6008 static struct hda_input_mux alc260_test_capture_sources[2] = {
6012 { "MIC1 pin", 0x0 },
6013 { "MIC2 pin", 0x1 },
6014 { "LINE1 pin", 0x2 },
6015 { "LINE2 pin", 0x3 },
6017 { "LINE-OUT pin", 0x5 },
6018 { "HP-OUT pin", 0x6 },
6024 { "MIC1 pin", 0x0 },
6025 { "MIC2 pin", 0x1 },
6026 { "LINE1 pin", 0x2 },
6027 { "LINE2 pin", 0x3 },
6030 { "LINE-OUT pin", 0x6 },
6031 { "HP-OUT pin", 0x7 },
6035 static struct snd_kcontrol_new alc260_test_mixer[] = {
6036 /* Output driver widgets */
6037 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6038 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6039 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6040 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6041 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6042 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6044 /* Modes for retasking pin widgets
6045 * Note: the ALC260 doesn't seem to act on requests to enable mic
6046 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6047 * mention this restriction. At this stage it's not clear whether
6048 * this behaviour is intentional or is a hardware bug in chip
6049 * revisions available at least up until early 2006. Therefore for
6050 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6051 * choices, but if it turns out that the lack of mic bias for these
6052 * NIDs is intentional we could change their modes from
6053 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6055 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6056 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6057 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6058 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6059 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6060 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6062 /* Loopback mixer controls */
6063 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6064 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6065 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6066 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6067 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6068 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6069 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6070 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6071 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6072 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6073 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6074 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6075 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6076 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6078 /* Controls for GPIO pins, assuming they are configured as outputs */
6079 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6080 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6081 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6082 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6084 /* Switches to allow the digital IO pins to be enabled. The datasheet
6085 * is ambigious as to which NID is which; testing on laptops which
6086 * make this output available should provide clarification.
6088 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6089 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6091 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6092 * this output to turn on an external amplifier.
6094 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6095 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6099 static struct hda_verb alc260_test_init_verbs[] = {
6100 /* Enable all GPIOs as outputs with an initial value of 0 */
6101 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6102 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6103 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6105 /* Enable retasking pins as output, initially without power amp */
6106 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6107 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6108 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6109 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6110 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6111 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6113 /* Disable digital (SPDIF) pins initially, but users can enable
6114 * them via a mixer switch. In the case of SPDIF-out, this initverb
6115 * payload also sets the generation to 0, output to be in "consumer"
6116 * PCM format, copyright asserted, no pre-emphasis and no validity
6119 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6120 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6122 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6123 * OUT1 sum bus when acting as an output.
6125 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6126 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6127 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6128 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6130 /* Start with output sum widgets muted and their output gains at min */
6131 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6132 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6133 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6134 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6135 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6136 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6137 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6138 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6139 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6141 /* Unmute retasking pin widget output buffers since the default
6142 * state appears to be output. As the pin mode is changed by the
6143 * user the pin mode control will take care of enabling the pin's
6144 * input/output buffers as needed.
6146 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6147 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6148 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6150 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6151 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6152 /* Also unmute the mono-out pin widget */
6153 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6155 /* Mute capture amp left and right */
6156 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6157 /* Set ADC connection select to match default mixer setting (mic1
6160 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6162 /* Do the same for the second ADC: mute capture input amp and
6163 * set ADC connection to mic1 pin
6165 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6166 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6168 /* Mute all inputs to mixer widget (even unconnected ones) */
6169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6170 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6174 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6175 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6176 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6182 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6183 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6185 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6186 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6189 * for BIOS auto-configuration
6192 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6193 const char *pfx, int *vol_bits)
6196 unsigned long vol_val, sw_val;
6199 if (nid >= 0x0f && nid < 0x11) {
6200 nid_vol = nid - 0x7;
6201 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6202 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6203 } else if (nid == 0x11) {
6204 nid_vol = nid - 0x7;
6205 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6206 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6207 } else if (nid >= 0x12 && nid <= 0x15) {
6209 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6210 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6214 if (!(*vol_bits & (1 << nid_vol))) {
6215 /* first control for the volume widget */
6216 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6219 *vol_bits |= (1 << nid_vol);
6221 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6227 /* add playback controls from the parsed DAC table */
6228 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6229 const struct auto_pin_cfg *cfg)
6235 spec->multiout.num_dacs = 1;
6236 spec->multiout.dac_nids = spec->private_dac_nids;
6237 spec->multiout.dac_nids[0] = 0x02;
6239 nid = cfg->line_out_pins[0];
6242 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6244 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6248 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6253 nid = cfg->speaker_pins[0];
6255 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6260 nid = cfg->hp_pins[0];
6262 err = alc260_add_playback_controls(spec, nid, "Headphone",
6270 /* create playback/capture controls for input pins */
6271 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6272 const struct auto_pin_cfg *cfg)
6274 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6277 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6278 hda_nid_t nid, int pin_type,
6281 alc_set_pin_output(codec, nid, pin_type);
6282 /* need the manual connection? */
6284 int idx = nid - 0x12;
6285 snd_hda_codec_write(codec, idx + 0x0b, 0,
6286 AC_VERB_SET_CONNECT_SEL, sel_idx);
6290 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6292 struct alc_spec *spec = codec->spec;
6295 nid = spec->autocfg.line_out_pins[0];
6297 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6298 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6301 nid = spec->autocfg.speaker_pins[0];
6303 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6305 nid = spec->autocfg.hp_pins[0];
6307 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6310 #define ALC260_PIN_CD_NID 0x16
6311 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6313 struct alc_spec *spec = codec->spec;
6316 for (i = 0; i < AUTO_PIN_LAST; i++) {
6317 hda_nid_t nid = spec->autocfg.input_pins[i];
6319 alc_set_input_pin(codec, nid, i);
6320 if (nid != ALC260_PIN_CD_NID &&
6321 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6322 snd_hda_codec_write(codec, nid, 0,
6323 AC_VERB_SET_AMP_GAIN_MUTE,
6330 * generic initialization of ADC, input mixers and output mixers
6332 static struct hda_verb alc260_volume_init_verbs[] = {
6334 * Unmute ADC0-1 and set the default input to mic-in
6336 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6337 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6338 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6339 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6341 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6343 * Note: PASD motherboards uses the Line In 2 as the input for
6344 * front panel mic (mic 2)
6346 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6347 /* mute analog inputs */
6348 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6352 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6355 * Set up output mixers (0x08 - 0x0a)
6357 /* set vol=0 to output mixers */
6358 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6359 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6360 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6361 /* set up input amps for analog loopback */
6362 /* Amp Indices: DAC = 0, mixer = 1 */
6363 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6364 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6365 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6366 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6367 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6368 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6373 static int alc260_parse_auto_config(struct hda_codec *codec)
6375 struct alc_spec *spec = codec->spec;
6377 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6379 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6383 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6386 if (!spec->kctls.list)
6387 return 0; /* can't find valid BIOS pin config */
6388 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6392 spec->multiout.max_channels = 2;
6394 if (spec->autocfg.dig_outs)
6395 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6396 if (spec->kctls.list)
6397 add_mixer(spec, spec->kctls.list);
6399 add_verb(spec, alc260_volume_init_verbs);
6401 spec->num_mux_defs = 1;
6402 spec->input_mux = &spec->private_imux[0];
6404 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6409 /* additional initialization for auto-configuration model */
6410 static void alc260_auto_init(struct hda_codec *codec)
6412 struct alc_spec *spec = codec->spec;
6413 alc260_auto_init_multi_out(codec);
6414 alc260_auto_init_analog_input(codec);
6415 if (spec->unsol_event)
6416 alc_inithook(codec);
6419 #ifdef CONFIG_SND_HDA_POWER_SAVE
6420 static struct hda_amp_list alc260_loopbacks[] = {
6421 { 0x07, HDA_INPUT, 0 },
6422 { 0x07, HDA_INPUT, 1 },
6423 { 0x07, HDA_INPUT, 2 },
6424 { 0x07, HDA_INPUT, 3 },
6425 { 0x07, HDA_INPUT, 4 },
6431 * ALC260 configurations
6433 static const char *alc260_models[ALC260_MODEL_LAST] = {
6434 [ALC260_BASIC] = "basic",
6436 [ALC260_HP_3013] = "hp-3013",
6437 [ALC260_HP_DC7600] = "hp-dc7600",
6438 [ALC260_FUJITSU_S702X] = "fujitsu",
6439 [ALC260_ACER] = "acer",
6440 [ALC260_WILL] = "will",
6441 [ALC260_REPLACER_672V] = "replacer",
6442 [ALC260_FAVORIT100] = "favorit100",
6443 #ifdef CONFIG_SND_DEBUG
6444 [ALC260_TEST] = "test",
6446 [ALC260_AUTO] = "auto",
6449 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6450 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6451 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6452 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6453 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6454 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6455 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6456 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6457 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6458 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6459 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6460 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6461 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6462 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6463 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6464 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6465 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6466 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6467 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6468 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6469 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6473 static struct alc_config_preset alc260_presets[] = {
6475 .mixers = { alc260_base_output_mixer,
6476 alc260_input_mixer },
6477 .init_verbs = { alc260_init_verbs },
6478 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6479 .dac_nids = alc260_dac_nids,
6480 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6481 .adc_nids = alc260_dual_adc_nids,
6482 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6483 .channel_mode = alc260_modes,
6484 .input_mux = &alc260_capture_source,
6487 .mixers = { alc260_hp_output_mixer,
6488 alc260_input_mixer },
6489 .init_verbs = { alc260_init_verbs,
6490 alc260_hp_unsol_verbs },
6491 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6492 .dac_nids = alc260_dac_nids,
6493 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6494 .adc_nids = alc260_adc_nids_alt,
6495 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6496 .channel_mode = alc260_modes,
6497 .input_mux = &alc260_capture_source,
6498 .unsol_event = alc260_hp_unsol_event,
6499 .init_hook = alc260_hp_automute,
6501 [ALC260_HP_DC7600] = {
6502 .mixers = { alc260_hp_dc7600_mixer,
6503 alc260_input_mixer },
6504 .init_verbs = { alc260_init_verbs,
6505 alc260_hp_dc7600_verbs },
6506 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6507 .dac_nids = alc260_dac_nids,
6508 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6509 .adc_nids = alc260_adc_nids_alt,
6510 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6511 .channel_mode = alc260_modes,
6512 .input_mux = &alc260_capture_source,
6513 .unsol_event = alc260_hp_3012_unsol_event,
6514 .init_hook = alc260_hp_3012_automute,
6516 [ALC260_HP_3013] = {
6517 .mixers = { alc260_hp_3013_mixer,
6518 alc260_input_mixer },
6519 .init_verbs = { alc260_hp_3013_init_verbs,
6520 alc260_hp_3013_unsol_verbs },
6521 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6522 .dac_nids = alc260_dac_nids,
6523 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6524 .adc_nids = alc260_adc_nids_alt,
6525 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6526 .channel_mode = alc260_modes,
6527 .input_mux = &alc260_capture_source,
6528 .unsol_event = alc260_hp_3013_unsol_event,
6529 .init_hook = alc260_hp_3013_automute,
6531 [ALC260_FUJITSU_S702X] = {
6532 .mixers = { alc260_fujitsu_mixer },
6533 .init_verbs = { alc260_fujitsu_init_verbs },
6534 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6535 .dac_nids = alc260_dac_nids,
6536 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6537 .adc_nids = alc260_dual_adc_nids,
6538 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6539 .channel_mode = alc260_modes,
6540 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6541 .input_mux = alc260_fujitsu_capture_sources,
6544 .mixers = { alc260_acer_mixer },
6545 .init_verbs = { alc260_acer_init_verbs },
6546 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6547 .dac_nids = alc260_dac_nids,
6548 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6549 .adc_nids = alc260_dual_adc_nids,
6550 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6551 .channel_mode = alc260_modes,
6552 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6553 .input_mux = alc260_acer_capture_sources,
6555 [ALC260_FAVORIT100] = {
6556 .mixers = { alc260_favorit100_mixer },
6557 .init_verbs = { alc260_favorit100_init_verbs },
6558 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6559 .dac_nids = alc260_dac_nids,
6560 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6561 .adc_nids = alc260_dual_adc_nids,
6562 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6563 .channel_mode = alc260_modes,
6564 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6565 .input_mux = alc260_favorit100_capture_sources,
6568 .mixers = { alc260_will_mixer },
6569 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6570 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6571 .dac_nids = alc260_dac_nids,
6572 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6573 .adc_nids = alc260_adc_nids,
6574 .dig_out_nid = ALC260_DIGOUT_NID,
6575 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6576 .channel_mode = alc260_modes,
6577 .input_mux = &alc260_capture_source,
6579 [ALC260_REPLACER_672V] = {
6580 .mixers = { alc260_replacer_672v_mixer },
6581 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6582 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6583 .dac_nids = alc260_dac_nids,
6584 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6585 .adc_nids = alc260_adc_nids,
6586 .dig_out_nid = ALC260_DIGOUT_NID,
6587 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6588 .channel_mode = alc260_modes,
6589 .input_mux = &alc260_capture_source,
6590 .unsol_event = alc260_replacer_672v_unsol_event,
6591 .init_hook = alc260_replacer_672v_automute,
6593 #ifdef CONFIG_SND_DEBUG
6595 .mixers = { alc260_test_mixer },
6596 .init_verbs = { alc260_test_init_verbs },
6597 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6598 .dac_nids = alc260_test_dac_nids,
6599 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6600 .adc_nids = alc260_test_adc_nids,
6601 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6602 .channel_mode = alc260_modes,
6603 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6604 .input_mux = alc260_test_capture_sources,
6609 static int patch_alc260(struct hda_codec *codec)
6611 struct alc_spec *spec;
6612 int err, board_config;
6614 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6620 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6623 if (board_config < 0) {
6624 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6626 board_config = ALC260_AUTO;
6629 if (board_config == ALC260_AUTO) {
6630 /* automatic parse from the BIOS config */
6631 err = alc260_parse_auto_config(codec);
6637 "hda_codec: Cannot set up configuration "
6638 "from BIOS. Using base mode...\n");
6639 board_config = ALC260_BASIC;
6643 err = snd_hda_attach_beep_device(codec, 0x1);
6649 if (board_config != ALC260_AUTO)
6650 setup_preset(codec, &alc260_presets[board_config]);
6652 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6653 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6655 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6656 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6658 if (!spec->adc_nids && spec->input_mux) {
6659 /* check whether NID 0x04 is valid */
6660 unsigned int wcap = get_wcaps(codec, 0x04);
6661 wcap = get_wcaps_type(wcap);
6663 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6664 spec->adc_nids = alc260_adc_nids_alt;
6665 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6667 spec->adc_nids = alc260_adc_nids;
6668 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6671 set_capture_mixer(codec);
6672 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6674 spec->vmaster_nid = 0x08;
6676 codec->patch_ops = alc_patch_ops;
6677 if (board_config == ALC260_AUTO)
6678 spec->init_hook = alc260_auto_init;
6679 #ifdef CONFIG_SND_HDA_POWER_SAVE
6680 if (!spec->loopback.amplist)
6681 spec->loopback.amplist = alc260_loopbacks;
6689 * ALC882/883/885/888/889 support
6691 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6692 * configuration. Each pin widget can choose any input DACs and a mixer.
6693 * Each ADC is connected from a mixer of all inputs. This makes possible
6694 * 6-channel independent captures.
6696 * In addition, an independent DAC for the multi-playback (not used in this
6699 #define ALC882_DIGOUT_NID 0x06
6700 #define ALC882_DIGIN_NID 0x0a
6701 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6702 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6703 #define ALC1200_DIGOUT_NID 0x10
6706 static struct hda_channel_mode alc882_ch_modes[1] = {
6711 static hda_nid_t alc882_dac_nids[4] = {
6712 /* front, rear, clfe, rear_surr */
6713 0x02, 0x03, 0x04, 0x05
6715 #define alc883_dac_nids alc882_dac_nids
6718 #define alc882_adc_nids alc880_adc_nids
6719 #define alc882_adc_nids_alt alc880_adc_nids_alt
6720 #define alc883_adc_nids alc882_adc_nids_alt
6721 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6722 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6723 #define alc889_adc_nids alc880_adc_nids
6725 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6726 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6727 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6728 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6729 #define alc889_capsrc_nids alc882_capsrc_nids
6732 /* FIXME: should be a matrix-type input source selection */
6734 static struct hda_input_mux alc882_capture_source = {
6738 { "Front Mic", 0x1 },
6744 #define alc883_capture_source alc882_capture_source
6746 static struct hda_input_mux alc889_capture_source = {
6749 { "Front Mic", 0x0 },
6755 static struct hda_input_mux mb5_capture_source = {
6764 static struct hda_input_mux macmini3_capture_source = {
6772 static struct hda_input_mux alc883_3stack_6ch_intel = {
6776 { "Front Mic", 0x0 },
6782 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6790 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6800 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6808 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6812 { "Front Mic", 0x1 },
6817 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6825 static struct hda_input_mux alc889A_mb31_capture_source = {
6829 /* Front Mic (0x01) unused */
6831 /* Line 2 (0x03) unused */
6832 /* CD (0x04) unused? */
6839 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6846 static struct hda_verb alc882_3ST_ch2_init[] = {
6847 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6848 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6857 static struct hda_verb alc882_3ST_ch4_init[] = {
6858 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6859 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6860 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6861 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6862 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6869 static struct hda_verb alc882_3ST_ch6_init[] = {
6870 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6871 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6872 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6873 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6874 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6875 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6879 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6880 { 2, alc882_3ST_ch2_init },
6881 { 4, alc882_3ST_ch4_init },
6882 { 6, alc882_3ST_ch6_init },
6885 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6890 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6891 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6892 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6893 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6894 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6895 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6902 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6903 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6904 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6905 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6906 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6907 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6908 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6915 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6916 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6917 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6918 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6919 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6920 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6921 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6922 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6926 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6927 { 2, alc883_3ST_ch2_clevo_init },
6928 { 4, alc883_3ST_ch4_clevo_init },
6929 { 6, alc883_3ST_ch6_clevo_init },
6936 static struct hda_verb alc882_sixstack_ch6_init[] = {
6937 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6938 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6939 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6940 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6947 static struct hda_verb alc882_sixstack_ch8_init[] = {
6948 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6949 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6950 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6951 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6955 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6956 { 6, alc882_sixstack_ch6_init },
6957 { 8, alc882_sixstack_ch8_init },
6961 /* Macbook Air 2,1 */
6963 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
6968 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6974 static struct hda_verb alc885_mbp_ch2_init[] = {
6975 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6976 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6977 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6984 static struct hda_verb alc885_mbp_ch4_init[] = {
6985 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6986 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6987 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6988 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6989 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6993 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6994 { 2, alc885_mbp_ch2_init },
6995 { 4, alc885_mbp_ch4_init },
7000 * Speakers/Woofer/HP = Front
7003 static struct hda_verb alc885_mb5_ch2_init[] = {
7004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7011 * Speakers/HP = Front
7015 static struct hda_verb alc885_mb5_ch6_init[] = {
7016 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7018 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7022 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7023 { 2, alc885_mb5_ch2_init },
7024 { 6, alc885_mb5_ch6_init },
7027 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7032 static struct hda_verb alc883_4ST_ch2_init[] = {
7033 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7034 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7035 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7036 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7037 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7038 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7045 static struct hda_verb alc883_4ST_ch4_init[] = {
7046 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7047 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7048 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7049 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7050 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7051 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7052 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7059 static struct hda_verb alc883_4ST_ch6_init[] = {
7060 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7061 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7062 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7063 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7064 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7065 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7066 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7067 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7074 static struct hda_verb alc883_4ST_ch8_init[] = {
7075 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7076 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7077 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7078 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7079 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7080 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7081 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7082 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7083 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7087 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7088 { 2, alc883_4ST_ch2_init },
7089 { 4, alc883_4ST_ch4_init },
7090 { 6, alc883_4ST_ch6_init },
7091 { 8, alc883_4ST_ch8_init },
7098 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7099 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7100 { 0x19, 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_3ST_ch4_intel_init[] = {
7110 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7111 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7112 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7113 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7114 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7121 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7122 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7123 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7124 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7125 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7126 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7127 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7131 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7132 { 2, alc883_3ST_ch2_intel_init },
7133 { 4, alc883_3ST_ch4_intel_init },
7134 { 6, alc883_3ST_ch6_intel_init },
7140 static struct hda_verb alc889_ch2_intel_init[] = {
7141 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7142 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7143 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7144 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7145 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7146 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7153 static struct hda_verb alc889_ch6_intel_init[] = {
7154 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7155 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7156 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7157 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7158 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7159 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7166 static struct hda_verb alc889_ch8_intel_init[] = {
7167 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7168 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7169 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7170 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7171 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7172 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7173 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7177 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7178 { 2, alc889_ch2_intel_init },
7179 { 6, alc889_ch6_intel_init },
7180 { 8, alc889_ch8_intel_init },
7186 static struct hda_verb alc883_sixstack_ch6_init[] = {
7187 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7188 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7189 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7190 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7197 static struct hda_verb alc883_sixstack_ch8_init[] = {
7198 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7199 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7200 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7201 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7205 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7206 { 6, alc883_sixstack_ch6_init },
7207 { 8, alc883_sixstack_ch8_init },
7211 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7212 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7214 static struct snd_kcontrol_new alc882_base_mixer[] = {
7215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7216 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7217 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7218 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7219 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7220 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7221 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7222 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7223 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7224 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7225 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7226 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7227 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7228 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7229 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7231 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7233 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7234 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7235 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7239 /* Macbook Air 2,1 same control for HP and internal Speaker */
7241 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7242 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7243 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7248 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7249 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7250 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7251 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7252 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7253 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7254 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7255 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7257 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7258 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7259 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7263 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7264 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7265 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7266 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7267 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7268 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7269 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7270 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7271 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7272 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7273 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7274 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7275 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7276 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7277 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7281 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7282 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7283 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7284 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7285 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7286 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7287 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7288 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7289 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7290 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7291 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7292 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7296 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7297 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7298 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7299 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7300 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7301 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7302 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7304 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7305 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7310 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7312 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7315 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7316 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7318 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7323 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7324 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7325 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7326 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7327 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7328 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7329 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7330 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7333 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7334 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7335 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7336 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7340 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7341 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7343 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7344 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7345 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7346 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7347 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7349 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7352 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7353 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7356 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7360 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7361 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7362 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7363 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7364 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7365 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7366 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7367 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7369 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7370 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7374 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7376 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7377 .name = "Channel Mode",
7378 .info = alc_ch_mode_info,
7379 .get = alc_ch_mode_get,
7380 .put = alc_ch_mode_put,
7385 static struct hda_verb alc882_base_init_verbs[] = {
7386 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7387 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7388 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7390 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7393 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7396 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7397 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7399 /* Front Pin: output 0 (0x0c) */
7400 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7401 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7402 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7403 /* Rear Pin: output 1 (0x0d) */
7404 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7405 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7406 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7407 /* CLFE Pin: output 2 (0x0e) */
7408 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7409 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7410 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7411 /* Side Pin: output 3 (0x0f) */
7412 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7413 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7414 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7415 /* Mic (rear) pin: input vref at 80% */
7416 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7417 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7418 /* Front Mic pin: input vref at 80% */
7419 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7420 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7421 /* Line In pin: input */
7422 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7423 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7424 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7425 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7426 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7427 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7428 /* CD pin widget for input */
7429 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7431 /* FIXME: use matrix-type input source selection */
7432 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7434 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7436 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7437 /* ADC2: mute amp left and right */
7438 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7439 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7440 /* ADC3: mute amp left and right */
7441 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7442 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7447 static struct hda_verb alc882_adc1_init_verbs[] = {
7448 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7453 /* ADC1: mute amp left and right */
7454 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7455 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7459 static struct hda_verb alc882_eapd_verbs[] = {
7460 /* change to EAPD mode */
7461 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7462 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7466 static struct hda_verb alc889_eapd_verbs[] = {
7467 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7468 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7472 static struct hda_verb alc_hp15_unsol_verbs[] = {
7473 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7478 static struct hda_verb alc885_init_verbs[] = {
7479 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7480 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7481 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7483 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7484 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7486 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7487 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7489 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7490 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7492 /* Front HP Pin: output 0 (0x0c) */
7493 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7495 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7496 /* Front Pin: output 0 (0x0c) */
7497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7498 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7499 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7500 /* Rear Pin: output 1 (0x0d) */
7501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7503 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7504 /* CLFE Pin: output 2 (0x0e) */
7505 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7506 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7507 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7508 /* Side Pin: output 3 (0x0f) */
7509 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7510 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7511 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7512 /* Mic (rear) pin: input vref at 80% */
7513 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7514 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7515 /* Front Mic pin: input vref at 80% */
7516 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7517 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7518 /* Line In pin: input */
7519 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7520 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7522 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7524 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7529 /* ADC2: mute amp left and right */
7530 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7531 /* ADC3: mute amp left and right */
7532 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7537 static struct hda_verb alc885_init_input_verbs[] = {
7538 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7539 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7540 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7545 /* Unmute Selector 24h and set the default input to front mic */
7546 static struct hda_verb alc889_init_input_verbs[] = {
7547 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7548 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7553 #define alc883_init_verbs alc882_base_init_verbs
7556 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7557 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7558 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7560 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7561 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7562 /* FIXME: this looks suspicious...
7563 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7564 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7569 static struct hda_verb alc882_macpro_init_verbs[] = {
7570 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7572 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7573 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7574 /* Front Pin: output 0 (0x0c) */
7575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7577 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7578 /* Front Mic pin: input vref at 80% */
7579 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7580 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7581 /* Speaker: output */
7582 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7583 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7584 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7585 /* Headphone output (output 0 - 0x0c) */
7586 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7587 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7588 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7590 /* FIXME: use matrix-type input source selection */
7591 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7592 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7596 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7598 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7599 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7600 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7603 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7605 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7606 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7607 /* ADC1: mute amp left and right */
7608 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7609 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7610 /* ADC2: mute amp left and right */
7611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7612 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7613 /* ADC3: mute amp left and right */
7614 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7615 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7621 static struct hda_verb alc885_mb5_init_verbs[] = {
7623 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7624 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7625 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7626 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7630 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7631 /* Surround mixer */
7632 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7633 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7634 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7636 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7638 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7640 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7641 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7642 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7643 /* Front Pin (0x0c) */
7644 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7646 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7647 /* LFE Pin (0x0e) */
7648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7649 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7650 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7653 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7654 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7655 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7656 /* Front Mic pin: input vref at 80% */
7657 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7658 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7671 static struct hda_verb alc885_macmini3_init_verbs[] = {
7673 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7674 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7675 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7676 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7678 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7681 /* Surround mixer */
7682 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7683 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7684 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7686 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7687 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7688 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7690 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7691 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7692 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7693 /* Front Pin (0x0c) */
7694 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7695 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7696 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7697 /* LFE Pin (0x0e) */
7698 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7699 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7700 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7703 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7704 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7705 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7707 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7708 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7710 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7711 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7712 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7713 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7718 static struct hda_verb alc885_mba21_init_verbs[] = {
7719 /*Internal and HP Speaker Mixer*/
7720 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7723 /*Internal Speaker Pin (0x0c)*/
7724 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7725 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7726 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7727 /* HP Pin: output 0 (0x0e) */
7728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7729 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7730 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7731 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7732 /* Line in (is hp when jack connected)*/
7733 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7734 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7740 /* Macbook Pro rev3 */
7741 static struct hda_verb alc885_mbp3_init_verbs[] = {
7742 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7748 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7749 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7751 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7752 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7754 /* Front Pin: output 0 (0x0c) */
7755 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7756 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7757 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7758 /* HP Pin: output 0 (0x0e) */
7759 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7760 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7761 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7762 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7763 /* Mic (rear) pin: input vref at 80% */
7764 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7765 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7766 /* Front Mic pin: input vref at 80% */
7767 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7768 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7769 /* Line In pin: use output 1 when in LineOut mode */
7770 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7771 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7772 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7774 /* FIXME: use matrix-type input source selection */
7775 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7776 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7779 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7780 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7785 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7791 /* ADC1: mute amp left and right */
7792 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7793 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7794 /* ADC2: mute amp left and right */
7795 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7796 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7797 /* ADC3: mute amp left and right */
7798 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7799 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7805 static struct hda_verb alc885_imac91_init_verbs[] = {
7806 /* Line-Out 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)},
7814 /* HP Pin: output 0 (0x0c) */
7815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7816 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7817 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7818 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7819 /* Internal Speakers: output 0 (0x0d) */
7820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7821 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7822 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7823 /* Mic (rear) pin: input vref at 80% */
7824 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7826 /* Front Mic pin: input vref at 80% */
7827 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7828 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7829 /* Line In pin: use output 1 when in LineOut mode */
7830 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7832 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7834 /* FIXME: use matrix-type input source selection */
7835 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7836 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7838 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7839 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7840 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7843 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7844 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7845 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7848 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7849 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7850 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7851 /* ADC1: mute amp left and right */
7852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7853 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7854 /* ADC2: mute amp left and right */
7855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7856 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7857 /* ADC3: mute amp left and right */
7858 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7859 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7864 /* iMac 24 mixer. */
7865 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7866 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7867 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7871 /* iMac 24 init verbs. */
7872 static struct hda_verb alc885_imac24_init_verbs[] = {
7873 /* Internal speakers: output 0 (0x0c) */
7874 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7876 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7877 /* Internal speakers: output 0 (0x0c) */
7878 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7879 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7880 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7881 /* Headphone: output 0 (0x0c) */
7882 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7883 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7884 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7885 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7886 /* Front Mic: input vref at 80% */
7887 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7888 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7892 /* Toggle speaker-output according to the hp-jack state */
7893 static void alc885_imac24_setup(struct hda_codec *codec)
7895 struct alc_spec *spec = codec->spec;
7897 spec->autocfg.hp_pins[0] = 0x14;
7898 spec->autocfg.speaker_pins[0] = 0x18;
7899 spec->autocfg.speaker_pins[1] = 0x1a;
7902 #define alc885_mb5_setup alc885_imac24_setup
7903 #define alc885_macmini3_setup alc885_imac24_setup
7905 /* Macbook Air 2,1 */
7906 static void alc885_mba21_setup(struct hda_codec *codec)
7908 struct alc_spec *spec = codec->spec;
7910 spec->autocfg.hp_pins[0] = 0x14;
7911 spec->autocfg.speaker_pins[0] = 0x18;
7916 static void alc885_mbp3_setup(struct hda_codec *codec)
7918 struct alc_spec *spec = codec->spec;
7920 spec->autocfg.hp_pins[0] = 0x15;
7921 spec->autocfg.speaker_pins[0] = 0x14;
7924 static void alc885_imac91_setup(struct hda_codec *codec)
7926 struct alc_spec *spec = codec->spec;
7928 spec->autocfg.hp_pins[0] = 0x14;
7929 spec->autocfg.speaker_pins[0] = 0x15;
7930 spec->autocfg.speaker_pins[1] = 0x1a;
7933 static struct hda_verb alc882_targa_verbs[] = {
7934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7938 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7940 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7941 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7942 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7944 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7948 /* toggle speaker-output according to the hp-jack state */
7949 static void alc882_targa_automute(struct hda_codec *codec)
7951 struct alc_spec *spec = codec->spec;
7952 alc_automute_amp(codec);
7953 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7954 spec->jack_present ? 1 : 3);
7957 static void alc882_targa_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] = 0x1b;
7965 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7967 if ((res >> 26) == ALC880_HP_EVENT)
7968 alc882_targa_automute(codec);
7971 static struct hda_verb alc882_asus_a7j_verbs[] = {
7972 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7973 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7975 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7976 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7977 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7979 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7980 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7981 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7983 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7984 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7985 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7989 static struct hda_verb alc882_asus_a7m_verbs[] = {
7990 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7991 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7993 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7994 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7995 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7997 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7998 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7999 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8001 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8002 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8003 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8007 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8009 unsigned int gpiostate, gpiomask, gpiodir;
8011 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8012 AC_VERB_GET_GPIO_DATA, 0);
8015 gpiostate |= (1 << pin);
8017 gpiostate &= ~(1 << pin);
8019 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8020 AC_VERB_GET_GPIO_MASK, 0);
8021 gpiomask |= (1 << pin);
8023 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8024 AC_VERB_GET_GPIO_DIRECTION, 0);
8025 gpiodir |= (1 << pin);
8028 snd_hda_codec_write(codec, codec->afg, 0,
8029 AC_VERB_SET_GPIO_MASK, gpiomask);
8030 snd_hda_codec_write(codec, codec->afg, 0,
8031 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8035 snd_hda_codec_write(codec, codec->afg, 0,
8036 AC_VERB_SET_GPIO_DATA, gpiostate);
8039 /* set up GPIO at initialization */
8040 static void alc885_macpro_init_hook(struct hda_codec *codec)
8042 alc882_gpio_mute(codec, 0, 0);
8043 alc882_gpio_mute(codec, 1, 0);
8046 /* set up GPIO and update auto-muting at initialization */
8047 static void alc885_imac24_init_hook(struct hda_codec *codec)
8049 alc885_macpro_init_hook(codec);
8050 alc_automute_amp(codec);
8054 * generic initialization of ADC, input mixers and output mixers
8056 static struct hda_verb alc883_auto_init_verbs[] = {
8058 * Unmute ADC0-2 and set the default input to mic-in
8060 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8061 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8062 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8063 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8066 * Set up output mixers (0x0c - 0x0f)
8068 /* set vol=0 to output mixers */
8069 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8070 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8071 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8072 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8073 /* set up input amps for analog loopback */
8074 /* Amp Indices: DAC = 0, mixer = 1 */
8075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8079 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8083 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8084 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8086 /* FIXME: use matrix-type input source selection */
8087 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8089 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8095 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8096 static struct hda_verb alc889A_mb31_ch2_init[] = {
8097 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8098 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8099 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8100 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8104 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8105 static struct hda_verb alc889A_mb31_ch4_init[] = {
8106 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8107 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8108 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8109 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8113 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8114 static struct hda_verb alc889A_mb31_ch5_init[] = {
8115 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8116 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8117 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8118 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8122 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8123 static struct hda_verb alc889A_mb31_ch6_init[] = {
8124 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8125 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8126 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8127 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8131 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8132 { 2, alc889A_mb31_ch2_init },
8133 { 4, alc889A_mb31_ch4_init },
8134 { 5, alc889A_mb31_ch5_init },
8135 { 6, alc889A_mb31_ch6_init },
8138 static struct hda_verb alc883_medion_eapd_verbs[] = {
8139 /* eanable EAPD on medion laptop */
8140 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8141 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8145 #define alc883_base_mixer alc882_base_mixer
8147 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8148 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8149 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8150 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8151 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8152 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8153 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8156 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8158 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8159 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8160 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8164 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8165 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8166 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8167 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8168 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8173 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8174 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8178 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8179 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8180 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8181 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8182 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8184 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8186 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8187 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8188 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8192 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8193 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8194 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8195 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8196 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8197 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8198 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8199 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8201 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8204 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8205 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8209 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8210 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8211 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8212 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8213 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 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", 0x1b, 0x0, HDA_OUTPUT),
8219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8224 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8226 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8227 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8228 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8232 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8233 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8234 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8235 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8236 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8237 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8239 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8240 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8241 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8242 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8243 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8244 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8245 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8246 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8247 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8248 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8250 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8252 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8256 static struct snd_kcontrol_new alc885_8ch_intel_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_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8260 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8261 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8263 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8264 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8265 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8266 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8267 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8272 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8274 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8275 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8276 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8280 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8281 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8282 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8283 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8284 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8285 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8286 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8287 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8288 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8289 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8290 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8291 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8292 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8293 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8294 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8295 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8297 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8298 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8299 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8303 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8304 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8305 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8306 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8307 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8308 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8309 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8310 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8311 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8312 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8313 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8314 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8315 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8316 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8317 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8319 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8324 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8325 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8326 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8327 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8328 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8329 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8330 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8332 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8333 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8334 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8335 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8336 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8340 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8341 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8342 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8343 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8344 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8345 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8349 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8350 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8351 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8353 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8354 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8356 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8361 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8362 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8363 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8364 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8365 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8366 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8367 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8369 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8370 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8374 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8375 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8376 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8377 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8378 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8379 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8380 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8387 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8388 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8389 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8390 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8391 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8392 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8393 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8394 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8395 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8399 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8400 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8401 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8402 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8403 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8404 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8405 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8406 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8407 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8408 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8409 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8410 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8414 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8415 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8416 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8417 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8418 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8419 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8420 0x0d, 1, 0x0, HDA_OUTPUT),
8421 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8422 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8423 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8424 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8425 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8426 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8427 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8428 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8429 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8431 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8433 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8434 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8439 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8441 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8442 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8443 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8444 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8445 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8447 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8448 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8449 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8450 /* Output switches */
8451 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8452 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8453 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8455 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8456 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8458 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8459 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8460 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8461 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8465 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8466 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8467 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8468 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8469 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8470 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8471 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8475 static struct hda_bind_ctls alc883_bind_cap_vol = {
8476 .ops = &snd_hda_bind_vol,
8478 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8479 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8484 static struct hda_bind_ctls alc883_bind_cap_switch = {
8485 .ops = &snd_hda_bind_sw,
8487 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8488 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8493 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8494 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8495 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8496 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8497 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8498 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8500 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8501 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8505 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8506 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8507 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8509 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8510 /* .name = "Capture Source", */
8511 .name = "Input Source",
8513 .info = alc_mux_enum_info,
8514 .get = alc_mux_enum_get,
8515 .put = alc_mux_enum_put,
8520 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8522 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8523 .name = "Channel Mode",
8524 .info = alc_ch_mode_info,
8525 .get = alc_ch_mode_get,
8526 .put = alc_ch_mode_put,
8531 /* toggle speaker-output according to the hp-jack state */
8532 static void alc883_mitac_setup(struct hda_codec *codec)
8534 struct alc_spec *spec = codec->spec;
8536 spec->autocfg.hp_pins[0] = 0x15;
8537 spec->autocfg.speaker_pins[0] = 0x14;
8538 spec->autocfg.speaker_pins[1] = 0x17;
8541 /* auto-toggle front mic */
8543 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8545 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8547 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8551 static struct hda_verb alc883_mitac_verbs[] = {
8553 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8554 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8556 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8557 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8559 /* enable unsolicited event */
8560 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8561 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8566 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8568 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8571 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8573 /* enable unsolicited event */
8575 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8576 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8582 static struct hda_verb alc883_clevo_m720_verbs[] = {
8584 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8587 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8590 /* enable unsolicited event */
8591 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8592 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8597 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8599 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8602 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8603 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8605 /* enable unsolicited event */
8606 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8611 static struct hda_verb alc883_targa_verbs[] = {
8612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8615 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8616 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8618 /* Connect Line-Out side jack (SPDIF) to Side */
8619 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8620 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8621 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8622 /* Connect Mic jack to CLFE */
8623 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8624 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8625 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8626 /* Connect Line-in jack to Surround */
8627 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8629 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8630 /* Connect HP out jack to Front */
8631 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8632 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8633 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8635 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8640 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8642 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8643 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8647 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8648 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8650 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8651 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8655 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8658 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8659 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8660 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8664 static struct hda_verb alc883_haier_w66_verbs[] = {
8665 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8670 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8671 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8672 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8677 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8678 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8680 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8681 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8682 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8683 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8684 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8685 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8689 static struct hda_verb alc888_6st_dell_verbs[] = {
8690 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8694 static struct hda_verb alc883_vaiott_verbs[] = {
8696 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8697 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8699 /* enable unsolicited event */
8700 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8705 static void alc888_3st_hp_setup(struct hda_codec *codec)
8707 struct alc_spec *spec = codec->spec;
8709 spec->autocfg.hp_pins[0] = 0x1b;
8710 spec->autocfg.speaker_pins[0] = 0x14;
8711 spec->autocfg.speaker_pins[1] = 0x16;
8712 spec->autocfg.speaker_pins[2] = 0x18;
8715 static struct hda_verb alc888_3st_hp_verbs[] = {
8716 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8717 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8718 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8719 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8726 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8727 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8728 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8729 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8730 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8737 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8738 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8739 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8740 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8741 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8742 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8749 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8750 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8751 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8752 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8753 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8754 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8755 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8759 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8760 { 2, alc888_3st_hp_2ch_init },
8761 { 4, alc888_3st_hp_4ch_init },
8762 { 6, alc888_3st_hp_6ch_init },
8765 /* toggle front-jack and RCA according to the hp-jack state */
8766 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8768 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8770 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8771 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8772 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8773 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8776 /* toggle RCA according to the front-jack state */
8777 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8779 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8781 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8782 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8785 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8788 if ((res >> 26) == ALC880_HP_EVENT)
8789 alc888_lenovo_ms7195_front_automute(codec);
8790 if ((res >> 26) == ALC880_FRONT_EVENT)
8791 alc888_lenovo_ms7195_rca_automute(codec);
8794 static struct hda_verb alc883_medion_md2_verbs[] = {
8795 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8796 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8798 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8800 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8804 /* toggle speaker-output according to the hp-jack state */
8805 static void alc883_medion_md2_setup(struct hda_codec *codec)
8807 struct alc_spec *spec = codec->spec;
8809 spec->autocfg.hp_pins[0] = 0x14;
8810 spec->autocfg.speaker_pins[0] = 0x15;
8813 /* toggle speaker-output according to the hp-jack state */
8814 #define alc883_targa_init_hook alc882_targa_init_hook
8815 #define alc883_targa_unsol_event alc882_targa_unsol_event
8817 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8819 unsigned int present;
8821 present = snd_hda_jack_detect(codec, 0x18);
8822 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8823 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8826 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8828 struct alc_spec *spec = codec->spec;
8830 spec->autocfg.hp_pins[0] = 0x15;
8831 spec->autocfg.speaker_pins[0] = 0x14;
8834 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8836 alc_automute_amp(codec);
8837 alc883_clevo_m720_mic_automute(codec);
8840 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8843 switch (res >> 26) {
8844 case ALC880_MIC_EVENT:
8845 alc883_clevo_m720_mic_automute(codec);
8848 alc_automute_amp_unsol_event(codec, res);
8853 /* toggle speaker-output according to the hp-jack state */
8854 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8856 struct alc_spec *spec = codec->spec;
8858 spec->autocfg.hp_pins[0] = 0x14;
8859 spec->autocfg.speaker_pins[0] = 0x15;
8862 static void alc883_haier_w66_setup(struct hda_codec *codec)
8864 struct alc_spec *spec = codec->spec;
8866 spec->autocfg.hp_pins[0] = 0x1b;
8867 spec->autocfg.speaker_pins[0] = 0x14;
8870 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8872 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8874 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8875 HDA_AMP_MUTE, bits);
8878 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8880 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8882 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8883 HDA_AMP_MUTE, bits);
8884 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8885 HDA_AMP_MUTE, bits);
8888 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8891 if ((res >> 26) == ALC880_HP_EVENT)
8892 alc883_lenovo_101e_all_automute(codec);
8893 if ((res >> 26) == ALC880_FRONT_EVENT)
8894 alc883_lenovo_101e_ispeaker_automute(codec);
8897 /* toggle speaker-output according to the hp-jack state */
8898 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8900 struct alc_spec *spec = codec->spec;
8902 spec->autocfg.hp_pins[0] = 0x14;
8903 spec->autocfg.speaker_pins[0] = 0x15;
8904 spec->autocfg.speaker_pins[1] = 0x16;
8907 static struct hda_verb alc883_acer_eapd_verbs[] = {
8908 /* HP Pin: output 0 (0x0c) */
8909 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8911 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8912 /* Front Pin: output 0 (0x0c) */
8913 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8914 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8915 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8916 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8917 /* eanable EAPD on medion laptop */
8918 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8919 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8920 /* enable unsolicited event */
8921 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8925 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8926 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8927 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8928 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8932 static void alc888_6st_dell_setup(struct hda_codec *codec)
8934 struct alc_spec *spec = codec->spec;
8936 spec->autocfg.hp_pins[0] = 0x1b;
8937 spec->autocfg.speaker_pins[0] = 0x14;
8938 spec->autocfg.speaker_pins[1] = 0x15;
8939 spec->autocfg.speaker_pins[2] = 0x16;
8940 spec->autocfg.speaker_pins[3] = 0x17;
8943 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8945 struct alc_spec *spec = codec->spec;
8947 spec->autocfg.hp_pins[0] = 0x1b;
8948 spec->autocfg.speaker_pins[0] = 0x14;
8949 spec->autocfg.speaker_pins[1] = 0x15;
8950 spec->autocfg.speaker_pins[2] = 0x16;
8951 spec->autocfg.speaker_pins[3] = 0x17;
8952 spec->autocfg.speaker_pins[4] = 0x1a;
8955 static void alc883_vaiott_setup(struct hda_codec *codec)
8957 struct alc_spec *spec = codec->spec;
8959 spec->autocfg.hp_pins[0] = 0x15;
8960 spec->autocfg.speaker_pins[0] = 0x14;
8961 spec->autocfg.speaker_pins[1] = 0x17;
8964 static struct hda_verb alc888_asus_m90v_verbs[] = {
8965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8966 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8967 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8968 /* enable unsolicited event */
8969 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8970 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8974 static void alc883_mode2_setup(struct hda_codec *codec)
8976 struct alc_spec *spec = codec->spec;
8978 spec->autocfg.hp_pins[0] = 0x1b;
8979 spec->autocfg.speaker_pins[0] = 0x14;
8980 spec->autocfg.speaker_pins[1] = 0x15;
8981 spec->autocfg.speaker_pins[2] = 0x16;
8982 spec->ext_mic.pin = 0x18;
8983 spec->int_mic.pin = 0x19;
8984 spec->ext_mic.mux_idx = 0;
8985 spec->int_mic.mux_idx = 1;
8989 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8990 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8991 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8992 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8993 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8994 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8995 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8996 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8997 /* enable unsolicited event */
8998 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9002 static void alc883_eee1601_inithook(struct hda_codec *codec)
9004 struct alc_spec *spec = codec->spec;
9006 spec->autocfg.hp_pins[0] = 0x14;
9007 spec->autocfg.speaker_pins[0] = 0x1b;
9008 alc_automute_pin(codec);
9011 static struct hda_verb alc889A_mb31_verbs[] = {
9012 /* Init rear pin (used as headphone output) */
9013 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9014 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9015 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9016 /* Init line pin (used as output in 4ch and 6ch mode) */
9017 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9018 /* Init line 2 pin (used as headphone out by default) */
9019 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9020 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9024 /* Mute speakers according to the headphone jack state */
9025 static void alc889A_mb31_automute(struct hda_codec *codec)
9027 unsigned int present;
9029 /* Mute only in 2ch or 4ch mode */
9030 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9032 present = snd_hda_jack_detect(codec, 0x15);
9033 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9034 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9035 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9036 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9040 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9042 if ((res >> 26) == ALC880_HP_EVENT)
9043 alc889A_mb31_automute(codec);
9047 #ifdef CONFIG_SND_HDA_POWER_SAVE
9048 #define alc882_loopbacks alc880_loopbacks
9051 /* pcm configuration: identical with ALC880 */
9052 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9053 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9054 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9055 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9057 static hda_nid_t alc883_slave_dig_outs[] = {
9058 ALC1200_DIGOUT_NID, 0,
9061 static hda_nid_t alc1200_slave_dig_outs[] = {
9062 ALC883_DIGOUT_NID, 0,
9066 * configuration and preset
9068 static const char *alc882_models[ALC882_MODEL_LAST] = {
9069 [ALC882_3ST_DIG] = "3stack-dig",
9070 [ALC882_6ST_DIG] = "6stack-dig",
9071 [ALC882_ARIMA] = "arima",
9072 [ALC882_W2JC] = "w2jc",
9073 [ALC882_TARGA] = "targa",
9074 [ALC882_ASUS_A7J] = "asus-a7j",
9075 [ALC882_ASUS_A7M] = "asus-a7m",
9076 [ALC885_MACPRO] = "macpro",
9077 [ALC885_MB5] = "mb5",
9078 [ALC885_MACMINI3] = "macmini3",
9079 [ALC885_MBA21] = "mba21",
9080 [ALC885_MBP3] = "mbp3",
9081 [ALC885_IMAC24] = "imac24",
9082 [ALC885_IMAC91] = "imac91",
9083 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9084 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9085 [ALC883_3ST_6ch] = "3stack-6ch",
9086 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9087 [ALC883_TARGA_DIG] = "targa-dig",
9088 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9089 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9090 [ALC883_ACER] = "acer",
9091 [ALC883_ACER_ASPIRE] = "acer-aspire",
9092 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9093 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9094 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9095 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9096 [ALC883_MEDION] = "medion",
9097 [ALC883_MEDION_MD2] = "medion-md2",
9098 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9099 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9100 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9101 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9102 [ALC888_LENOVO_SKY] = "lenovo-sky",
9103 [ALC883_HAIER_W66] = "haier-w66",
9104 [ALC888_3ST_HP] = "3stack-hp",
9105 [ALC888_6ST_DELL] = "6stack-dell",
9106 [ALC883_MITAC] = "mitac",
9107 [ALC883_CLEVO_M540R] = "clevo-m540r",
9108 [ALC883_CLEVO_M720] = "clevo-m720",
9109 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9110 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9111 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9112 [ALC889A_INTEL] = "intel-alc889a",
9113 [ALC889_INTEL] = "intel-x58",
9114 [ALC1200_ASUS_P5Q] = "asus-p5q",
9115 [ALC889A_MB31] = "mb31",
9116 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9117 [ALC882_AUTO] = "auto",
9120 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9121 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9123 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9124 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9125 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9126 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9127 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9128 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9129 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9130 ALC888_ACER_ASPIRE_4930G),
9131 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9132 ALC888_ACER_ASPIRE_4930G),
9133 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9134 ALC888_ACER_ASPIRE_8930G),
9135 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9136 ALC888_ACER_ASPIRE_8930G),
9137 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9138 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9139 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9140 ALC888_ACER_ASPIRE_6530G),
9141 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9142 ALC888_ACER_ASPIRE_6530G),
9143 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9144 ALC888_ACER_ASPIRE_7730G),
9145 /* default Acer -- disabled as it causes more problems.
9146 * model=auto should work fine now
9148 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9150 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9152 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9153 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9154 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9155 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9156 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9157 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9159 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9160 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9161 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9162 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9163 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9164 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9165 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9166 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9167 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9168 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9169 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9171 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9172 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9173 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9174 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9175 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9176 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9177 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9178 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9179 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9181 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9182 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9183 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9184 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9185 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9186 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9187 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9188 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9189 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9190 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9191 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9192 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9193 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9194 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9195 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9196 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9197 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9198 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9199 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9200 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9201 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9202 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9203 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9204 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9205 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9206 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9207 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9208 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9209 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9210 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9211 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9213 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9214 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9215 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9216 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9217 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9218 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9219 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9220 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9221 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9222 ALC883_FUJITSU_PI2515),
9223 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9224 ALC888_FUJITSU_XA3530),
9225 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9226 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9227 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9228 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9229 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9230 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9231 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9232 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9233 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9235 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9236 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9237 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9238 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9239 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9240 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9241 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9246 /* codec SSID table for Intel Mac */
9247 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9248 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9249 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9250 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9251 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9252 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9253 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9254 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9255 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9256 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9257 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9258 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9259 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9260 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9261 * so apparently no perfect solution yet
9263 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9264 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9265 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9269 static struct alc_config_preset alc882_presets[] = {
9270 [ALC882_3ST_DIG] = {
9271 .mixers = { alc882_base_mixer },
9272 .init_verbs = { alc882_base_init_verbs,
9273 alc882_adc1_init_verbs },
9274 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9275 .dac_nids = alc882_dac_nids,
9276 .dig_out_nid = ALC882_DIGOUT_NID,
9277 .dig_in_nid = ALC882_DIGIN_NID,
9278 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9279 .channel_mode = alc882_ch_modes,
9281 .input_mux = &alc882_capture_source,
9283 [ALC882_6ST_DIG] = {
9284 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9285 .init_verbs = { alc882_base_init_verbs,
9286 alc882_adc1_init_verbs },
9287 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9288 .dac_nids = alc882_dac_nids,
9289 .dig_out_nid = ALC882_DIGOUT_NID,
9290 .dig_in_nid = ALC882_DIGIN_NID,
9291 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9292 .channel_mode = alc882_sixstack_modes,
9293 .input_mux = &alc882_capture_source,
9296 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9297 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9298 alc882_eapd_verbs },
9299 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9300 .dac_nids = alc882_dac_nids,
9301 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9302 .channel_mode = alc882_sixstack_modes,
9303 .input_mux = &alc882_capture_source,
9306 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9307 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9308 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9309 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9310 .dac_nids = alc882_dac_nids,
9311 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9312 .channel_mode = alc880_threestack_modes,
9314 .input_mux = &alc882_capture_source,
9315 .dig_out_nid = ALC882_DIGOUT_NID,
9318 .mixers = { alc885_mba21_mixer },
9319 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9321 .dac_nids = alc882_dac_nids,
9322 .channel_mode = alc885_mba21_ch_modes,
9323 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9324 .input_mux = &alc882_capture_source,
9325 .unsol_event = alc_automute_amp_unsol_event,
9326 .setup = alc885_mba21_setup,
9327 .init_hook = alc_automute_amp,
9330 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9331 .init_verbs = { alc885_mbp3_init_verbs,
9332 alc880_gpio1_init_verbs },
9334 .dac_nids = alc882_dac_nids,
9336 .channel_mode = alc885_mbp_4ch_modes,
9337 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9338 .input_mux = &alc882_capture_source,
9339 .dig_out_nid = ALC882_DIGOUT_NID,
9340 .dig_in_nid = ALC882_DIGIN_NID,
9341 .unsol_event = alc_automute_amp_unsol_event,
9342 .setup = alc885_mbp3_setup,
9343 .init_hook = alc_automute_amp,
9346 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9347 .init_verbs = { alc885_mb5_init_verbs,
9348 alc880_gpio1_init_verbs },
9349 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9350 .dac_nids = alc882_dac_nids,
9351 .channel_mode = alc885_mb5_6ch_modes,
9352 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9353 .input_mux = &mb5_capture_source,
9354 .dig_out_nid = ALC882_DIGOUT_NID,
9355 .dig_in_nid = ALC882_DIGIN_NID,
9356 .unsol_event = alc_automute_amp_unsol_event,
9357 .setup = alc885_mb5_setup,
9358 .init_hook = alc_automute_amp,
9360 [ALC885_MACMINI3] = {
9361 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9362 .init_verbs = { alc885_macmini3_init_verbs,
9363 alc880_gpio1_init_verbs },
9364 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9365 .dac_nids = alc882_dac_nids,
9366 .channel_mode = alc885_macmini3_6ch_modes,
9367 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9368 .input_mux = &macmini3_capture_source,
9369 .dig_out_nid = ALC882_DIGOUT_NID,
9370 .dig_in_nid = ALC882_DIGIN_NID,
9371 .unsol_event = alc_automute_amp_unsol_event,
9372 .setup = alc885_macmini3_setup,
9373 .init_hook = alc_automute_amp,
9376 .mixers = { alc882_macpro_mixer },
9377 .init_verbs = { alc882_macpro_init_verbs },
9378 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9379 .dac_nids = alc882_dac_nids,
9380 .dig_out_nid = ALC882_DIGOUT_NID,
9381 .dig_in_nid = ALC882_DIGIN_NID,
9382 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9383 .channel_mode = alc882_ch_modes,
9384 .input_mux = &alc882_capture_source,
9385 .init_hook = alc885_macpro_init_hook,
9388 .mixers = { alc885_imac24_mixer },
9389 .init_verbs = { alc885_imac24_init_verbs },
9390 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9391 .dac_nids = alc882_dac_nids,
9392 .dig_out_nid = ALC882_DIGOUT_NID,
9393 .dig_in_nid = ALC882_DIGIN_NID,
9394 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9395 .channel_mode = alc882_ch_modes,
9396 .input_mux = &alc882_capture_source,
9397 .unsol_event = alc_automute_amp_unsol_event,
9398 .setup = alc885_imac24_setup,
9399 .init_hook = alc885_imac24_init_hook,
9402 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9403 .init_verbs = { alc885_imac91_init_verbs,
9404 alc880_gpio1_init_verbs },
9405 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9406 .dac_nids = alc882_dac_nids,
9407 .channel_mode = alc885_mbp_4ch_modes,
9408 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9409 .input_mux = &alc882_capture_source,
9410 .dig_out_nid = ALC882_DIGOUT_NID,
9411 .dig_in_nid = ALC882_DIGIN_NID,
9412 .unsol_event = alc_automute_amp_unsol_event,
9413 .setup = alc885_imac91_setup,
9414 .init_hook = alc_automute_amp,
9417 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9418 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9419 alc880_gpio3_init_verbs, alc882_targa_verbs},
9420 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9421 .dac_nids = alc882_dac_nids,
9422 .dig_out_nid = ALC882_DIGOUT_NID,
9423 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9424 .adc_nids = alc882_adc_nids,
9425 .capsrc_nids = alc882_capsrc_nids,
9426 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9427 .channel_mode = alc882_3ST_6ch_modes,
9429 .input_mux = &alc882_capture_source,
9430 .unsol_event = alc882_targa_unsol_event,
9431 .setup = alc882_targa_setup,
9432 .init_hook = alc882_targa_automute,
9434 [ALC882_ASUS_A7J] = {
9435 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9436 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9437 alc882_asus_a7j_verbs},
9438 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9439 .dac_nids = alc882_dac_nids,
9440 .dig_out_nid = ALC882_DIGOUT_NID,
9441 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9442 .adc_nids = alc882_adc_nids,
9443 .capsrc_nids = alc882_capsrc_nids,
9444 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9445 .channel_mode = alc882_3ST_6ch_modes,
9447 .input_mux = &alc882_capture_source,
9449 [ALC882_ASUS_A7M] = {
9450 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9451 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9452 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9453 alc882_asus_a7m_verbs },
9454 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9455 .dac_nids = alc882_dac_nids,
9456 .dig_out_nid = ALC882_DIGOUT_NID,
9457 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9458 .channel_mode = alc880_threestack_modes,
9460 .input_mux = &alc882_capture_source,
9462 [ALC883_3ST_2ch_DIG] = {
9463 .mixers = { alc883_3ST_2ch_mixer },
9464 .init_verbs = { alc883_init_verbs },
9465 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9466 .dac_nids = alc883_dac_nids,
9467 .dig_out_nid = ALC883_DIGOUT_NID,
9468 .dig_in_nid = ALC883_DIGIN_NID,
9469 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9470 .channel_mode = alc883_3ST_2ch_modes,
9471 .input_mux = &alc883_capture_source,
9473 [ALC883_3ST_6ch_DIG] = {
9474 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9475 .init_verbs = { alc883_init_verbs },
9476 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9477 .dac_nids = alc883_dac_nids,
9478 .dig_out_nid = ALC883_DIGOUT_NID,
9479 .dig_in_nid = ALC883_DIGIN_NID,
9480 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9481 .channel_mode = alc883_3ST_6ch_modes,
9483 .input_mux = &alc883_capture_source,
9485 [ALC883_3ST_6ch] = {
9486 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9487 .init_verbs = { alc883_init_verbs },
9488 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9489 .dac_nids = alc883_dac_nids,
9490 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9491 .channel_mode = alc883_3ST_6ch_modes,
9493 .input_mux = &alc883_capture_source,
9495 [ALC883_3ST_6ch_INTEL] = {
9496 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9497 .init_verbs = { alc883_init_verbs },
9498 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9499 .dac_nids = alc883_dac_nids,
9500 .dig_out_nid = ALC883_DIGOUT_NID,
9501 .dig_in_nid = ALC883_DIGIN_NID,
9502 .slave_dig_outs = alc883_slave_dig_outs,
9503 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9504 .channel_mode = alc883_3ST_6ch_intel_modes,
9506 .input_mux = &alc883_3stack_6ch_intel,
9509 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9510 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9511 alc_hp15_unsol_verbs },
9512 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9513 .dac_nids = alc883_dac_nids,
9514 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9515 .adc_nids = alc889_adc_nids,
9516 .dig_out_nid = ALC883_DIGOUT_NID,
9517 .dig_in_nid = ALC883_DIGIN_NID,
9518 .slave_dig_outs = alc883_slave_dig_outs,
9519 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9520 .channel_mode = alc889_8ch_intel_modes,
9521 .capsrc_nids = alc889_capsrc_nids,
9522 .input_mux = &alc889_capture_source,
9523 .setup = alc889_automute_setup,
9524 .init_hook = alc_automute_amp,
9525 .unsol_event = alc_automute_amp_unsol_event,
9529 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9530 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9531 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9532 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9533 .dac_nids = alc883_dac_nids,
9534 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9535 .adc_nids = alc889_adc_nids,
9536 .dig_out_nid = ALC883_DIGOUT_NID,
9537 .dig_in_nid = ALC883_DIGIN_NID,
9538 .slave_dig_outs = alc883_slave_dig_outs,
9539 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9540 .channel_mode = alc889_8ch_intel_modes,
9541 .capsrc_nids = alc889_capsrc_nids,
9542 .input_mux = &alc889_capture_source,
9543 .setup = alc889_automute_setup,
9544 .init_hook = alc889_intel_init_hook,
9545 .unsol_event = alc_automute_amp_unsol_event,
9548 [ALC883_6ST_DIG] = {
9549 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9550 .init_verbs = { alc883_init_verbs },
9551 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9552 .dac_nids = alc883_dac_nids,
9553 .dig_out_nid = ALC883_DIGOUT_NID,
9554 .dig_in_nid = ALC883_DIGIN_NID,
9555 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9556 .channel_mode = alc883_sixstack_modes,
9557 .input_mux = &alc883_capture_source,
9559 [ALC883_TARGA_DIG] = {
9560 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9561 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9562 alc883_targa_verbs},
9563 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9564 .dac_nids = alc883_dac_nids,
9565 .dig_out_nid = ALC883_DIGOUT_NID,
9566 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9567 .channel_mode = alc883_3ST_6ch_modes,
9569 .input_mux = &alc883_capture_source,
9570 .unsol_event = alc883_targa_unsol_event,
9571 .setup = alc882_targa_setup,
9572 .init_hook = alc882_targa_automute,
9574 [ALC883_TARGA_2ch_DIG] = {
9575 .mixers = { alc883_targa_2ch_mixer},
9576 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9577 alc883_targa_verbs},
9578 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9579 .dac_nids = alc883_dac_nids,
9580 .adc_nids = alc883_adc_nids_alt,
9581 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9582 .capsrc_nids = alc883_capsrc_nids,
9583 .dig_out_nid = ALC883_DIGOUT_NID,
9584 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9585 .channel_mode = alc883_3ST_2ch_modes,
9586 .input_mux = &alc883_capture_source,
9587 .unsol_event = alc883_targa_unsol_event,
9588 .setup = alc882_targa_setup,
9589 .init_hook = alc882_targa_automute,
9591 [ALC883_TARGA_8ch_DIG] = {
9592 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9593 alc883_chmode_mixer },
9594 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9595 alc883_targa_verbs },
9596 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9597 .dac_nids = alc883_dac_nids,
9598 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9599 .adc_nids = alc883_adc_nids_rev,
9600 .capsrc_nids = alc883_capsrc_nids_rev,
9601 .dig_out_nid = ALC883_DIGOUT_NID,
9602 .dig_in_nid = ALC883_DIGIN_NID,
9603 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9604 .channel_mode = alc883_4ST_8ch_modes,
9606 .input_mux = &alc883_capture_source,
9607 .unsol_event = alc883_targa_unsol_event,
9608 .setup = alc882_targa_setup,
9609 .init_hook = alc882_targa_automute,
9612 .mixers = { alc883_base_mixer },
9613 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9614 * and the headphone jack. Turn this on and rely on the
9615 * standard mute methods whenever the user wants to turn
9616 * these outputs off.
9618 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9619 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9620 .dac_nids = alc883_dac_nids,
9621 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9622 .channel_mode = alc883_3ST_2ch_modes,
9623 .input_mux = &alc883_capture_source,
9625 [ALC883_ACER_ASPIRE] = {
9626 .mixers = { alc883_acer_aspire_mixer },
9627 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9628 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9629 .dac_nids = alc883_dac_nids,
9630 .dig_out_nid = ALC883_DIGOUT_NID,
9631 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9632 .channel_mode = alc883_3ST_2ch_modes,
9633 .input_mux = &alc883_capture_source,
9634 .unsol_event = alc_automute_amp_unsol_event,
9635 .setup = alc883_acer_aspire_setup,
9636 .init_hook = alc_automute_amp,
9638 [ALC888_ACER_ASPIRE_4930G] = {
9639 .mixers = { alc888_base_mixer,
9640 alc883_chmode_mixer },
9641 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9642 alc888_acer_aspire_4930g_verbs },
9643 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9644 .dac_nids = alc883_dac_nids,
9645 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9646 .adc_nids = alc883_adc_nids_rev,
9647 .capsrc_nids = alc883_capsrc_nids_rev,
9648 .dig_out_nid = ALC883_DIGOUT_NID,
9649 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9650 .channel_mode = alc883_3ST_6ch_modes,
9652 .const_channel_count = 6,
9654 ARRAY_SIZE(alc888_2_capture_sources),
9655 .input_mux = alc888_2_capture_sources,
9656 .unsol_event = alc_automute_amp_unsol_event,
9657 .setup = alc888_acer_aspire_4930g_setup,
9658 .init_hook = alc_automute_amp,
9660 [ALC888_ACER_ASPIRE_6530G] = {
9661 .mixers = { alc888_acer_aspire_6530_mixer },
9662 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9663 alc888_acer_aspire_6530g_verbs },
9664 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9665 .dac_nids = alc883_dac_nids,
9666 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9667 .adc_nids = alc883_adc_nids_rev,
9668 .capsrc_nids = alc883_capsrc_nids_rev,
9669 .dig_out_nid = ALC883_DIGOUT_NID,
9670 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9671 .channel_mode = alc883_3ST_2ch_modes,
9673 ARRAY_SIZE(alc888_2_capture_sources),
9674 .input_mux = alc888_acer_aspire_6530_sources,
9675 .unsol_event = alc_automute_amp_unsol_event,
9676 .setup = alc888_acer_aspire_6530g_setup,
9677 .init_hook = alc_automute_amp,
9679 [ALC888_ACER_ASPIRE_8930G] = {
9680 .mixers = { alc889_acer_aspire_8930g_mixer,
9681 alc883_chmode_mixer },
9682 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9683 alc889_acer_aspire_8930g_verbs,
9685 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9686 .dac_nids = alc883_dac_nids,
9687 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9688 .adc_nids = alc889_adc_nids,
9689 .capsrc_nids = alc889_capsrc_nids,
9690 .dig_out_nid = ALC883_DIGOUT_NID,
9691 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9692 .channel_mode = alc883_3ST_6ch_modes,
9694 .const_channel_count = 6,
9696 ARRAY_SIZE(alc889_capture_sources),
9697 .input_mux = alc889_capture_sources,
9698 .unsol_event = alc_automute_amp_unsol_event,
9699 .setup = alc889_acer_aspire_8930g_setup,
9700 .init_hook = alc_automute_amp,
9701 #ifdef CONFIG_SND_HDA_POWER_SAVE
9702 .power_hook = alc_power_eapd,
9705 [ALC888_ACER_ASPIRE_7730G] = {
9706 .mixers = { alc883_3ST_6ch_mixer,
9707 alc883_chmode_mixer },
9708 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9709 alc888_acer_aspire_7730G_verbs },
9710 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9711 .dac_nids = alc883_dac_nids,
9712 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9713 .adc_nids = alc883_adc_nids_rev,
9714 .capsrc_nids = alc883_capsrc_nids_rev,
9715 .dig_out_nid = ALC883_DIGOUT_NID,
9716 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9717 .channel_mode = alc883_3ST_6ch_modes,
9719 .const_channel_count = 6,
9720 .input_mux = &alc883_capture_source,
9721 .unsol_event = alc_automute_amp_unsol_event,
9722 .setup = alc888_acer_aspire_6530g_setup,
9723 .init_hook = alc_automute_amp,
9726 .mixers = { alc883_fivestack_mixer,
9727 alc883_chmode_mixer },
9728 .init_verbs = { alc883_init_verbs,
9729 alc883_medion_eapd_verbs },
9730 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9731 .dac_nids = alc883_dac_nids,
9732 .adc_nids = alc883_adc_nids_alt,
9733 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9734 .capsrc_nids = alc883_capsrc_nids,
9735 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9736 .channel_mode = alc883_sixstack_modes,
9737 .input_mux = &alc883_capture_source,
9739 [ALC883_MEDION_MD2] = {
9740 .mixers = { alc883_medion_md2_mixer},
9741 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9742 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9743 .dac_nids = alc883_dac_nids,
9744 .dig_out_nid = ALC883_DIGOUT_NID,
9745 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9746 .channel_mode = alc883_3ST_2ch_modes,
9747 .input_mux = &alc883_capture_source,
9748 .unsol_event = alc_automute_amp_unsol_event,
9749 .setup = alc883_medion_md2_setup,
9750 .init_hook = alc_automute_amp,
9752 [ALC883_LAPTOP_EAPD] = {
9753 .mixers = { alc883_base_mixer },
9754 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9755 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9756 .dac_nids = alc883_dac_nids,
9757 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9758 .channel_mode = alc883_3ST_2ch_modes,
9759 .input_mux = &alc883_capture_source,
9761 [ALC883_CLEVO_M540R] = {
9762 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9763 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9764 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9765 .dac_nids = alc883_dac_nids,
9766 .dig_out_nid = ALC883_DIGOUT_NID,
9767 .dig_in_nid = ALC883_DIGIN_NID,
9768 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9769 .channel_mode = alc883_3ST_6ch_clevo_modes,
9771 .input_mux = &alc883_capture_source,
9772 /* This machine has the hardware HP auto-muting, thus
9773 * we need no software mute via unsol event
9776 [ALC883_CLEVO_M720] = {
9777 .mixers = { alc883_clevo_m720_mixer },
9778 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9779 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9780 .dac_nids = alc883_dac_nids,
9781 .dig_out_nid = ALC883_DIGOUT_NID,
9782 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9783 .channel_mode = alc883_3ST_2ch_modes,
9784 .input_mux = &alc883_capture_source,
9785 .unsol_event = alc883_clevo_m720_unsol_event,
9786 .setup = alc883_clevo_m720_setup,
9787 .init_hook = alc883_clevo_m720_init_hook,
9789 [ALC883_LENOVO_101E_2ch] = {
9790 .mixers = { alc883_lenovo_101e_2ch_mixer},
9791 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9792 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9793 .dac_nids = alc883_dac_nids,
9794 .adc_nids = alc883_adc_nids_alt,
9795 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9796 .capsrc_nids = alc883_capsrc_nids,
9797 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9798 .channel_mode = alc883_3ST_2ch_modes,
9799 .input_mux = &alc883_lenovo_101e_capture_source,
9800 .unsol_event = alc883_lenovo_101e_unsol_event,
9801 .init_hook = alc883_lenovo_101e_all_automute,
9803 [ALC883_LENOVO_NB0763] = {
9804 .mixers = { alc883_lenovo_nb0763_mixer },
9805 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9807 .dac_nids = alc883_dac_nids,
9808 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9809 .channel_mode = alc883_3ST_2ch_modes,
9811 .input_mux = &alc883_lenovo_nb0763_capture_source,
9812 .unsol_event = alc_automute_amp_unsol_event,
9813 .setup = alc883_medion_md2_setup,
9814 .init_hook = alc_automute_amp,
9816 [ALC888_LENOVO_MS7195_DIG] = {
9817 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9818 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9819 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9820 .dac_nids = alc883_dac_nids,
9821 .dig_out_nid = ALC883_DIGOUT_NID,
9822 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9823 .channel_mode = alc883_3ST_6ch_modes,
9825 .input_mux = &alc883_capture_source,
9826 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9827 .init_hook = alc888_lenovo_ms7195_front_automute,
9829 [ALC883_HAIER_W66] = {
9830 .mixers = { alc883_targa_2ch_mixer},
9831 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9832 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9833 .dac_nids = alc883_dac_nids,
9834 .dig_out_nid = ALC883_DIGOUT_NID,
9835 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9836 .channel_mode = alc883_3ST_2ch_modes,
9837 .input_mux = &alc883_capture_source,
9838 .unsol_event = alc_automute_amp_unsol_event,
9839 .setup = alc883_haier_w66_setup,
9840 .init_hook = alc_automute_amp,
9843 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9844 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9845 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9846 .dac_nids = alc883_dac_nids,
9847 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9848 .channel_mode = alc888_3st_hp_modes,
9850 .input_mux = &alc883_capture_source,
9851 .unsol_event = alc_automute_amp_unsol_event,
9852 .setup = alc888_3st_hp_setup,
9853 .init_hook = alc_automute_amp,
9855 [ALC888_6ST_DELL] = {
9856 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9857 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9858 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9859 .dac_nids = alc883_dac_nids,
9860 .dig_out_nid = ALC883_DIGOUT_NID,
9861 .dig_in_nid = ALC883_DIGIN_NID,
9862 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9863 .channel_mode = alc883_sixstack_modes,
9864 .input_mux = &alc883_capture_source,
9865 .unsol_event = alc_automute_amp_unsol_event,
9866 .setup = alc888_6st_dell_setup,
9867 .init_hook = alc_automute_amp,
9870 .mixers = { alc883_mitac_mixer },
9871 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9872 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9873 .dac_nids = alc883_dac_nids,
9874 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9875 .channel_mode = alc883_3ST_2ch_modes,
9876 .input_mux = &alc883_capture_source,
9877 .unsol_event = alc_automute_amp_unsol_event,
9878 .setup = alc883_mitac_setup,
9879 .init_hook = alc_automute_amp,
9881 [ALC883_FUJITSU_PI2515] = {
9882 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9883 .init_verbs = { alc883_init_verbs,
9884 alc883_2ch_fujitsu_pi2515_verbs},
9885 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9886 .dac_nids = alc883_dac_nids,
9887 .dig_out_nid = ALC883_DIGOUT_NID,
9888 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9889 .channel_mode = alc883_3ST_2ch_modes,
9890 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9891 .unsol_event = alc_automute_amp_unsol_event,
9892 .setup = alc883_2ch_fujitsu_pi2515_setup,
9893 .init_hook = alc_automute_amp,
9895 [ALC888_FUJITSU_XA3530] = {
9896 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9897 .init_verbs = { alc883_init_verbs,
9898 alc888_fujitsu_xa3530_verbs },
9899 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9900 .dac_nids = alc883_dac_nids,
9901 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9902 .adc_nids = alc883_adc_nids_rev,
9903 .capsrc_nids = alc883_capsrc_nids_rev,
9904 .dig_out_nid = ALC883_DIGOUT_NID,
9905 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9906 .channel_mode = alc888_4ST_8ch_intel_modes,
9908 ARRAY_SIZE(alc888_2_capture_sources),
9909 .input_mux = alc888_2_capture_sources,
9910 .unsol_event = alc_automute_amp_unsol_event,
9911 .setup = alc888_fujitsu_xa3530_setup,
9912 .init_hook = alc_automute_amp,
9914 [ALC888_LENOVO_SKY] = {
9915 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9916 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9917 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9918 .dac_nids = alc883_dac_nids,
9919 .dig_out_nid = ALC883_DIGOUT_NID,
9920 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9921 .channel_mode = alc883_sixstack_modes,
9923 .input_mux = &alc883_lenovo_sky_capture_source,
9924 .unsol_event = alc_automute_amp_unsol_event,
9925 .setup = alc888_lenovo_sky_setup,
9926 .init_hook = alc_automute_amp,
9928 [ALC888_ASUS_M90V] = {
9929 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9930 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9931 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9932 .dac_nids = alc883_dac_nids,
9933 .dig_out_nid = ALC883_DIGOUT_NID,
9934 .dig_in_nid = ALC883_DIGIN_NID,
9935 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9936 .channel_mode = alc883_3ST_6ch_modes,
9938 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9939 .unsol_event = alc_sku_unsol_event,
9940 .setup = alc883_mode2_setup,
9941 .init_hook = alc_inithook,
9943 [ALC888_ASUS_EEE1601] = {
9944 .mixers = { alc883_asus_eee1601_mixer },
9945 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9946 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9947 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9948 .dac_nids = alc883_dac_nids,
9949 .dig_out_nid = ALC883_DIGOUT_NID,
9950 .dig_in_nid = ALC883_DIGIN_NID,
9951 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9952 .channel_mode = alc883_3ST_2ch_modes,
9954 .input_mux = &alc883_asus_eee1601_capture_source,
9955 .unsol_event = alc_sku_unsol_event,
9956 .init_hook = alc883_eee1601_inithook,
9958 [ALC1200_ASUS_P5Q] = {
9959 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9960 .init_verbs = { alc883_init_verbs },
9961 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9962 .dac_nids = alc883_dac_nids,
9963 .dig_out_nid = ALC1200_DIGOUT_NID,
9964 .dig_in_nid = ALC883_DIGIN_NID,
9965 .slave_dig_outs = alc1200_slave_dig_outs,
9966 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9967 .channel_mode = alc883_sixstack_modes,
9968 .input_mux = &alc883_capture_source,
9971 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9972 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9973 alc880_gpio1_init_verbs },
9974 .adc_nids = alc883_adc_nids,
9975 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9976 .capsrc_nids = alc883_capsrc_nids,
9977 .dac_nids = alc883_dac_nids,
9978 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9979 .channel_mode = alc889A_mb31_6ch_modes,
9980 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9981 .input_mux = &alc889A_mb31_capture_source,
9982 .dig_out_nid = ALC883_DIGOUT_NID,
9983 .unsol_event = alc889A_mb31_unsol_event,
9984 .init_hook = alc889A_mb31_automute,
9986 [ALC883_SONY_VAIO_TT] = {
9987 .mixers = { alc883_vaiott_mixer },
9988 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9989 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9990 .dac_nids = alc883_dac_nids,
9991 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9992 .channel_mode = alc883_3ST_2ch_modes,
9993 .input_mux = &alc883_capture_source,
9994 .unsol_event = alc_automute_amp_unsol_event,
9995 .setup = alc883_vaiott_setup,
9996 .init_hook = alc_automute_amp,
10005 PINFIX_ABIT_AW9D_MAX
10008 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10009 { 0x15, 0x01080104 }, /* side */
10010 { 0x16, 0x01011012 }, /* rear */
10011 { 0x17, 0x01016011 }, /* clfe */
10015 static const struct alc_fixup alc882_fixups[] = {
10016 [PINFIX_ABIT_AW9D_MAX] = {
10017 .pins = alc882_abit_aw9d_pinfix
10021 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10022 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10027 * BIOS auto configuration
10029 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10030 const struct auto_pin_cfg *cfg)
10032 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10035 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10036 hda_nid_t nid, int pin_type,
10039 /* set as output */
10040 struct alc_spec *spec = codec->spec;
10043 alc_set_pin_output(codec, nid, pin_type);
10044 if (spec->multiout.dac_nids[dac_idx] == 0x25)
10047 idx = spec->multiout.dac_nids[dac_idx] - 2;
10048 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10052 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10054 struct alc_spec *spec = codec->spec;
10057 for (i = 0; i <= HDA_SIDE; i++) {
10058 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10059 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10061 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10066 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10068 struct alc_spec *spec = codec->spec;
10071 pin = spec->autocfg.hp_pins[0];
10072 if (pin) /* connect to front */
10074 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10075 pin = spec->autocfg.speaker_pins[0];
10077 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10080 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10082 struct alc_spec *spec = codec->spec;
10085 for (i = 0; i < AUTO_PIN_LAST; i++) {
10086 hda_nid_t nid = spec->autocfg.input_pins[i];
10089 alc_set_input_pin(codec, nid, i);
10090 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10091 snd_hda_codec_write(codec, nid, 0,
10092 AC_VERB_SET_AMP_GAIN_MUTE,
10097 static void alc882_auto_init_input_src(struct hda_codec *codec)
10099 struct alc_spec *spec = codec->spec;
10102 for (c = 0; c < spec->num_adc_nids; c++) {
10103 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10104 hda_nid_t nid = spec->capsrc_nids[c];
10105 unsigned int mux_idx;
10106 const struct hda_input_mux *imux;
10107 int conns, mute, idx, item;
10109 conns = snd_hda_get_connections(codec, nid, conn_list,
10110 ARRAY_SIZE(conn_list));
10113 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10114 imux = &spec->input_mux[mux_idx];
10115 if (!imux->num_items && mux_idx > 0)
10116 imux = &spec->input_mux[0];
10117 for (idx = 0; idx < conns; idx++) {
10118 /* if the current connection is the selected one,
10119 * unmute it as default - otherwise mute it
10121 mute = AMP_IN_MUTE(idx);
10122 for (item = 0; item < imux->num_items; item++) {
10123 if (imux->items[item].index == idx) {
10124 if (spec->cur_mux[c] == item)
10125 mute = AMP_IN_UNMUTE(idx);
10129 /* check if we have a selector or mixer
10130 * we could check for the widget type instead, but
10131 * just check for Amp-In presence (in case of mixer
10132 * without amp-in there is something wrong, this
10133 * function shouldn't be used or capsrc nid is wrong)
10135 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10136 snd_hda_codec_write(codec, nid, 0,
10137 AC_VERB_SET_AMP_GAIN_MUTE,
10139 else if (mute != AMP_IN_MUTE(idx))
10140 snd_hda_codec_write(codec, nid, 0,
10141 AC_VERB_SET_CONNECT_SEL,
10147 /* add mic boosts if needed */
10148 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10150 struct alc_spec *spec = codec->spec;
10154 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10155 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10156 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10158 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10162 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10163 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10164 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10166 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10173 /* almost identical with ALC880 parser... */
10174 static int alc882_parse_auto_config(struct hda_codec *codec)
10176 struct alc_spec *spec = codec->spec;
10177 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10180 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10184 if (!spec->autocfg.line_outs)
10185 return 0; /* can't find valid BIOS pin config */
10187 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10190 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10193 err = alc880_auto_create_extra_out(spec,
10194 spec->autocfg.speaker_pins[0],
10198 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10202 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10206 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10208 /* check multiple SPDIF-out (for recent codecs) */
10209 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10211 err = snd_hda_get_connections(codec,
10212 spec->autocfg.dig_out_pins[i],
10217 spec->multiout.dig_out_nid = dig_nid;
10219 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10220 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10222 spec->slave_dig_outs[i - 1] = dig_nid;
10225 if (spec->autocfg.dig_in_pin)
10226 spec->dig_in_nid = ALC880_DIGIN_NID;
10228 if (spec->kctls.list)
10229 add_mixer(spec, spec->kctls.list);
10231 add_verb(spec, alc883_auto_init_verbs);
10232 /* if ADC 0x07 is available, initialize it, too */
10233 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10234 add_verb(spec, alc882_adc1_init_verbs);
10236 spec->num_mux_defs = 1;
10237 spec->input_mux = &spec->private_imux[0];
10239 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10241 err = alc_auto_add_mic_boost(codec);
10245 return 1; /* config found */
10248 /* additional initialization for auto-configuration model */
10249 static void alc882_auto_init(struct hda_codec *codec)
10251 struct alc_spec *spec = codec->spec;
10252 alc882_auto_init_multi_out(codec);
10253 alc882_auto_init_hp_out(codec);
10254 alc882_auto_init_analog_input(codec);
10255 alc882_auto_init_input_src(codec);
10256 if (spec->unsol_event)
10257 alc_inithook(codec);
10260 static int patch_alc882(struct hda_codec *codec)
10262 struct alc_spec *spec;
10263 int err, board_config;
10265 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10269 codec->spec = spec;
10271 switch (codec->vendor_id) {
10276 /* ALC883 and variants */
10277 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10281 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10285 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10286 board_config = snd_hda_check_board_codec_sid_config(codec,
10287 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10289 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10290 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10292 board_config = ALC882_AUTO;
10295 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10297 if (board_config == ALC882_AUTO) {
10298 /* automatic parse from the BIOS config */
10299 err = alc882_parse_auto_config(codec);
10305 "hda_codec: Cannot set up configuration "
10306 "from BIOS. Using base mode...\n");
10307 board_config = ALC882_3ST_DIG;
10311 err = snd_hda_attach_beep_device(codec, 0x1);
10317 if (board_config != ALC882_AUTO)
10318 setup_preset(codec, &alc882_presets[board_config]);
10320 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10321 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10322 /* FIXME: setup DAC5 */
10323 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10324 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10326 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10327 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10329 if (codec->vendor_id == 0x10ec0888)
10330 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10332 if (!spec->adc_nids && spec->input_mux) {
10334 spec->num_adc_nids = 0;
10335 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10336 const struct hda_input_mux *imux = spec->input_mux;
10338 hda_nid_t items[16];
10339 hda_nid_t nid = alc882_adc_nids[i];
10340 unsigned int wcap = get_wcaps(codec, nid);
10342 wcap = get_wcaps_type(wcap);
10343 if (wcap != AC_WID_AUD_IN)
10345 spec->private_adc_nids[spec->num_adc_nids] = nid;
10346 err = snd_hda_get_connections(codec, nid, &cap, 1);
10349 err = snd_hda_get_connections(codec, cap, items,
10350 ARRAY_SIZE(items));
10353 for (j = 0; j < imux->num_items; j++)
10354 if (imux->items[j].index >= err)
10356 if (j < imux->num_items)
10358 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10359 spec->num_adc_nids++;
10361 spec->adc_nids = spec->private_adc_nids;
10362 spec->capsrc_nids = spec->private_capsrc_nids;
10365 set_capture_mixer(codec);
10366 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10368 spec->vmaster_nid = 0x0c;
10370 codec->patch_ops = alc_patch_ops;
10371 if (board_config == ALC882_AUTO)
10372 spec->init_hook = alc882_auto_init;
10373 #ifdef CONFIG_SND_HDA_POWER_SAVE
10374 if (!spec->loopback.amplist)
10375 spec->loopback.amplist = alc882_loopbacks;
10386 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10387 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10389 #define alc262_dac_nids alc260_dac_nids
10390 #define alc262_adc_nids alc882_adc_nids
10391 #define alc262_adc_nids_alt alc882_adc_nids_alt
10392 #define alc262_capsrc_nids alc882_capsrc_nids
10393 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10395 #define alc262_modes alc260_modes
10396 #define alc262_capture_source alc882_capture_source
10398 static hda_nid_t alc262_dmic_adc_nids[1] = {
10403 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10405 static struct snd_kcontrol_new alc262_base_mixer[] = {
10406 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10407 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10408 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10409 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10410 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10411 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10413 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10415 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10416 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10417 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10418 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10419 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10420 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10421 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10425 /* update HP, line and mono-out pins according to the master switch */
10426 static void alc262_hp_master_update(struct hda_codec *codec)
10428 struct alc_spec *spec = codec->spec;
10429 int val = spec->master_sw;
10431 /* HP & line-out */
10432 snd_hda_codec_write_cache(codec, 0x1b, 0,
10433 AC_VERB_SET_PIN_WIDGET_CONTROL,
10435 snd_hda_codec_write_cache(codec, 0x15, 0,
10436 AC_VERB_SET_PIN_WIDGET_CONTROL,
10438 /* mono (speaker) depending on the HP jack sense */
10439 val = val && !spec->jack_present;
10440 snd_hda_codec_write_cache(codec, 0x16, 0,
10441 AC_VERB_SET_PIN_WIDGET_CONTROL,
10442 val ? PIN_OUT : 0);
10445 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10447 struct alc_spec *spec = codec->spec;
10449 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10450 alc262_hp_master_update(codec);
10453 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10455 if ((res >> 26) != ALC880_HP_EVENT)
10457 alc262_hp_bpc_automute(codec);
10460 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10462 struct alc_spec *spec = codec->spec;
10464 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10465 alc262_hp_master_update(codec);
10468 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10471 if ((res >> 26) != ALC880_HP_EVENT)
10473 alc262_hp_wildwest_automute(codec);
10476 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10478 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10479 struct snd_ctl_elem_value *ucontrol)
10481 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10482 struct alc_spec *spec = codec->spec;
10483 int val = !!*ucontrol->value.integer.value;
10485 if (val == spec->master_sw)
10487 spec->master_sw = val;
10488 alc262_hp_master_update(codec);
10492 #define ALC262_HP_MASTER_SWITCH \
10494 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10495 .name = "Master Playback Switch", \
10496 .info = snd_ctl_boolean_mono_info, \
10497 .get = alc262_hp_master_sw_get, \
10498 .put = alc262_hp_master_sw_put, \
10501 .iface = NID_MAPPING, \
10502 .name = "Master Playback Switch", \
10503 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10507 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10508 ALC262_HP_MASTER_SWITCH,
10509 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10510 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10511 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10512 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10514 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10516 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10518 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10519 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10520 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10521 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10522 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10523 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10524 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10525 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10526 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10527 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10531 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10532 ALC262_HP_MASTER_SWITCH,
10533 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10534 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10535 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10537 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10539 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10541 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10542 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10543 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10544 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10545 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10546 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10547 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10551 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10552 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10553 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10554 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10558 /* mute/unmute internal speaker according to the hp jack and mute state */
10559 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10561 struct alc_spec *spec = codec->spec;
10563 spec->autocfg.hp_pins[0] = 0x15;
10564 spec->autocfg.speaker_pins[0] = 0x14;
10567 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10568 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10569 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10570 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10571 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10573 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10574 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10578 static struct hda_verb alc262_hp_t5735_verbs[] = {
10579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10582 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10586 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10587 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10588 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10589 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10590 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10591 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10592 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10596 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10597 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10598 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10599 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10600 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10601 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10602 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10603 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10604 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10605 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10606 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10610 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10617 /* bind hp and internal speaker mute (with plug check) as master switch */
10618 static void alc262_hippo_master_update(struct hda_codec *codec)
10620 struct alc_spec *spec = codec->spec;
10621 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10622 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10623 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10627 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10628 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10629 HDA_AMP_MUTE, mute);
10630 /* mute internal speaker per jack sense */
10631 if (spec->jack_present)
10632 mute = HDA_AMP_MUTE;
10634 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10635 HDA_AMP_MUTE, mute);
10636 if (speaker_nid && speaker_nid != line_nid)
10637 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10638 HDA_AMP_MUTE, mute);
10641 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10643 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10644 struct snd_ctl_elem_value *ucontrol)
10646 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10647 struct alc_spec *spec = codec->spec;
10648 int val = !!*ucontrol->value.integer.value;
10650 if (val == spec->master_sw)
10652 spec->master_sw = val;
10653 alc262_hippo_master_update(codec);
10657 #define ALC262_HIPPO_MASTER_SWITCH \
10659 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10660 .name = "Master Playback Switch", \
10661 .info = snd_ctl_boolean_mono_info, \
10662 .get = alc262_hippo_master_sw_get, \
10663 .put = alc262_hippo_master_sw_put, \
10666 .iface = NID_MAPPING, \
10667 .name = "Master Playback Switch", \
10668 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10669 (SUBDEV_SPEAKER(0) << 16), \
10672 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10673 ALC262_HIPPO_MASTER_SWITCH,
10674 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10675 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10676 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10677 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10678 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10681 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10682 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10683 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10684 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10685 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10689 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10690 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10691 ALC262_HIPPO_MASTER_SWITCH,
10692 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10693 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10694 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10695 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10698 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10699 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10700 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10701 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10705 /* mute/unmute internal speaker according to the hp jack and mute state */
10706 static void alc262_hippo_automute(struct hda_codec *codec)
10708 struct alc_spec *spec = codec->spec;
10709 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10711 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10712 alc262_hippo_master_update(codec);
10715 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10717 if ((res >> 26) != ALC880_HP_EVENT)
10719 alc262_hippo_automute(codec);
10722 static void alc262_hippo_setup(struct hda_codec *codec)
10724 struct alc_spec *spec = codec->spec;
10726 spec->autocfg.hp_pins[0] = 0x15;
10727 spec->autocfg.speaker_pins[0] = 0x14;
10730 static void alc262_hippo1_setup(struct hda_codec *codec)
10732 struct alc_spec *spec = codec->spec;
10734 spec->autocfg.hp_pins[0] = 0x1b;
10735 spec->autocfg.speaker_pins[0] = 0x14;
10739 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10740 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10741 ALC262_HIPPO_MASTER_SWITCH,
10742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10744 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10745 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10749 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10750 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10751 ALC262_HIPPO_MASTER_SWITCH,
10752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10754 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10755 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10756 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10760 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10761 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10762 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10763 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10764 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10765 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10766 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10769 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10770 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10771 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10772 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10776 static struct hda_verb alc262_tyan_verbs[] = {
10777 /* Headphone automute */
10778 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10779 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10780 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10782 /* P11 AUX_IN, white 4-pin connector */
10783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10784 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10785 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10786 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10791 /* unsolicited event for HP jack sensing */
10792 static void alc262_tyan_setup(struct hda_codec *codec)
10794 struct alc_spec *spec = codec->spec;
10796 spec->autocfg.hp_pins[0] = 0x1b;
10797 spec->autocfg.speaker_pins[0] = 0x15;
10801 #define alc262_capture_mixer alc882_capture_mixer
10802 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10805 * generic initialization of ADC, input mixers and output mixers
10807 static struct hda_verb alc262_init_verbs[] = {
10809 * Unmute ADC0-2 and set the default input to mic-in
10811 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10812 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10813 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10814 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10815 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10816 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10818 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10820 * Note: PASD motherboards uses the Line In 2 as the input for
10821 * front panel mic (mic 2)
10823 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10824 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10825 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10826 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10831 * Set up output mixers (0x0c - 0x0e)
10833 /* set vol=0 to output mixers */
10834 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10835 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10836 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10837 /* set up input amps for analog loopback */
10838 /* Amp Indices: DAC = 0, mixer = 1 */
10839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10843 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10844 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10848 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10849 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10850 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10851 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10853 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10855 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10856 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10857 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10859 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10860 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10862 /* FIXME: use matrix-type input source selection */
10863 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10864 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10865 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10866 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10867 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10868 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10870 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10871 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10873 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10875 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10878 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10883 static struct hda_verb alc262_eapd_verbs[] = {
10884 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10885 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10889 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10890 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10891 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10892 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10895 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10899 static struct hda_verb alc262_sony_unsol_verbs[] = {
10900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10901 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10902 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10904 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10905 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10909 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10910 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10911 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10912 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10913 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10914 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10918 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10919 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10920 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10921 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10922 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10923 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10924 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10925 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10926 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10930 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10932 struct alc_spec *spec = codec->spec;
10934 spec->autocfg.hp_pins[0] = 0x15;
10935 spec->autocfg.speaker_pins[0] = 0x14;
10936 spec->ext_mic.pin = 0x18;
10937 spec->ext_mic.mux_idx = 0;
10938 spec->int_mic.pin = 0x12;
10939 spec->int_mic.mux_idx = 9;
10940 spec->auto_mic = 1;
10946 * 0x16 = internal speaker
10947 * 0x18 = external mic
10950 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10951 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10952 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10955 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10956 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10958 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10959 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10963 static struct hda_verb alc262_nec_verbs[] = {
10964 /* Unmute Speaker */
10965 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10968 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10969 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10971 /* External mic to headphone */
10972 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10973 /* External mic to speaker */
10974 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10980 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10981 * 0x1b = port replicator headphone out
10984 #define ALC_HP_EVENT 0x37
10986 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10987 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10988 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10989 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10990 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10994 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10995 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10996 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11000 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11001 /* Front Mic pin: input vref at 50% */
11002 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11003 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11007 static struct hda_input_mux alc262_fujitsu_capture_source = {
11011 { "Int Mic", 0x1 },
11016 static struct hda_input_mux alc262_HP_capture_source = {
11020 { "Front Mic", 0x1 },
11027 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11031 { "Front Mic", 0x2 },
11037 /* mute/unmute internal speaker according to the hp jacks and mute state */
11038 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11040 struct alc_spec *spec = codec->spec;
11043 if (force || !spec->sense_updated) {
11044 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11045 snd_hda_jack_detect(codec, 0x1b);
11046 spec->sense_updated = 1;
11048 /* unmute internal speaker only if both HPs are unplugged and
11049 * master switch is on
11051 if (spec->jack_present)
11052 mute = HDA_AMP_MUTE;
11054 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11055 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11056 HDA_AMP_MUTE, mute);
11059 /* unsolicited event for HP jack sensing */
11060 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11063 if ((res >> 26) != ALC_HP_EVENT)
11065 alc262_fujitsu_automute(codec, 1);
11068 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11070 alc262_fujitsu_automute(codec, 1);
11073 /* bind volumes of both NID 0x0c and 0x0d */
11074 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11075 .ops = &snd_hda_bind_vol,
11077 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11078 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11083 /* mute/unmute internal speaker according to the hp jack and mute state */
11084 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11086 struct alc_spec *spec = codec->spec;
11089 if (force || !spec->sense_updated) {
11090 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11091 spec->sense_updated = 1;
11093 if (spec->jack_present) {
11094 /* mute internal speaker */
11095 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11096 HDA_AMP_MUTE, HDA_AMP_MUTE);
11097 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11098 HDA_AMP_MUTE, HDA_AMP_MUTE);
11100 /* unmute internal speaker if necessary */
11101 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11102 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11103 HDA_AMP_MUTE, mute);
11104 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11105 HDA_AMP_MUTE, mute);
11109 /* unsolicited event for HP jack sensing */
11110 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11113 if ((res >> 26) != ALC_HP_EVENT)
11115 alc262_lenovo_3000_automute(codec, 1);
11118 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11119 int dir, int idx, long *valp)
11123 for (i = 0; i < 2; i++, valp++)
11124 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11126 *valp ? 0 : HDA_AMP_MUTE);
11130 /* bind hp and internal speaker mute (with plug check) */
11131 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11132 struct snd_ctl_elem_value *ucontrol)
11134 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11135 long *valp = ucontrol->value.integer.value;
11138 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11139 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11141 alc262_fujitsu_automute(codec, 0);
11145 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11146 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11148 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11149 .name = "Master Playback Switch",
11150 .subdevice = HDA_SUBDEV_AMP_FLAG,
11151 .info = snd_hda_mixer_amp_switch_info,
11152 .get = snd_hda_mixer_amp_switch_get,
11153 .put = alc262_fujitsu_master_sw_put,
11154 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11157 .iface = NID_MAPPING,
11158 .name = "Master Playback Switch",
11159 .private_value = 0x1b,
11161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11162 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11163 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11166 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11167 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11168 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11172 /* bind hp and internal speaker mute (with plug check) */
11173 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11174 struct snd_ctl_elem_value *ucontrol)
11176 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11177 long *valp = ucontrol->value.integer.value;
11180 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11182 alc262_lenovo_3000_automute(codec, 0);
11186 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11187 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11189 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11190 .name = "Master Playback Switch",
11191 .subdevice = HDA_SUBDEV_AMP_FLAG,
11192 .info = snd_hda_mixer_amp_switch_info,
11193 .get = snd_hda_mixer_amp_switch_get,
11194 .put = alc262_lenovo_3000_master_sw_put,
11195 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11199 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11202 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11203 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11204 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11208 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11209 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11210 ALC262_HIPPO_MASTER_SWITCH,
11211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11213 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11214 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11215 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11216 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11220 /* additional init verbs for Benq laptops */
11221 static struct hda_verb alc262_EAPD_verbs[] = {
11222 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11223 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11227 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11228 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11229 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11231 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11232 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11236 /* Samsung Q1 Ultra Vista model setup */
11237 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11238 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11239 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11241 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11242 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11243 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11247 static struct hda_verb alc262_ultra_verbs[] = {
11249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11253 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11254 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11255 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11256 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11261 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11262 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11264 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11266 /* ADC, choose mic */
11267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11268 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11269 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11270 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11271 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11272 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11273 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11280 /* mute/unmute internal speaker according to the hp jack and mute state */
11281 static void alc262_ultra_automute(struct hda_codec *codec)
11283 struct alc_spec *spec = codec->spec;
11287 /* auto-mute only when HP is used as HP */
11288 if (!spec->cur_mux[0]) {
11289 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11290 if (spec->jack_present)
11291 mute = HDA_AMP_MUTE;
11293 /* mute/unmute internal speaker */
11294 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11295 HDA_AMP_MUTE, mute);
11296 /* mute/unmute HP */
11297 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11298 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11301 /* unsolicited event for HP jack sensing */
11302 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11305 if ((res >> 26) != ALC880_HP_EVENT)
11307 alc262_ultra_automute(codec);
11310 static struct hda_input_mux alc262_ultra_capture_source = {
11314 { "Headphone", 0x7 },
11318 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11319 struct snd_ctl_elem_value *ucontrol)
11321 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11322 struct alc_spec *spec = codec->spec;
11325 ret = alc_mux_enum_put(kcontrol, ucontrol);
11328 /* reprogram the HP pin as mic or HP according to the input source */
11329 snd_hda_codec_write_cache(codec, 0x15, 0,
11330 AC_VERB_SET_PIN_WIDGET_CONTROL,
11331 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11332 alc262_ultra_automute(codec); /* mute/unmute HP */
11336 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11337 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11338 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11340 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11341 .name = "Capture Source",
11342 .info = alc_mux_enum_info,
11343 .get = alc_mux_enum_get,
11344 .put = alc262_ultra_mux_enum_put,
11347 .iface = NID_MAPPING,
11348 .name = "Capture Source",
11349 .private_value = 0x15,
11354 /* We use two mixers depending on the output pin; 0x16 is a mono output
11355 * and thus it's bound with a different mixer.
11356 * This function returns which mixer amp should be used.
11358 static int alc262_check_volbit(hda_nid_t nid)
11362 else if (nid == 0x16)
11368 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11369 const char *pfx, int *vbits)
11374 vbit = alc262_check_volbit(nid);
11377 if (*vbits & vbit) /* a volume control for this mixer already there */
11381 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11383 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11384 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11387 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11395 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11397 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11398 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11401 /* add playback controls from the parsed DAC table */
11402 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11403 const struct auto_pin_cfg *cfg)
11409 spec->multiout.num_dacs = 1; /* only use one dac */
11410 spec->multiout.dac_nids = spec->private_dac_nids;
11411 spec->multiout.dac_nids[0] = 2;
11413 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11415 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11419 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11422 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11425 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11429 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11430 alc262_check_volbit(cfg->speaker_pins[0]) |
11431 alc262_check_volbit(cfg->hp_pins[0]);
11432 if (vbits == 1 || vbits == 2)
11433 pfx = "Master"; /* only one mixer is used */
11434 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11439 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11442 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11446 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11453 #define alc262_auto_create_input_ctls \
11454 alc882_auto_create_input_ctls
11457 * generic initialization of ADC, input mixers and output mixers
11459 static struct hda_verb alc262_volume_init_verbs[] = {
11461 * Unmute ADC0-2 and set the default input to mic-in
11463 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11464 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11465 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11466 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11467 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11470 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11472 * Note: PASD motherboards uses the Line In 2 as the input for
11473 * front panel mic (mic 2)
11475 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11476 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11477 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11478 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11479 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11480 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11483 * Set up output mixers (0x0c - 0x0f)
11485 /* set vol=0 to output mixers */
11486 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11487 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11488 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11490 /* set up input amps for analog loopback */
11491 /* Amp Indices: DAC = 0, mixer = 1 */
11492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11494 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11495 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11496 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11497 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11499 /* FIXME: use matrix-type input source selection */
11500 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11501 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11502 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11503 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11504 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11505 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11507 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11508 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11520 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11522 * Unmute ADC0-2 and set the default input to mic-in
11524 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11526 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11527 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11528 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11529 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11531 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11533 * Note: PASD motherboards uses the Line In 2 as the input for
11534 * front panel mic (mic 2)
11536 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11537 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11538 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11539 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11540 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11541 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11542 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11546 * Set up output mixers (0x0c - 0x0e)
11548 /* set vol=0 to output mixers */
11549 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11550 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11551 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11553 /* set up input amps for analog loopback */
11554 /* Amp Indices: DAC = 0, mixer = 1 */
11555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11556 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11557 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11558 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11559 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11560 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11562 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11563 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11564 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11566 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11569 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11570 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11572 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11573 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11574 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11575 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11576 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11578 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11579 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11580 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11582 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11583 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11586 /* FIXME: use matrix-type input source selection */
11587 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11588 /* Input mixer1: only unmute Mic */
11589 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11590 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11591 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11592 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11596 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11597 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11599 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11600 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11602 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11603 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11604 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11605 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11606 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11607 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11611 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11612 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11614 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11616 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11619 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11624 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11626 * Unmute ADC0-2 and set the default input to mic-in
11628 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11629 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11630 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11632 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11633 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11635 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11637 * Note: PASD motherboards uses the Line In 2 as the input for front
11638 * panel mic (mic 2)
11640 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11650 * Set up output mixers (0x0c - 0x0e)
11652 /* set vol=0 to output mixers */
11653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11654 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11657 /* set up input amps for analog loopback */
11658 /* Amp Indices: DAC = 0, mixer = 1 */
11659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11668 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11669 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11670 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11671 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11672 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11673 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11675 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11678 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11679 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11681 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11682 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11683 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11684 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11685 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11686 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11688 /* FIXME: use matrix-type input source selection */
11689 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11690 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11691 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11692 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11693 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11696 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11699 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11700 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11701 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11702 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11704 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11707 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11712 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11715 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11720 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11722 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11723 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11724 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11726 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11727 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11729 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11732 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11733 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11738 #ifdef CONFIG_SND_HDA_POWER_SAVE
11739 #define alc262_loopbacks alc880_loopbacks
11742 /* pcm configuration: identical with ALC880 */
11743 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11744 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11745 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11746 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11749 * BIOS auto configuration
11751 static int alc262_parse_auto_config(struct hda_codec *codec)
11753 struct alc_spec *spec = codec->spec;
11755 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11757 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11761 if (!spec->autocfg.line_outs) {
11762 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11763 spec->multiout.max_channels = 2;
11764 spec->no_analog = 1;
11767 return 0; /* can't find valid BIOS pin config */
11769 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11772 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11776 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11779 if (spec->autocfg.dig_outs) {
11780 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11781 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11783 if (spec->autocfg.dig_in_pin)
11784 spec->dig_in_nid = ALC262_DIGIN_NID;
11786 if (spec->kctls.list)
11787 add_mixer(spec, spec->kctls.list);
11789 add_verb(spec, alc262_volume_init_verbs);
11790 spec->num_mux_defs = 1;
11791 spec->input_mux = &spec->private_imux[0];
11793 err = alc_auto_add_mic_boost(codec);
11797 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11802 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11803 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11804 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11805 #define alc262_auto_init_input_src alc882_auto_init_input_src
11808 /* init callback for auto-configuration model -- overriding the default init */
11809 static void alc262_auto_init(struct hda_codec *codec)
11811 struct alc_spec *spec = codec->spec;
11812 alc262_auto_init_multi_out(codec);
11813 alc262_auto_init_hp_out(codec);
11814 alc262_auto_init_analog_input(codec);
11815 alc262_auto_init_input_src(codec);
11816 if (spec->unsol_event)
11817 alc_inithook(codec);
11821 * configuration and preset
11823 static const char *alc262_models[ALC262_MODEL_LAST] = {
11824 [ALC262_BASIC] = "basic",
11825 [ALC262_HIPPO] = "hippo",
11826 [ALC262_HIPPO_1] = "hippo_1",
11827 [ALC262_FUJITSU] = "fujitsu",
11828 [ALC262_HP_BPC] = "hp-bpc",
11829 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11830 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11831 [ALC262_HP_RP5700] = "hp-rp5700",
11832 [ALC262_BENQ_ED8] = "benq",
11833 [ALC262_BENQ_T31] = "benq-t31",
11834 [ALC262_SONY_ASSAMD] = "sony-assamd",
11835 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11836 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11837 [ALC262_ULTRA] = "ultra",
11838 [ALC262_LENOVO_3000] = "lenovo-3000",
11839 [ALC262_NEC] = "nec",
11840 [ALC262_TYAN] = "tyan",
11841 [ALC262_AUTO] = "auto",
11844 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11845 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11846 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11847 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11849 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11851 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11853 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11854 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11855 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11856 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11857 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11858 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11859 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11860 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11861 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11862 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11863 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11864 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11865 ALC262_HP_TC_T5735),
11866 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11867 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11868 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11869 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11870 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11871 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11872 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11873 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11874 #if 0 /* disable the quirk since model=auto works better in recent versions */
11875 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11876 ALC262_SONY_ASSAMD),
11878 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11879 ALC262_TOSHIBA_RX1),
11880 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11881 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11882 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11883 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11884 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11886 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11887 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11888 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11889 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11890 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11894 static struct alc_config_preset alc262_presets[] = {
11896 .mixers = { alc262_base_mixer },
11897 .init_verbs = { alc262_init_verbs },
11898 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11899 .dac_nids = alc262_dac_nids,
11901 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11902 .channel_mode = alc262_modes,
11903 .input_mux = &alc262_capture_source,
11906 .mixers = { alc262_hippo_mixer },
11907 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11908 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11909 .dac_nids = alc262_dac_nids,
11911 .dig_out_nid = ALC262_DIGOUT_NID,
11912 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11913 .channel_mode = alc262_modes,
11914 .input_mux = &alc262_capture_source,
11915 .unsol_event = alc262_hippo_unsol_event,
11916 .setup = alc262_hippo_setup,
11917 .init_hook = alc262_hippo_automute,
11919 [ALC262_HIPPO_1] = {
11920 .mixers = { alc262_hippo1_mixer },
11921 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11922 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11923 .dac_nids = alc262_dac_nids,
11925 .dig_out_nid = ALC262_DIGOUT_NID,
11926 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11927 .channel_mode = alc262_modes,
11928 .input_mux = &alc262_capture_source,
11929 .unsol_event = alc262_hippo_unsol_event,
11930 .setup = alc262_hippo1_setup,
11931 .init_hook = alc262_hippo_automute,
11933 [ALC262_FUJITSU] = {
11934 .mixers = { alc262_fujitsu_mixer },
11935 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11936 alc262_fujitsu_unsol_verbs },
11937 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11938 .dac_nids = alc262_dac_nids,
11940 .dig_out_nid = ALC262_DIGOUT_NID,
11941 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11942 .channel_mode = alc262_modes,
11943 .input_mux = &alc262_fujitsu_capture_source,
11944 .unsol_event = alc262_fujitsu_unsol_event,
11945 .init_hook = alc262_fujitsu_init_hook,
11947 [ALC262_HP_BPC] = {
11948 .mixers = { alc262_HP_BPC_mixer },
11949 .init_verbs = { alc262_HP_BPC_init_verbs },
11950 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11951 .dac_nids = alc262_dac_nids,
11953 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11954 .channel_mode = alc262_modes,
11955 .input_mux = &alc262_HP_capture_source,
11956 .unsol_event = alc262_hp_bpc_unsol_event,
11957 .init_hook = alc262_hp_bpc_automute,
11959 [ALC262_HP_BPC_D7000_WF] = {
11960 .mixers = { alc262_HP_BPC_WildWest_mixer },
11961 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11962 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11963 .dac_nids = alc262_dac_nids,
11965 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11966 .channel_mode = alc262_modes,
11967 .input_mux = &alc262_HP_D7000_capture_source,
11968 .unsol_event = alc262_hp_wildwest_unsol_event,
11969 .init_hook = alc262_hp_wildwest_automute,
11971 [ALC262_HP_BPC_D7000_WL] = {
11972 .mixers = { alc262_HP_BPC_WildWest_mixer,
11973 alc262_HP_BPC_WildWest_option_mixer },
11974 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11975 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11976 .dac_nids = alc262_dac_nids,
11978 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11979 .channel_mode = alc262_modes,
11980 .input_mux = &alc262_HP_D7000_capture_source,
11981 .unsol_event = alc262_hp_wildwest_unsol_event,
11982 .init_hook = alc262_hp_wildwest_automute,
11984 [ALC262_HP_TC_T5735] = {
11985 .mixers = { alc262_hp_t5735_mixer },
11986 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11987 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11988 .dac_nids = alc262_dac_nids,
11990 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11991 .channel_mode = alc262_modes,
11992 .input_mux = &alc262_capture_source,
11993 .unsol_event = alc_sku_unsol_event,
11994 .setup = alc262_hp_t5735_setup,
11995 .init_hook = alc_inithook,
11997 [ALC262_HP_RP5700] = {
11998 .mixers = { alc262_hp_rp5700_mixer },
11999 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12000 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12001 .dac_nids = alc262_dac_nids,
12002 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12003 .channel_mode = alc262_modes,
12004 .input_mux = &alc262_hp_rp5700_capture_source,
12006 [ALC262_BENQ_ED8] = {
12007 .mixers = { alc262_base_mixer },
12008 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12009 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12010 .dac_nids = alc262_dac_nids,
12012 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12013 .channel_mode = alc262_modes,
12014 .input_mux = &alc262_capture_source,
12016 [ALC262_SONY_ASSAMD] = {
12017 .mixers = { alc262_sony_mixer },
12018 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12019 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12020 .dac_nids = alc262_dac_nids,
12022 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12023 .channel_mode = alc262_modes,
12024 .input_mux = &alc262_capture_source,
12025 .unsol_event = alc262_hippo_unsol_event,
12026 .setup = alc262_hippo_setup,
12027 .init_hook = alc262_hippo_automute,
12029 [ALC262_BENQ_T31] = {
12030 .mixers = { alc262_benq_t31_mixer },
12031 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12032 alc_hp15_unsol_verbs },
12033 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12034 .dac_nids = alc262_dac_nids,
12036 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12037 .channel_mode = alc262_modes,
12038 .input_mux = &alc262_capture_source,
12039 .unsol_event = alc262_hippo_unsol_event,
12040 .setup = alc262_hippo_setup,
12041 .init_hook = alc262_hippo_automute,
12044 .mixers = { alc262_ultra_mixer },
12045 .cap_mixer = alc262_ultra_capture_mixer,
12046 .init_verbs = { alc262_ultra_verbs },
12047 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12048 .dac_nids = alc262_dac_nids,
12049 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12050 .channel_mode = alc262_modes,
12051 .input_mux = &alc262_ultra_capture_source,
12052 .adc_nids = alc262_adc_nids, /* ADC0 */
12053 .capsrc_nids = alc262_capsrc_nids,
12054 .num_adc_nids = 1, /* single ADC */
12055 .unsol_event = alc262_ultra_unsol_event,
12056 .init_hook = alc262_ultra_automute,
12058 [ALC262_LENOVO_3000] = {
12059 .mixers = { alc262_lenovo_3000_mixer },
12060 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12061 alc262_lenovo_3000_unsol_verbs,
12062 alc262_lenovo_3000_init_verbs },
12063 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12064 .dac_nids = alc262_dac_nids,
12066 .dig_out_nid = ALC262_DIGOUT_NID,
12067 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12068 .channel_mode = alc262_modes,
12069 .input_mux = &alc262_fujitsu_capture_source,
12070 .unsol_event = alc262_lenovo_3000_unsol_event,
12073 .mixers = { alc262_nec_mixer },
12074 .init_verbs = { alc262_nec_verbs },
12075 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12076 .dac_nids = alc262_dac_nids,
12078 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12079 .channel_mode = alc262_modes,
12080 .input_mux = &alc262_capture_source,
12082 [ALC262_TOSHIBA_S06] = {
12083 .mixers = { alc262_toshiba_s06_mixer },
12084 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12085 alc262_eapd_verbs },
12086 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12087 .capsrc_nids = alc262_dmic_capsrc_nids,
12088 .dac_nids = alc262_dac_nids,
12089 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12090 .num_adc_nids = 1, /* single ADC */
12091 .dig_out_nid = ALC262_DIGOUT_NID,
12092 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12093 .channel_mode = alc262_modes,
12094 .unsol_event = alc_sku_unsol_event,
12095 .setup = alc262_toshiba_s06_setup,
12096 .init_hook = alc_inithook,
12098 [ALC262_TOSHIBA_RX1] = {
12099 .mixers = { alc262_toshiba_rx1_mixer },
12100 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12101 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12102 .dac_nids = alc262_dac_nids,
12104 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12105 .channel_mode = alc262_modes,
12106 .input_mux = &alc262_capture_source,
12107 .unsol_event = alc262_hippo_unsol_event,
12108 .setup = alc262_hippo_setup,
12109 .init_hook = alc262_hippo_automute,
12112 .mixers = { alc262_tyan_mixer },
12113 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12114 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12115 .dac_nids = alc262_dac_nids,
12117 .dig_out_nid = ALC262_DIGOUT_NID,
12118 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12119 .channel_mode = alc262_modes,
12120 .input_mux = &alc262_capture_source,
12121 .unsol_event = alc_automute_amp_unsol_event,
12122 .setup = alc262_tyan_setup,
12123 .init_hook = alc_automute_amp,
12127 static int patch_alc262(struct hda_codec *codec)
12129 struct alc_spec *spec;
12133 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12137 codec->spec = spec;
12139 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12144 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12145 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12146 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12147 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12151 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12153 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12157 if (board_config < 0) {
12158 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12160 board_config = ALC262_AUTO;
12163 if (board_config == ALC262_AUTO) {
12164 /* automatic parse from the BIOS config */
12165 err = alc262_parse_auto_config(codec);
12171 "hda_codec: Cannot set up configuration "
12172 "from BIOS. Using base mode...\n");
12173 board_config = ALC262_BASIC;
12177 if (!spec->no_analog) {
12178 err = snd_hda_attach_beep_device(codec, 0x1);
12185 if (board_config != ALC262_AUTO)
12186 setup_preset(codec, &alc262_presets[board_config]);
12188 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12189 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12191 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12192 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12194 if (!spec->adc_nids && spec->input_mux) {
12196 /* check whether the digital-mic has to be supported */
12197 for (i = 0; i < spec->input_mux->num_items; i++) {
12198 if (spec->input_mux->items[i].index >= 9)
12201 if (i < spec->input_mux->num_items) {
12202 /* use only ADC0 */
12203 spec->adc_nids = alc262_dmic_adc_nids;
12204 spec->num_adc_nids = 1;
12205 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12207 /* all analog inputs */
12208 /* check whether NID 0x07 is valid */
12209 unsigned int wcap = get_wcaps(codec, 0x07);
12212 wcap = get_wcaps_type(wcap);
12213 if (wcap != AC_WID_AUD_IN) {
12214 spec->adc_nids = alc262_adc_nids_alt;
12215 spec->num_adc_nids =
12216 ARRAY_SIZE(alc262_adc_nids_alt);
12217 spec->capsrc_nids = alc262_capsrc_nids_alt;
12219 spec->adc_nids = alc262_adc_nids;
12220 spec->num_adc_nids =
12221 ARRAY_SIZE(alc262_adc_nids);
12222 spec->capsrc_nids = alc262_capsrc_nids;
12226 if (!spec->cap_mixer && !spec->no_analog)
12227 set_capture_mixer(codec);
12228 if (!spec->no_analog)
12229 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12231 spec->vmaster_nid = 0x0c;
12233 codec->patch_ops = alc_patch_ops;
12234 if (board_config == ALC262_AUTO)
12235 spec->init_hook = alc262_auto_init;
12236 #ifdef CONFIG_SND_HDA_POWER_SAVE
12237 if (!spec->loopback.amplist)
12238 spec->loopback.amplist = alc262_loopbacks;
12245 * ALC268 channel source setting (2 channel)
12247 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12248 #define alc268_modes alc260_modes
12250 static hda_nid_t alc268_dac_nids[2] = {
12255 static hda_nid_t alc268_adc_nids[2] = {
12260 static hda_nid_t alc268_adc_nids_alt[1] = {
12265 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12267 static struct snd_kcontrol_new alc268_base_mixer[] = {
12268 /* output mixer control */
12269 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12270 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12271 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12274 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12275 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12279 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12280 /* output mixer control */
12281 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12282 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12283 ALC262_HIPPO_MASTER_SWITCH,
12284 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12285 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12286 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12290 /* bind Beep switches of both NID 0x0f and 0x10 */
12291 static struct hda_bind_ctls alc268_bind_beep_sw = {
12292 .ops = &snd_hda_bind_sw,
12294 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12295 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12300 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12301 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12302 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12306 static struct hda_verb alc268_eapd_verbs[] = {
12307 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12308 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12312 /* Toshiba specific */
12313 static struct hda_verb alc268_toshiba_verbs[] = {
12314 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12318 /* Acer specific */
12319 /* bind volumes of both NID 0x02 and 0x03 */
12320 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12321 .ops = &snd_hda_bind_vol,
12323 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12324 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12329 /* mute/unmute internal speaker according to the hp jack and mute state */
12330 static void alc268_acer_automute(struct hda_codec *codec, int force)
12332 struct alc_spec *spec = codec->spec;
12335 if (force || !spec->sense_updated) {
12336 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12337 spec->sense_updated = 1;
12339 if (spec->jack_present)
12340 mute = HDA_AMP_MUTE; /* mute internal speaker */
12341 else /* unmute internal speaker if necessary */
12342 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12343 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12344 HDA_AMP_MUTE, mute);
12348 /* bind hp and internal speaker mute (with plug check) */
12349 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12350 struct snd_ctl_elem_value *ucontrol)
12352 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12353 long *valp = ucontrol->value.integer.value;
12356 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12358 alc268_acer_automute(codec, 0);
12362 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12363 /* output mixer control */
12364 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12366 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12367 .name = "Master Playback Switch",
12368 .subdevice = HDA_SUBDEV_AMP_FLAG,
12369 .info = snd_hda_mixer_amp_switch_info,
12370 .get = snd_hda_mixer_amp_switch_get,
12371 .put = alc268_acer_master_sw_put,
12372 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12374 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12378 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12379 /* output mixer control */
12380 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12382 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12383 .name = "Master Playback Switch",
12384 .subdevice = HDA_SUBDEV_AMP_FLAG,
12385 .info = snd_hda_mixer_amp_switch_info,
12386 .get = snd_hda_mixer_amp_switch_get,
12387 .put = alc268_acer_master_sw_put,
12388 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12390 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12391 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12392 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12396 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12397 /* output mixer control */
12398 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12400 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12401 .name = "Master Playback Switch",
12402 .subdevice = HDA_SUBDEV_AMP_FLAG,
12403 .info = snd_hda_mixer_amp_switch_info,
12404 .get = snd_hda_mixer_amp_switch_get,
12405 .put = alc268_acer_master_sw_put,
12406 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12408 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12409 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12413 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12414 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12416 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12417 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12418 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12423 static struct hda_verb alc268_acer_verbs[] = {
12424 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12425 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12426 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12428 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12429 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12430 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12434 /* unsolicited event for HP jack sensing */
12435 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12436 #define alc268_toshiba_setup alc262_hippo_setup
12437 #define alc268_toshiba_automute alc262_hippo_automute
12439 static void alc268_acer_unsol_event(struct hda_codec *codec,
12442 if ((res >> 26) != ALC880_HP_EVENT)
12444 alc268_acer_automute(codec, 1);
12447 static void alc268_acer_init_hook(struct hda_codec *codec)
12449 alc268_acer_automute(codec, 1);
12452 /* toggle speaker-output according to the hp-jack state */
12453 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12455 unsigned int present;
12456 unsigned char bits;
12458 present = snd_hda_jack_detect(codec, 0x15);
12459 bits = present ? AMP_IN_MUTE(0) : 0;
12460 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12461 AMP_IN_MUTE(0), bits);
12462 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12463 AMP_IN_MUTE(0), bits);
12466 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12469 switch (res >> 26) {
12470 case ALC880_HP_EVENT:
12471 alc268_aspire_one_speaker_automute(codec);
12473 case ALC880_MIC_EVENT:
12474 alc_mic_automute(codec);
12479 static void alc268_acer_lc_setup(struct hda_codec *codec)
12481 struct alc_spec *spec = codec->spec;
12482 spec->ext_mic.pin = 0x18;
12483 spec->ext_mic.mux_idx = 0;
12484 spec->int_mic.pin = 0x12;
12485 spec->int_mic.mux_idx = 6;
12486 spec->auto_mic = 1;
12489 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12491 alc268_aspire_one_speaker_automute(codec);
12492 alc_mic_automute(codec);
12495 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12496 /* output mixer control */
12497 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12498 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12499 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12500 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12501 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12502 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12506 static struct hda_verb alc268_dell_verbs[] = {
12507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12509 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12510 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12514 /* mute/unmute internal speaker according to the hp jack and mute state */
12515 static void alc268_dell_setup(struct hda_codec *codec)
12517 struct alc_spec *spec = codec->spec;
12519 spec->autocfg.hp_pins[0] = 0x15;
12520 spec->autocfg.speaker_pins[0] = 0x14;
12521 spec->ext_mic.pin = 0x18;
12522 spec->ext_mic.mux_idx = 0;
12523 spec->int_mic.pin = 0x19;
12524 spec->int_mic.mux_idx = 1;
12525 spec->auto_mic = 1;
12528 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12529 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12530 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12531 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12532 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12533 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12534 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12535 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12536 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12540 static struct hda_verb alc267_quanta_il1_verbs[] = {
12541 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12542 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12546 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12548 struct alc_spec *spec = codec->spec;
12549 spec->autocfg.hp_pins[0] = 0x15;
12550 spec->autocfg.speaker_pins[0] = 0x14;
12551 spec->ext_mic.pin = 0x18;
12552 spec->ext_mic.mux_idx = 0;
12553 spec->int_mic.pin = 0x19;
12554 spec->int_mic.mux_idx = 1;
12555 spec->auto_mic = 1;
12559 * generic initialization of ADC, input mixers and output mixers
12561 static struct hda_verb alc268_base_init_verbs[] = {
12562 /* Unmute DAC0-1 and set vol = 0 */
12563 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12564 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12567 * Set up output mixers (0x0c - 0x0e)
12569 /* set vol=0 to output mixers */
12570 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12571 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12573 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12574 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12577 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12578 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12579 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12580 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12581 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12582 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12583 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12585 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12586 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12587 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12588 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12589 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12591 /* set PCBEEP vol = 0, mute connections */
12592 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12594 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12596 /* Unmute Selector 23h,24h and set the default input to mic-in */
12598 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12599 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12600 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12601 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12607 * generic initialization of ADC, input mixers and output mixers
12609 static struct hda_verb alc268_volume_init_verbs[] = {
12610 /* set output DAC */
12611 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12612 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12614 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12615 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12616 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12617 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12618 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12620 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12621 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12622 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12624 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12627 /* set PCBEEP vol = 0, mute connections */
12628 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12629 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12630 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12635 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12636 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12637 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12641 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12642 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12643 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12648 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12649 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12650 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12651 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12652 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12657 static struct hda_input_mux alc268_capture_source = {
12661 { "Front Mic", 0x1 },
12667 static struct hda_input_mux alc268_acer_capture_source = {
12671 { "Internal Mic", 0x1 },
12676 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12680 { "Internal Mic", 0x6 },
12685 #ifdef CONFIG_SND_DEBUG
12686 static struct snd_kcontrol_new alc268_test_mixer[] = {
12687 /* Volume widgets */
12688 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12689 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12690 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12691 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12692 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12693 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12694 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12695 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12696 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12697 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12698 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12699 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12700 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12701 /* The below appears problematic on some hardwares */
12702 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12703 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12704 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12705 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12706 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12708 /* Modes for retasking pin widgets */
12709 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12710 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12711 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12712 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12714 /* Controls for GPIO pins, assuming they are configured as outputs */
12715 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12716 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12717 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12718 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12720 /* Switches to allow the digital SPDIF output pin to be enabled.
12721 * The ALC268 does not have an SPDIF input.
12723 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12725 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12726 * this output to turn on an external amplifier.
12728 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12729 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12735 /* create input playback/capture controls for the given pin */
12736 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12737 const char *ctlname, int idx)
12753 if (spec->multiout.dac_nids[0] != dac &&
12754 spec->multiout.dac_nids[1] != dac) {
12755 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12756 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12760 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12764 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12765 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12767 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12768 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12774 /* add playback controls from the parsed DAC table */
12775 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12776 const struct auto_pin_cfg *cfg)
12781 spec->multiout.dac_nids = spec->private_dac_nids;
12783 nid = cfg->line_out_pins[0];
12786 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12790 err = alc268_new_analog_output(spec, nid, name, 0);
12795 nid = cfg->speaker_pins[0];
12797 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12798 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12802 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12806 nid = cfg->hp_pins[0];
12808 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12813 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12815 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12816 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12823 /* create playback/capture controls for input pins */
12824 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12825 const struct auto_pin_cfg *cfg)
12827 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12830 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12831 hda_nid_t nid, int pin_type)
12835 alc_set_pin_output(codec, nid, pin_type);
12836 if (nid == 0x14 || nid == 0x16)
12840 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12843 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12845 struct alc_spec *spec = codec->spec;
12846 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12848 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12849 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12853 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12855 struct alc_spec *spec = codec->spec;
12858 pin = spec->autocfg.hp_pins[0];
12860 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12861 pin = spec->autocfg.speaker_pins[0];
12863 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12866 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12868 struct alc_spec *spec = codec->spec;
12869 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12870 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12871 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12872 unsigned int dac_vol1, dac_vol2;
12874 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12875 snd_hda_codec_write(codec, speaker_nid, 0,
12876 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12877 /* mute mixer inputs from 0x1d */
12878 snd_hda_codec_write(codec, 0x0f, 0,
12879 AC_VERB_SET_AMP_GAIN_MUTE,
12881 snd_hda_codec_write(codec, 0x10, 0,
12882 AC_VERB_SET_AMP_GAIN_MUTE,
12885 /* unmute mixer inputs from 0x1d */
12886 snd_hda_codec_write(codec, 0x0f, 0,
12887 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12888 snd_hda_codec_write(codec, 0x10, 0,
12889 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12892 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12893 if (line_nid == 0x14)
12894 dac_vol2 = AMP_OUT_ZERO;
12895 else if (line_nid == 0x15)
12896 dac_vol1 = AMP_OUT_ZERO;
12897 if (hp_nid == 0x14)
12898 dac_vol2 = AMP_OUT_ZERO;
12899 else if (hp_nid == 0x15)
12900 dac_vol1 = AMP_OUT_ZERO;
12901 if (line_nid != 0x16 || hp_nid != 0x16 ||
12902 spec->autocfg.line_out_pins[1] != 0x16 ||
12903 spec->autocfg.line_out_pins[2] != 0x16)
12904 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12906 snd_hda_codec_write(codec, 0x02, 0,
12907 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12908 snd_hda_codec_write(codec, 0x03, 0,
12909 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12912 /* pcm configuration: identical with ALC880 */
12913 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12914 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12915 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12916 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12919 * BIOS auto configuration
12921 static int alc268_parse_auto_config(struct hda_codec *codec)
12923 struct alc_spec *spec = codec->spec;
12925 static hda_nid_t alc268_ignore[] = { 0 };
12927 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12931 if (!spec->autocfg.line_outs) {
12932 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12933 spec->multiout.max_channels = 2;
12934 spec->no_analog = 1;
12937 return 0; /* can't find valid BIOS pin config */
12939 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12942 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12946 spec->multiout.max_channels = 2;
12949 /* digital only support output */
12950 if (spec->autocfg.dig_outs) {
12951 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12952 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12954 if (spec->kctls.list)
12955 add_mixer(spec, spec->kctls.list);
12957 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12958 add_mixer(spec, alc268_beep_mixer);
12960 add_verb(spec, alc268_volume_init_verbs);
12961 spec->num_mux_defs = 2;
12962 spec->input_mux = &spec->private_imux[0];
12964 err = alc_auto_add_mic_boost(codec);
12968 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12973 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12975 /* init callback for auto-configuration model -- overriding the default init */
12976 static void alc268_auto_init(struct hda_codec *codec)
12978 struct alc_spec *spec = codec->spec;
12979 alc268_auto_init_multi_out(codec);
12980 alc268_auto_init_hp_out(codec);
12981 alc268_auto_init_mono_speaker_out(codec);
12982 alc268_auto_init_analog_input(codec);
12983 if (spec->unsol_event)
12984 alc_inithook(codec);
12988 * configuration and preset
12990 static const char *alc268_models[ALC268_MODEL_LAST] = {
12991 [ALC267_QUANTA_IL1] = "quanta-il1",
12992 [ALC268_3ST] = "3stack",
12993 [ALC268_TOSHIBA] = "toshiba",
12994 [ALC268_ACER] = "acer",
12995 [ALC268_ACER_DMIC] = "acer-dmic",
12996 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12997 [ALC268_DELL] = "dell",
12998 [ALC268_ZEPTO] = "zepto",
12999 #ifdef CONFIG_SND_DEBUG
13000 [ALC268_TEST] = "test",
13002 [ALC268_AUTO] = "auto",
13005 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13006 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13007 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13008 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13009 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13010 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13011 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13012 ALC268_ACER_ASPIRE_ONE),
13013 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13014 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13015 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13016 /* almost compatible with toshiba but with optional digital outs;
13017 * auto-probing seems working fine
13019 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13021 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13022 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13023 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13024 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13025 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13026 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13030 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13031 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13032 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13033 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13034 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13039 static struct alc_config_preset alc268_presets[] = {
13040 [ALC267_QUANTA_IL1] = {
13041 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13042 alc268_capture_nosrc_mixer },
13043 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13044 alc267_quanta_il1_verbs },
13045 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13046 .dac_nids = alc268_dac_nids,
13047 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13048 .adc_nids = alc268_adc_nids_alt,
13050 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13051 .channel_mode = alc268_modes,
13052 .unsol_event = alc_sku_unsol_event,
13053 .setup = alc267_quanta_il1_setup,
13054 .init_hook = alc_inithook,
13057 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13058 alc268_beep_mixer },
13059 .init_verbs = { alc268_base_init_verbs },
13060 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13061 .dac_nids = alc268_dac_nids,
13062 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13063 .adc_nids = alc268_adc_nids_alt,
13064 .capsrc_nids = alc268_capsrc_nids,
13066 .dig_out_nid = ALC268_DIGOUT_NID,
13067 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13068 .channel_mode = alc268_modes,
13069 .input_mux = &alc268_capture_source,
13071 [ALC268_TOSHIBA] = {
13072 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13073 alc268_beep_mixer },
13074 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13075 alc268_toshiba_verbs },
13076 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13077 .dac_nids = alc268_dac_nids,
13078 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13079 .adc_nids = alc268_adc_nids_alt,
13080 .capsrc_nids = alc268_capsrc_nids,
13082 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13083 .channel_mode = alc268_modes,
13084 .input_mux = &alc268_capture_source,
13085 .unsol_event = alc268_toshiba_unsol_event,
13086 .setup = alc268_toshiba_setup,
13087 .init_hook = alc268_toshiba_automute,
13090 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13091 alc268_beep_mixer },
13092 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13093 alc268_acer_verbs },
13094 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13095 .dac_nids = alc268_dac_nids,
13096 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13097 .adc_nids = alc268_adc_nids_alt,
13098 .capsrc_nids = alc268_capsrc_nids,
13100 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13101 .channel_mode = alc268_modes,
13102 .input_mux = &alc268_acer_capture_source,
13103 .unsol_event = alc268_acer_unsol_event,
13104 .init_hook = alc268_acer_init_hook,
13106 [ALC268_ACER_DMIC] = {
13107 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13108 alc268_beep_mixer },
13109 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13110 alc268_acer_verbs },
13111 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13112 .dac_nids = alc268_dac_nids,
13113 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13114 .adc_nids = alc268_adc_nids_alt,
13115 .capsrc_nids = alc268_capsrc_nids,
13117 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13118 .channel_mode = alc268_modes,
13119 .input_mux = &alc268_acer_dmic_capture_source,
13120 .unsol_event = alc268_acer_unsol_event,
13121 .init_hook = alc268_acer_init_hook,
13123 [ALC268_ACER_ASPIRE_ONE] = {
13124 .mixers = { alc268_acer_aspire_one_mixer,
13126 alc268_capture_nosrc_mixer },
13127 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13128 alc268_acer_aspire_one_verbs },
13129 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13130 .dac_nids = alc268_dac_nids,
13131 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13132 .adc_nids = alc268_adc_nids_alt,
13133 .capsrc_nids = alc268_capsrc_nids,
13135 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13136 .channel_mode = alc268_modes,
13137 .unsol_event = alc268_acer_lc_unsol_event,
13138 .setup = alc268_acer_lc_setup,
13139 .init_hook = alc268_acer_lc_init_hook,
13142 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13143 alc268_capture_nosrc_mixer },
13144 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13145 alc268_dell_verbs },
13146 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13147 .dac_nids = alc268_dac_nids,
13148 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13149 .adc_nids = alc268_adc_nids_alt,
13150 .capsrc_nids = alc268_capsrc_nids,
13152 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13153 .channel_mode = alc268_modes,
13154 .unsol_event = alc_sku_unsol_event,
13155 .setup = alc268_dell_setup,
13156 .init_hook = alc_inithook,
13159 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13160 alc268_beep_mixer },
13161 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13162 alc268_toshiba_verbs },
13163 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13164 .dac_nids = alc268_dac_nids,
13165 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13166 .adc_nids = alc268_adc_nids_alt,
13167 .capsrc_nids = alc268_capsrc_nids,
13169 .dig_out_nid = ALC268_DIGOUT_NID,
13170 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13171 .channel_mode = alc268_modes,
13172 .input_mux = &alc268_capture_source,
13173 .setup = alc268_toshiba_setup,
13174 .init_hook = alc268_toshiba_automute,
13176 #ifdef CONFIG_SND_DEBUG
13178 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13179 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13180 alc268_volume_init_verbs },
13181 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13182 .dac_nids = alc268_dac_nids,
13183 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13184 .adc_nids = alc268_adc_nids_alt,
13185 .capsrc_nids = alc268_capsrc_nids,
13187 .dig_out_nid = ALC268_DIGOUT_NID,
13188 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13189 .channel_mode = alc268_modes,
13190 .input_mux = &alc268_capture_source,
13195 static int patch_alc268(struct hda_codec *codec)
13197 struct alc_spec *spec;
13199 int i, has_beep, err;
13201 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13205 codec->spec = spec;
13207 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13211 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13212 board_config = snd_hda_check_board_codec_sid_config(codec,
13213 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13215 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13216 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13218 board_config = ALC268_AUTO;
13221 if (board_config == ALC268_AUTO) {
13222 /* automatic parse from the BIOS config */
13223 err = alc268_parse_auto_config(codec);
13229 "hda_codec: Cannot set up configuration "
13230 "from BIOS. Using base mode...\n");
13231 board_config = ALC268_3ST;
13235 if (board_config != ALC268_AUTO)
13236 setup_preset(codec, &alc268_presets[board_config]);
13238 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13239 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13240 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13242 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13245 for (i = 0; i < spec->num_mixers; i++) {
13246 if (spec->mixers[i] == alc268_beep_mixer) {
13253 err = snd_hda_attach_beep_device(codec, 0x1);
13258 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13259 /* override the amp caps for beep generator */
13260 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13261 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13262 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13263 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13264 (0 << AC_AMPCAP_MUTE_SHIFT));
13267 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13268 /* check whether NID 0x07 is valid */
13269 unsigned int wcap = get_wcaps(codec, 0x07);
13272 spec->capsrc_nids = alc268_capsrc_nids;
13274 wcap = get_wcaps_type(wcap);
13275 if (spec->auto_mic ||
13276 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13277 spec->adc_nids = alc268_adc_nids_alt;
13278 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13279 if (spec->auto_mic)
13280 fixup_automic_adc(codec);
13281 if (spec->auto_mic || spec->input_mux->num_items == 1)
13282 add_mixer(spec, alc268_capture_nosrc_mixer);
13284 add_mixer(spec, alc268_capture_alt_mixer);
13286 spec->adc_nids = alc268_adc_nids;
13287 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13288 add_mixer(spec, alc268_capture_mixer);
13290 /* set default input source */
13291 for (i = 0; i < spec->num_adc_nids; i++)
13292 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13293 0, AC_VERB_SET_CONNECT_SEL,
13294 i < spec->num_mux_defs ?
13295 spec->input_mux[i].items[0].index :
13296 spec->input_mux->items[0].index);
13299 spec->vmaster_nid = 0x02;
13301 codec->patch_ops = alc_patch_ops;
13302 if (board_config == ALC268_AUTO)
13303 spec->init_hook = alc268_auto_init;
13309 * ALC269 channel source setting (2 channel)
13311 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13313 #define alc269_dac_nids alc260_dac_nids
13315 static hda_nid_t alc269_adc_nids[1] = {
13320 static hda_nid_t alc269_capsrc_nids[1] = {
13324 static hda_nid_t alc269vb_adc_nids[1] = {
13329 static hda_nid_t alc269vb_capsrc_nids[1] = {
13333 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13337 #define alc269_modes alc260_modes
13338 #define alc269_capture_source alc880_lg_lw_capture_source
13340 static struct snd_kcontrol_new alc269_base_mixer[] = {
13341 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13342 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13343 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13344 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13345 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13346 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13347 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13348 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13349 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13350 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13352 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13356 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13357 /* output mixer control */
13358 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13360 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13361 .name = "Master Playback Switch",
13362 .subdevice = HDA_SUBDEV_AMP_FLAG,
13363 .info = snd_hda_mixer_amp_switch_info,
13364 .get = snd_hda_mixer_amp_switch_get,
13365 .put = alc268_acer_master_sw_put,
13366 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13369 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13370 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13371 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13372 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13373 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13377 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13378 /* output mixer control */
13379 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13381 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13382 .name = "Master Playback Switch",
13383 .subdevice = HDA_SUBDEV_AMP_FLAG,
13384 .info = snd_hda_mixer_amp_switch_info,
13385 .get = snd_hda_mixer_amp_switch_get,
13386 .put = alc268_acer_master_sw_put,
13387 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13391 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13392 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13393 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13394 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13395 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13396 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13397 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13401 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13402 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13403 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13404 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13405 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13409 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13410 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13411 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13412 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13413 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13417 /* capture mixer elements */
13418 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13419 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13420 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13421 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13422 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13426 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13427 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13428 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13429 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13433 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13434 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13435 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13436 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13437 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13441 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13442 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13443 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13444 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13449 #define alc269_fujitsu_mixer alc269_laptop_mixer
13451 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13452 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13453 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13455 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13456 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13457 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13461 static struct hda_verb alc269_lifebook_verbs[] = {
13462 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13463 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13464 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13466 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13467 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13468 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13469 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13470 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13471 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13475 /* toggle speaker-output according to the hp-jack state */
13476 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13478 unsigned int present;
13479 unsigned char bits;
13481 present = snd_hda_jack_detect(codec, 0x15);
13482 bits = present ? AMP_IN_MUTE(0) : 0;
13483 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13484 AMP_IN_MUTE(0), bits);
13485 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13486 AMP_IN_MUTE(0), bits);
13488 snd_hda_codec_write(codec, 0x20, 0,
13489 AC_VERB_SET_COEF_INDEX, 0x0c);
13490 snd_hda_codec_write(codec, 0x20, 0,
13491 AC_VERB_SET_PROC_COEF, 0x680);
13493 snd_hda_codec_write(codec, 0x20, 0,
13494 AC_VERB_SET_COEF_INDEX, 0x0c);
13495 snd_hda_codec_write(codec, 0x20, 0,
13496 AC_VERB_SET_PROC_COEF, 0x480);
13499 /* toggle speaker-output according to the hp-jacks state */
13500 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13502 unsigned int present;
13503 unsigned char bits;
13505 /* Check laptop headphone socket */
13506 present = snd_hda_jack_detect(codec, 0x15);
13508 /* Check port replicator headphone socket */
13509 present |= snd_hda_jack_detect(codec, 0x1a);
13511 bits = present ? AMP_IN_MUTE(0) : 0;
13512 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13513 AMP_IN_MUTE(0), bits);
13514 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13515 AMP_IN_MUTE(0), bits);
13517 snd_hda_codec_write(codec, 0x20, 0,
13518 AC_VERB_SET_COEF_INDEX, 0x0c);
13519 snd_hda_codec_write(codec, 0x20, 0,
13520 AC_VERB_SET_PROC_COEF, 0x680);
13522 snd_hda_codec_write(codec, 0x20, 0,
13523 AC_VERB_SET_COEF_INDEX, 0x0c);
13524 snd_hda_codec_write(codec, 0x20, 0,
13525 AC_VERB_SET_PROC_COEF, 0x480);
13528 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13530 unsigned int present_laptop;
13531 unsigned int present_dock;
13533 present_laptop = snd_hda_jack_detect(codec, 0x18);
13534 present_dock = snd_hda_jack_detect(codec, 0x1b);
13536 /* Laptop mic port overrides dock mic port, design decision */
13538 snd_hda_codec_write(codec, 0x23, 0,
13539 AC_VERB_SET_CONNECT_SEL, 0x3);
13540 if (present_laptop)
13541 snd_hda_codec_write(codec, 0x23, 0,
13542 AC_VERB_SET_CONNECT_SEL, 0x0);
13543 if (!present_dock && !present_laptop)
13544 snd_hda_codec_write(codec, 0x23, 0,
13545 AC_VERB_SET_CONNECT_SEL, 0x1);
13548 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13551 switch (res >> 26) {
13552 case ALC880_HP_EVENT:
13553 alc269_quanta_fl1_speaker_automute(codec);
13555 case ALC880_MIC_EVENT:
13556 alc_mic_automute(codec);
13561 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13564 if ((res >> 26) == ALC880_HP_EVENT)
13565 alc269_lifebook_speaker_automute(codec);
13566 if ((res >> 26) == ALC880_MIC_EVENT)
13567 alc269_lifebook_mic_autoswitch(codec);
13570 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13572 struct alc_spec *spec = codec->spec;
13573 spec->autocfg.hp_pins[0] = 0x15;
13574 spec->autocfg.speaker_pins[0] = 0x14;
13575 spec->ext_mic.pin = 0x18;
13576 spec->ext_mic.mux_idx = 0;
13577 spec->int_mic.pin = 0x19;
13578 spec->int_mic.mux_idx = 1;
13579 spec->auto_mic = 1;
13582 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13584 alc269_quanta_fl1_speaker_automute(codec);
13585 alc_mic_automute(codec);
13588 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13590 alc269_lifebook_speaker_automute(codec);
13591 alc269_lifebook_mic_autoswitch(codec);
13594 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13595 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13596 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13597 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13598 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13599 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13600 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13601 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13605 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13607 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13608 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13609 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13610 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13611 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13615 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13616 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13617 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13618 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13619 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13620 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13621 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13622 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13626 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13627 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13628 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13629 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13630 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13631 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13632 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13633 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13637 /* toggle speaker-output according to the hp-jack state */
13638 static void alc269_speaker_automute(struct hda_codec *codec)
13640 struct alc_spec *spec = codec->spec;
13641 unsigned int nid = spec->autocfg.hp_pins[0];
13642 unsigned int present;
13643 unsigned char bits;
13645 present = snd_hda_jack_detect(codec, nid);
13646 bits = present ? AMP_IN_MUTE(0) : 0;
13647 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13648 AMP_IN_MUTE(0), bits);
13649 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13650 AMP_IN_MUTE(0), bits);
13653 /* unsolicited event for HP jack sensing */
13654 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13657 switch (res >> 26) {
13658 case ALC880_HP_EVENT:
13659 alc269_speaker_automute(codec);
13661 case ALC880_MIC_EVENT:
13662 alc_mic_automute(codec);
13667 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13669 struct alc_spec *spec = codec->spec;
13670 spec->autocfg.hp_pins[0] = 0x15;
13671 spec->autocfg.speaker_pins[0] = 0x14;
13672 spec->ext_mic.pin = 0x18;
13673 spec->ext_mic.mux_idx = 0;
13674 spec->int_mic.pin = 0x12;
13675 spec->int_mic.mux_idx = 5;
13676 spec->auto_mic = 1;
13679 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13681 struct alc_spec *spec = codec->spec;
13682 spec->autocfg.hp_pins[0] = 0x15;
13683 spec->autocfg.speaker_pins[0] = 0x14;
13684 spec->ext_mic.pin = 0x18;
13685 spec->ext_mic.mux_idx = 0;
13686 spec->int_mic.pin = 0x12;
13687 spec->int_mic.mux_idx = 6;
13688 spec->auto_mic = 1;
13691 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13693 struct alc_spec *spec = codec->spec;
13694 spec->autocfg.hp_pins[0] = 0x15;
13695 spec->autocfg.speaker_pins[0] = 0x14;
13696 spec->ext_mic.pin = 0x18;
13697 spec->ext_mic.mux_idx = 0;
13698 spec->int_mic.pin = 0x19;
13699 spec->int_mic.mux_idx = 1;
13700 spec->auto_mic = 1;
13703 static void alc269_laptop_inithook(struct hda_codec *codec)
13705 alc269_speaker_automute(codec);
13706 alc_mic_automute(codec);
13710 * generic initialization of ADC, input mixers and output mixers
13712 static struct hda_verb alc269_init_verbs[] = {
13714 * Unmute ADC0 and set the default input to mic-in
13716 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13719 * Set up output mixers (0x02 - 0x03)
13721 /* set vol=0 to output mixers */
13722 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13723 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13725 /* set up input amps for analog loopback */
13726 /* Amp Indices: DAC = 0, mixer = 1 */
13727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13729 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13730 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13731 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13732 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13734 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13735 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13736 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13737 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13738 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13739 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13740 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13742 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13745 /* FIXME: use Mux-type input source selection */
13746 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13747 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13748 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13751 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13755 static struct hda_verb alc269vb_init_verbs[] = {
13757 * Unmute ADC0 and set the default input to mic-in
13759 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13762 * Set up output mixers (0x02 - 0x03)
13764 /* set vol=0 to output mixers */
13765 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13766 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13768 /* set up input amps for analog loopback */
13769 /* Amp Indices: DAC = 0, mixer = 1 */
13770 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13771 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13772 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13773 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13774 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13775 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13777 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13778 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13779 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13780 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13781 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13782 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13783 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13785 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13786 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13788 /* FIXME: use Mux-type input source selection */
13789 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13790 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13791 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13794 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13798 #define alc269_auto_create_multi_out_ctls \
13799 alc268_auto_create_multi_out_ctls
13800 #define alc269_auto_create_input_ctls \
13801 alc268_auto_create_input_ctls
13803 #ifdef CONFIG_SND_HDA_POWER_SAVE
13804 #define alc269_loopbacks alc880_loopbacks
13807 /* pcm configuration: identical with ALC880 */
13808 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13809 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13810 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13811 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13813 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13817 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13818 /* NID is set in alc_build_pcms */
13820 .open = alc880_playback_pcm_open,
13821 .prepare = alc880_playback_pcm_prepare,
13822 .cleanup = alc880_playback_pcm_cleanup
13826 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13830 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13831 /* NID is set in alc_build_pcms */
13835 * BIOS auto configuration
13837 static int alc269_parse_auto_config(struct hda_codec *codec)
13839 struct alc_spec *spec = codec->spec;
13841 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13842 hda_nid_t real_capsrc_nids;
13844 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13849 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13852 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13856 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13858 if (spec->autocfg.dig_outs)
13859 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13861 if (spec->kctls.list)
13862 add_mixer(spec, spec->kctls.list);
13864 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
13865 add_verb(spec, alc269vb_init_verbs);
13866 real_capsrc_nids = alc269vb_capsrc_nids[0];
13867 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
13869 add_verb(spec, alc269_init_verbs);
13870 real_capsrc_nids = alc269_capsrc_nids[0];
13871 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13874 spec->num_mux_defs = 1;
13875 spec->input_mux = &spec->private_imux[0];
13876 /* set default input source */
13877 snd_hda_codec_write_cache(codec, real_capsrc_nids,
13878 0, AC_VERB_SET_CONNECT_SEL,
13879 spec->input_mux->items[0].index);
13881 err = alc_auto_add_mic_boost(codec);
13885 if (!spec->cap_mixer && !spec->no_analog)
13886 set_capture_mixer(codec);
13891 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13892 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13893 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13896 /* init callback for auto-configuration model -- overriding the default init */
13897 static void alc269_auto_init(struct hda_codec *codec)
13899 struct alc_spec *spec = codec->spec;
13900 alc269_auto_init_multi_out(codec);
13901 alc269_auto_init_hp_out(codec);
13902 alc269_auto_init_analog_input(codec);
13903 if (spec->unsol_event)
13904 alc_inithook(codec);
13908 * configuration and preset
13910 static const char *alc269_models[ALC269_MODEL_LAST] = {
13911 [ALC269_BASIC] = "basic",
13912 [ALC269_QUANTA_FL1] = "quanta",
13913 [ALC269_AMIC] = "laptop-amic",
13914 [ALC269_DMIC] = "laptop-dmic",
13915 [ALC269_FUJITSU] = "fujitsu",
13916 [ALC269_LIFEBOOK] = "lifebook",
13917 [ALC269_AUTO] = "auto",
13920 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13921 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13922 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13924 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
13925 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
13926 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
13927 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
13928 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
13929 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
13930 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
13931 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
13932 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
13933 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
13934 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
13935 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
13936 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
13937 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
13938 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
13939 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
13940 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
13941 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
13942 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
13943 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
13944 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
13945 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
13946 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
13947 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
13948 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
13949 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
13950 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
13951 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
13952 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
13953 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
13954 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
13955 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
13956 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
13957 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
13958 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
13959 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
13960 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13962 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13964 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
13965 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
13966 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
13967 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13968 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
13969 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13970 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
13971 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
13972 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
13973 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
13977 static struct alc_config_preset alc269_presets[] = {
13979 .mixers = { alc269_base_mixer },
13980 .init_verbs = { alc269_init_verbs },
13981 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13982 .dac_nids = alc269_dac_nids,
13984 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13985 .channel_mode = alc269_modes,
13986 .input_mux = &alc269_capture_source,
13988 [ALC269_QUANTA_FL1] = {
13989 .mixers = { alc269_quanta_fl1_mixer },
13990 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13991 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13992 .dac_nids = alc269_dac_nids,
13994 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13995 .channel_mode = alc269_modes,
13996 .input_mux = &alc269_capture_source,
13997 .unsol_event = alc269_quanta_fl1_unsol_event,
13998 .setup = alc269_quanta_fl1_setup,
13999 .init_hook = alc269_quanta_fl1_init_hook,
14002 .mixers = { alc269_laptop_mixer },
14003 .cap_mixer = alc269_laptop_analog_capture_mixer,
14004 .init_verbs = { alc269_init_verbs,
14005 alc269_laptop_amic_init_verbs },
14006 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14007 .dac_nids = alc269_dac_nids,
14009 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14010 .channel_mode = alc269_modes,
14011 .unsol_event = alc269_laptop_unsol_event,
14012 .setup = alc269_laptop_amic_setup,
14013 .init_hook = alc269_laptop_inithook,
14016 .mixers = { alc269_laptop_mixer },
14017 .cap_mixer = alc269_laptop_digital_capture_mixer,
14018 .init_verbs = { alc269_init_verbs,
14019 alc269_laptop_dmic_init_verbs },
14020 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14021 .dac_nids = alc269_dac_nids,
14023 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14024 .channel_mode = alc269_modes,
14025 .unsol_event = alc269_laptop_unsol_event,
14026 .setup = alc269_laptop_dmic_setup,
14027 .init_hook = alc269_laptop_inithook,
14029 [ALC269VB_AMIC] = {
14030 .mixers = { alc269vb_laptop_mixer },
14031 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14032 .init_verbs = { alc269vb_init_verbs,
14033 alc269vb_laptop_amic_init_verbs },
14034 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14035 .dac_nids = alc269_dac_nids,
14037 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14038 .channel_mode = alc269_modes,
14039 .unsol_event = alc269_laptop_unsol_event,
14040 .setup = alc269_laptop_amic_setup,
14041 .init_hook = alc269_laptop_inithook,
14043 [ALC269VB_DMIC] = {
14044 .mixers = { alc269vb_laptop_mixer },
14045 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14046 .init_verbs = { alc269vb_init_verbs,
14047 alc269vb_laptop_dmic_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 .unsol_event = alc269_laptop_unsol_event,
14054 .setup = alc269vb_laptop_dmic_setup,
14055 .init_hook = alc269_laptop_inithook,
14057 [ALC269_FUJITSU] = {
14058 .mixers = { alc269_fujitsu_mixer },
14059 .cap_mixer = alc269_laptop_digital_capture_mixer,
14060 .init_verbs = { alc269_init_verbs,
14061 alc269_laptop_dmic_init_verbs },
14062 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14063 .dac_nids = alc269_dac_nids,
14065 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14066 .channel_mode = alc269_modes,
14067 .unsol_event = alc269_laptop_unsol_event,
14068 .setup = alc269_laptop_dmic_setup,
14069 .init_hook = alc269_laptop_inithook,
14071 [ALC269_LIFEBOOK] = {
14072 .mixers = { alc269_lifebook_mixer },
14073 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14074 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14075 .dac_nids = alc269_dac_nids,
14077 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14078 .channel_mode = alc269_modes,
14079 .input_mux = &alc269_capture_source,
14080 .unsol_event = alc269_lifebook_unsol_event,
14081 .init_hook = alc269_lifebook_init_hook,
14085 static int patch_alc269(struct hda_codec *codec)
14087 struct alc_spec *spec;
14090 int is_alc269vb = 0;
14092 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14096 codec->spec = spec;
14098 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14100 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14101 kfree(codec->chip_name);
14102 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
14103 if (!codec->chip_name) {
14110 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14114 if (board_config < 0) {
14115 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14117 board_config = ALC269_AUTO;
14120 if (board_config == ALC269_AUTO) {
14121 /* automatic parse from the BIOS config */
14122 err = alc269_parse_auto_config(codec);
14128 "hda_codec: Cannot set up configuration "
14129 "from BIOS. Using base mode...\n");
14130 board_config = ALC269_BASIC;
14134 err = snd_hda_attach_beep_device(codec, 0x1);
14140 if (board_config != ALC269_AUTO)
14141 setup_preset(codec, &alc269_presets[board_config]);
14143 if (board_config == ALC269_QUANTA_FL1) {
14144 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14145 * fix the sample rate of analog I/O to 44.1kHz
14147 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14148 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14150 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14151 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14153 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14154 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14156 if (!is_alc269vb) {
14157 spec->adc_nids = alc269_adc_nids;
14158 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14159 spec->capsrc_nids = alc269_capsrc_nids;
14161 spec->adc_nids = alc269vb_adc_nids;
14162 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14163 spec->capsrc_nids = alc269vb_capsrc_nids;
14166 if (!spec->cap_mixer)
14167 set_capture_mixer(codec);
14168 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14170 spec->vmaster_nid = 0x02;
14172 codec->patch_ops = alc_patch_ops;
14173 if (board_config == ALC269_AUTO)
14174 spec->init_hook = alc269_auto_init;
14175 #ifdef CONFIG_SND_HDA_POWER_SAVE
14176 if (!spec->loopback.amplist)
14177 spec->loopback.amplist = alc269_loopbacks;
14184 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14188 * set the path ways for 2 channel output
14189 * need to set the codec line out and mic 1 pin widgets to inputs
14191 static struct hda_verb alc861_threestack_ch2_init[] = {
14192 /* set pin widget 1Ah (line in) for input */
14193 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14194 /* set pin widget 18h (mic1/2) for input, for mic also enable
14197 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14199 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14201 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14202 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14208 * need to set the codec line out and mic 1 pin widgets to outputs
14210 static struct hda_verb alc861_threestack_ch6_init[] = {
14211 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14212 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14213 /* set pin widget 18h (mic1) for output (CLFE)*/
14214 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14216 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14217 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14219 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14221 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14222 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14227 static struct hda_channel_mode alc861_threestack_modes[2] = {
14228 { 2, alc861_threestack_ch2_init },
14229 { 6, alc861_threestack_ch6_init },
14231 /* Set mic1 as input and unmute the mixer */
14232 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14233 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14234 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14237 /* Set mic1 as output and mute mixer */
14238 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14239 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14240 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14244 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14245 { 2, alc861_uniwill_m31_ch2_init },
14246 { 4, alc861_uniwill_m31_ch4_init },
14249 /* Set mic1 and line-in as input and unmute the mixer */
14250 static struct hda_verb alc861_asus_ch2_init[] = {
14251 /* set pin widget 1Ah (line in) for input */
14252 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14253 /* set pin widget 18h (mic1/2) for input, for mic also enable
14256 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14258 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14260 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14261 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14265 /* Set mic1 nad line-in as output and mute mixer */
14266 static struct hda_verb alc861_asus_ch6_init[] = {
14267 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14268 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14269 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14270 /* set pin widget 18h (mic1) for output (CLFE)*/
14271 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14272 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14273 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14274 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14276 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14278 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14279 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14284 static struct hda_channel_mode alc861_asus_modes[2] = {
14285 { 2, alc861_asus_ch2_init },
14286 { 6, alc861_asus_ch6_init },
14291 static struct snd_kcontrol_new alc861_base_mixer[] = {
14292 /* output mixer control */
14293 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14294 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14295 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14296 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14297 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14299 /*Input mixer control */
14300 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14301 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14302 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14303 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14304 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14305 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14307 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14308 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14309 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14314 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14315 /* output mixer control */
14316 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14317 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14318 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14319 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14320 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14322 /* Input mixer control */
14323 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14324 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14325 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14326 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14327 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14328 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14329 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14330 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14331 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14332 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14335 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14336 .name = "Channel Mode",
14337 .info = alc_ch_mode_info,
14338 .get = alc_ch_mode_get,
14339 .put = alc_ch_mode_put,
14340 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14345 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14346 /* output mixer control */
14347 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14349 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14354 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14355 /* output mixer control */
14356 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14357 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14358 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14359 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14360 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14362 /* Input mixer control */
14363 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14364 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14365 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14366 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14367 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14368 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14369 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14370 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14371 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14372 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14375 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14376 .name = "Channel Mode",
14377 .info = alc_ch_mode_info,
14378 .get = alc_ch_mode_get,
14379 .put = alc_ch_mode_put,
14380 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14385 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14386 /* output mixer control */
14387 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14388 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14389 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14390 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14391 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14393 /* Input mixer control */
14394 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14395 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14396 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14397 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14398 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14399 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14401 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14402 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14406 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14407 .name = "Channel Mode",
14408 .info = alc_ch_mode_info,
14409 .get = alc_ch_mode_get,
14410 .put = alc_ch_mode_put,
14411 .private_value = ARRAY_SIZE(alc861_asus_modes),
14416 /* additional mixer */
14417 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14418 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14419 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14424 * generic initialization of ADC, input mixers and output mixers
14426 static struct hda_verb alc861_base_init_verbs[] = {
14428 * Unmute ADC0 and set the default input to mic-in
14430 /* port-A for surround (rear panel) */
14431 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14432 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14433 /* port-B for mic-in (rear panel) with vref */
14434 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14435 /* port-C for line-in (rear panel) */
14436 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14437 /* port-D for Front */
14438 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14439 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14440 /* port-E for HP out (front panel) */
14441 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14442 /* route front PCM to HP */
14443 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14444 /* port-F for mic-in (front panel) with vref */
14445 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14446 /* port-G for CLFE (rear panel) */
14447 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14448 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14449 /* port-H for side (rear panel) */
14450 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14451 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14453 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14454 /* route front mic to ADC1*/
14455 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14456 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14458 /* Unmute DAC0~3 & spdif out*/
14459 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14460 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14461 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14462 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14463 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14465 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14466 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14467 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14468 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14469 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14471 /* Unmute Stereo Mixer 15 */
14472 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14473 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14474 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14475 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14477 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14478 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14479 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14480 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14481 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14482 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14483 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14484 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14485 /* hp used DAC 3 (Front) */
14486 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14487 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14492 static struct hda_verb alc861_threestack_init_verbs[] = {
14494 * Unmute ADC0 and set the default input to mic-in
14496 /* port-A for surround (rear panel) */
14497 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14498 /* port-B for mic-in (rear panel) with vref */
14499 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14500 /* port-C for line-in (rear panel) */
14501 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14502 /* port-D for Front */
14503 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14504 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14505 /* port-E for HP out (front panel) */
14506 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14507 /* route front PCM to HP */
14508 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14509 /* port-F for mic-in (front panel) with vref */
14510 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14511 /* port-G for CLFE (rear panel) */
14512 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14513 /* port-H for side (rear panel) */
14514 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14516 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14517 /* route front mic to ADC1*/
14518 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14519 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14520 /* Unmute DAC0~3 & spdif out*/
14521 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14522 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14523 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14524 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14527 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14528 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14529 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14530 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14531 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14533 /* Unmute Stereo Mixer 15 */
14534 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14535 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14536 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14537 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14539 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14540 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14541 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14542 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14543 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14544 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14545 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14546 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14547 /* hp used DAC 3 (Front) */
14548 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14549 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14553 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14555 * Unmute ADC0 and set the default input to mic-in
14557 /* port-A for surround (rear panel) */
14558 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14559 /* port-B for mic-in (rear panel) with vref */
14560 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14561 /* port-C for line-in (rear panel) */
14562 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14563 /* port-D for Front */
14564 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14565 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14566 /* port-E for HP out (front panel) */
14567 /* this has to be set to VREF80 */
14568 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14569 /* route front PCM to HP */
14570 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14571 /* port-F for mic-in (front panel) with vref */
14572 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14573 /* port-G for CLFE (rear panel) */
14574 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14575 /* port-H for side (rear panel) */
14576 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14578 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14579 /* route front mic to ADC1*/
14580 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14581 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14582 /* Unmute DAC0~3 & spdif out*/
14583 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14584 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14585 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14586 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14587 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14589 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14590 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14591 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14592 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14593 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14595 /* Unmute Stereo Mixer 15 */
14596 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14597 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14598 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14599 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14601 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14602 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14603 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14604 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14605 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14606 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14607 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14608 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14609 /* hp used DAC 3 (Front) */
14610 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14611 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14615 static struct hda_verb alc861_asus_init_verbs[] = {
14617 * Unmute ADC0 and set the default input to mic-in
14619 /* port-A for surround (rear panel)
14620 * according to codec#0 this is the HP jack
14622 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14623 /* route front PCM to HP */
14624 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14625 /* port-B for mic-in (rear panel) with vref */
14626 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14627 /* port-C for line-in (rear panel) */
14628 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14629 /* port-D for Front */
14630 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14631 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14632 /* port-E for HP out (front panel) */
14633 /* this has to be set to VREF80 */
14634 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14635 /* route front PCM to HP */
14636 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14637 /* port-F for mic-in (front panel) with vref */
14638 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14639 /* port-G for CLFE (rear panel) */
14640 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14641 /* port-H for side (rear panel) */
14642 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14644 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14645 /* route front mic to ADC1*/
14646 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14647 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14648 /* Unmute DAC0~3 & spdif out*/
14649 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14650 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14651 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14652 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14653 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14654 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14655 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14656 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14657 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14658 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14660 /* Unmute Stereo Mixer 15 */
14661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14663 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14664 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14666 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14667 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14668 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14669 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14670 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14671 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14672 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14673 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14674 /* hp used DAC 3 (Front) */
14675 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14676 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14680 /* additional init verbs for ASUS laptops */
14681 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14682 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14683 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14688 * generic initialization of ADC, input mixers and output mixers
14690 static struct hda_verb alc861_auto_init_verbs[] = {
14692 * Unmute ADC0 and set the default input to mic-in
14694 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14695 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14697 /* Unmute DAC0~3 & spdif out*/
14698 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14699 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14700 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14701 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14704 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14705 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14706 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14707 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14708 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14710 /* Unmute Stereo Mixer 15 */
14711 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14713 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14716 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14717 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14718 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14719 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14720 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14721 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14722 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14723 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14725 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14726 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14728 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14729 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14730 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14731 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14732 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14734 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14739 static struct hda_verb alc861_toshiba_init_verbs[] = {
14740 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14745 /* toggle speaker-output according to the hp-jack state */
14746 static void alc861_toshiba_automute(struct hda_codec *codec)
14748 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14750 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14751 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14752 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14753 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14756 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14759 if ((res >> 26) == ALC880_HP_EVENT)
14760 alc861_toshiba_automute(codec);
14763 /* pcm configuration: identical with ALC880 */
14764 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14765 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14766 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14767 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14770 #define ALC861_DIGOUT_NID 0x07
14772 static struct hda_channel_mode alc861_8ch_modes[1] = {
14776 static hda_nid_t alc861_dac_nids[4] = {
14777 /* front, surround, clfe, side */
14778 0x03, 0x06, 0x05, 0x04
14781 static hda_nid_t alc660_dac_nids[3] = {
14782 /* front, clfe, surround */
14786 static hda_nid_t alc861_adc_nids[1] = {
14791 static struct hda_input_mux alc861_capture_source = {
14795 { "Front Mic", 0x3 },
14802 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14804 struct alc_spec *spec = codec->spec;
14805 hda_nid_t mix, srcs[5];
14808 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14810 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14813 for (i = 0; i < num; i++) {
14815 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14816 if (type != AC_WID_AUD_OUT)
14818 for (j = 0; j < spec->multiout.num_dacs; j++)
14819 if (spec->multiout.dac_nids[j] == srcs[i])
14821 if (j >= spec->multiout.num_dacs)
14827 /* fill in the dac_nids table from the parsed pin configuration */
14828 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14829 const struct auto_pin_cfg *cfg)
14831 struct alc_spec *spec = codec->spec;
14833 hda_nid_t nid, dac;
14835 spec->multiout.dac_nids = spec->private_dac_nids;
14836 for (i = 0; i < cfg->line_outs; i++) {
14837 nid = cfg->line_out_pins[i];
14838 dac = alc861_look_for_dac(codec, nid);
14841 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14846 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14847 hda_nid_t nid, unsigned int chs)
14849 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14850 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14853 /* add playback controls from the parsed DAC table */
14854 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14855 const struct auto_pin_cfg *cfg)
14857 struct alc_spec *spec = codec->spec;
14858 static const char *chname[4] = {
14859 "Front", "Surround", NULL /*CLFE*/, "Side"
14864 if (cfg->line_outs == 1) {
14865 const char *pfx = NULL;
14868 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14871 nid = spec->multiout.dac_nids[0];
14872 return alc861_create_out_sw(codec, pfx, nid, 3);
14876 for (i = 0; i < cfg->line_outs; i++) {
14877 nid = spec->multiout.dac_nids[i];
14882 err = alc861_create_out_sw(codec, "Center", nid, 1);
14885 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14889 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14897 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14899 struct alc_spec *spec = codec->spec;
14906 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14907 nid = alc861_look_for_dac(codec, pin);
14909 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14912 spec->multiout.hp_nid = nid;
14918 /* create playback/capture controls for input pins */
14919 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14920 const struct auto_pin_cfg *cfg)
14922 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14925 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14927 int pin_type, hda_nid_t dac)
14929 hda_nid_t mix, srcs[5];
14932 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14934 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14936 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14938 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14941 for (i = 0; i < num; i++) {
14943 if (srcs[i] == dac || srcs[i] == 0x15)
14944 mute = AMP_IN_UNMUTE(i);
14946 mute = AMP_IN_MUTE(i);
14947 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14952 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14954 struct alc_spec *spec = codec->spec;
14957 for (i = 0; i < spec->autocfg.line_outs; i++) {
14958 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14959 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14961 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14962 spec->multiout.dac_nids[i]);
14966 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14968 struct alc_spec *spec = codec->spec;
14970 if (spec->autocfg.hp_outs)
14971 alc861_auto_set_output_and_unmute(codec,
14972 spec->autocfg.hp_pins[0],
14974 spec->multiout.hp_nid);
14975 if (spec->autocfg.speaker_outs)
14976 alc861_auto_set_output_and_unmute(codec,
14977 spec->autocfg.speaker_pins[0],
14979 spec->multiout.dac_nids[0]);
14982 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14984 struct alc_spec *spec = codec->spec;
14987 for (i = 0; i < AUTO_PIN_LAST; i++) {
14988 hda_nid_t nid = spec->autocfg.input_pins[i];
14989 if (nid >= 0x0c && nid <= 0x11)
14990 alc_set_input_pin(codec, nid, i);
14994 /* parse the BIOS configuration and set up the alc_spec */
14995 /* return 1 if successful, 0 if the proper config is not found,
14996 * or a negative error code
14998 static int alc861_parse_auto_config(struct hda_codec *codec)
15000 struct alc_spec *spec = codec->spec;
15002 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15004 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15008 if (!spec->autocfg.line_outs)
15009 return 0; /* can't find valid BIOS pin config */
15011 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15014 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15017 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15020 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15024 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15026 if (spec->autocfg.dig_outs)
15027 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15029 if (spec->kctls.list)
15030 add_mixer(spec, spec->kctls.list);
15032 add_verb(spec, alc861_auto_init_verbs);
15034 spec->num_mux_defs = 1;
15035 spec->input_mux = &spec->private_imux[0];
15037 spec->adc_nids = alc861_adc_nids;
15038 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15039 set_capture_mixer(codec);
15041 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15046 /* additional initialization for auto-configuration model */
15047 static void alc861_auto_init(struct hda_codec *codec)
15049 struct alc_spec *spec = codec->spec;
15050 alc861_auto_init_multi_out(codec);
15051 alc861_auto_init_hp_out(codec);
15052 alc861_auto_init_analog_input(codec);
15053 if (spec->unsol_event)
15054 alc_inithook(codec);
15057 #ifdef CONFIG_SND_HDA_POWER_SAVE
15058 static struct hda_amp_list alc861_loopbacks[] = {
15059 { 0x15, HDA_INPUT, 0 },
15060 { 0x15, HDA_INPUT, 1 },
15061 { 0x15, HDA_INPUT, 2 },
15062 { 0x15, HDA_INPUT, 3 },
15069 * configuration and preset
15071 static const char *alc861_models[ALC861_MODEL_LAST] = {
15072 [ALC861_3ST] = "3stack",
15073 [ALC660_3ST] = "3stack-660",
15074 [ALC861_3ST_DIG] = "3stack-dig",
15075 [ALC861_6ST_DIG] = "6stack-dig",
15076 [ALC861_UNIWILL_M31] = "uniwill-m31",
15077 [ALC861_TOSHIBA] = "toshiba",
15078 [ALC861_ASUS] = "asus",
15079 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15080 [ALC861_AUTO] = "auto",
15083 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15084 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15085 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15086 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15087 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15088 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15089 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15090 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15091 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15092 * Any other models that need this preset?
15094 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15095 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15096 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15097 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15098 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15099 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15100 /* FIXME: the below seems conflict */
15101 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15102 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15103 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15107 static struct alc_config_preset alc861_presets[] = {
15109 .mixers = { alc861_3ST_mixer },
15110 .init_verbs = { alc861_threestack_init_verbs },
15111 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15112 .dac_nids = alc861_dac_nids,
15113 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15114 .channel_mode = alc861_threestack_modes,
15116 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15117 .adc_nids = alc861_adc_nids,
15118 .input_mux = &alc861_capture_source,
15120 [ALC861_3ST_DIG] = {
15121 .mixers = { alc861_base_mixer },
15122 .init_verbs = { alc861_threestack_init_verbs },
15123 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15124 .dac_nids = alc861_dac_nids,
15125 .dig_out_nid = ALC861_DIGOUT_NID,
15126 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15127 .channel_mode = alc861_threestack_modes,
15129 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15130 .adc_nids = alc861_adc_nids,
15131 .input_mux = &alc861_capture_source,
15133 [ALC861_6ST_DIG] = {
15134 .mixers = { alc861_base_mixer },
15135 .init_verbs = { alc861_base_init_verbs },
15136 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15137 .dac_nids = alc861_dac_nids,
15138 .dig_out_nid = ALC861_DIGOUT_NID,
15139 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15140 .channel_mode = alc861_8ch_modes,
15141 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15142 .adc_nids = alc861_adc_nids,
15143 .input_mux = &alc861_capture_source,
15146 .mixers = { alc861_3ST_mixer },
15147 .init_verbs = { alc861_threestack_init_verbs },
15148 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15149 .dac_nids = alc660_dac_nids,
15150 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15151 .channel_mode = alc861_threestack_modes,
15153 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15154 .adc_nids = alc861_adc_nids,
15155 .input_mux = &alc861_capture_source,
15157 [ALC861_UNIWILL_M31] = {
15158 .mixers = { alc861_uniwill_m31_mixer },
15159 .init_verbs = { alc861_uniwill_m31_init_verbs },
15160 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15161 .dac_nids = alc861_dac_nids,
15162 .dig_out_nid = ALC861_DIGOUT_NID,
15163 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15164 .channel_mode = alc861_uniwill_m31_modes,
15166 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15167 .adc_nids = alc861_adc_nids,
15168 .input_mux = &alc861_capture_source,
15170 [ALC861_TOSHIBA] = {
15171 .mixers = { alc861_toshiba_mixer },
15172 .init_verbs = { alc861_base_init_verbs,
15173 alc861_toshiba_init_verbs },
15174 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15175 .dac_nids = alc861_dac_nids,
15176 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15177 .channel_mode = alc883_3ST_2ch_modes,
15178 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15179 .adc_nids = alc861_adc_nids,
15180 .input_mux = &alc861_capture_source,
15181 .unsol_event = alc861_toshiba_unsol_event,
15182 .init_hook = alc861_toshiba_automute,
15185 .mixers = { alc861_asus_mixer },
15186 .init_verbs = { alc861_asus_init_verbs },
15187 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15188 .dac_nids = alc861_dac_nids,
15189 .dig_out_nid = ALC861_DIGOUT_NID,
15190 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15191 .channel_mode = alc861_asus_modes,
15194 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15195 .adc_nids = alc861_adc_nids,
15196 .input_mux = &alc861_capture_source,
15198 [ALC861_ASUS_LAPTOP] = {
15199 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15200 .init_verbs = { alc861_asus_init_verbs,
15201 alc861_asus_laptop_init_verbs },
15202 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15203 .dac_nids = alc861_dac_nids,
15204 .dig_out_nid = ALC861_DIGOUT_NID,
15205 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15206 .channel_mode = alc883_3ST_2ch_modes,
15208 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15209 .adc_nids = alc861_adc_nids,
15210 .input_mux = &alc861_capture_source,
15214 /* Pin config fixes */
15216 PINFIX_FSC_AMILO_PI1505,
15219 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15220 { 0x0b, 0x0221101f }, /* HP */
15221 { 0x0f, 0x90170310 }, /* speaker */
15225 static const struct alc_fixup alc861_fixups[] = {
15226 [PINFIX_FSC_AMILO_PI1505] = {
15227 .pins = alc861_fsc_amilo_pi1505_pinfix
15231 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15232 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15236 static int patch_alc861(struct hda_codec *codec)
15238 struct alc_spec *spec;
15242 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15246 codec->spec = spec;
15248 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15252 if (board_config < 0) {
15253 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15255 board_config = ALC861_AUTO;
15258 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15260 if (board_config == ALC861_AUTO) {
15261 /* automatic parse from the BIOS config */
15262 err = alc861_parse_auto_config(codec);
15268 "hda_codec: Cannot set up configuration "
15269 "from BIOS. Using base mode...\n");
15270 board_config = ALC861_3ST_DIG;
15274 err = snd_hda_attach_beep_device(codec, 0x23);
15280 if (board_config != ALC861_AUTO)
15281 setup_preset(codec, &alc861_presets[board_config]);
15283 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15284 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15286 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15287 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15289 if (!spec->cap_mixer)
15290 set_capture_mixer(codec);
15291 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15293 spec->vmaster_nid = 0x03;
15295 codec->patch_ops = alc_patch_ops;
15296 if (board_config == ALC861_AUTO) {
15297 spec->init_hook = alc861_auto_init;
15298 #ifdef CONFIG_SND_HDA_POWER_SAVE
15299 spec->power_hook = alc_power_eapd;
15302 #ifdef CONFIG_SND_HDA_POWER_SAVE
15303 if (!spec->loopback.amplist)
15304 spec->loopback.amplist = alc861_loopbacks;
15311 * ALC861-VD support
15315 * In addition, an independent DAC
15317 #define ALC861VD_DIGOUT_NID 0x06
15319 static hda_nid_t alc861vd_dac_nids[4] = {
15320 /* front, surr, clfe, side surr */
15321 0x02, 0x03, 0x04, 0x05
15324 /* dac_nids for ALC660vd are in a different order - according to
15325 * Realtek's driver.
15326 * This should probably result in a different mixer for 6stack models
15327 * of ALC660vd codecs, but for now there is only 3stack mixer
15328 * - and it is the same as in 861vd.
15329 * adc_nids in ALC660vd are (is) the same as in 861vd
15331 static hda_nid_t alc660vd_dac_nids[3] = {
15332 /* front, rear, clfe, rear_surr */
15336 static hda_nid_t alc861vd_adc_nids[1] = {
15341 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15344 /* FIXME: should be a matrix-type input source selection */
15345 static struct hda_input_mux alc861vd_capture_source = {
15349 { "Front Mic", 0x1 },
15355 static struct hda_input_mux alc861vd_dallas_capture_source = {
15358 { "Ext Mic", 0x0 },
15359 { "Int Mic", 0x1 },
15363 static struct hda_input_mux alc861vd_hp_capture_source = {
15366 { "Front Mic", 0x0 },
15367 { "ATAPI Mic", 0x1 },
15374 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15381 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15382 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15383 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15384 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15385 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15392 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15393 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15394 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15395 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15396 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15400 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15401 { 6, alc861vd_6stack_ch6_init },
15402 { 8, alc861vd_6stack_ch8_init },
15405 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15407 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15408 .name = "Channel Mode",
15409 .info = alc_ch_mode_info,
15410 .get = alc_ch_mode_get,
15411 .put = alc_ch_mode_put,
15416 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15417 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15419 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15420 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15421 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15423 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15424 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15426 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15428 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15430 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15431 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15433 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15434 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15436 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15438 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15442 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15443 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15444 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15446 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15447 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15449 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15450 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15455 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15456 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15457 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15461 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15465 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15466 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15472 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15473 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15478 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15479 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15480 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15481 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15483 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15485 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15486 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15487 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15489 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15490 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15491 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15493 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15494 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15499 /* Pin assignment: Speaker=0x14, HP = 0x15,
15500 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15502 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15503 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15504 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15505 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15506 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15507 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15508 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15509 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15510 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15511 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15512 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15516 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15517 * Front Mic=0x18, ATAPI Mic = 0x19,
15519 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15520 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15521 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15522 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15523 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15524 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15525 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15526 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15527 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15533 * generic initialization of ADC, input mixers and output mixers
15535 static struct hda_verb alc861vd_volume_init_verbs[] = {
15537 * Unmute ADC0 and set the default input to mic-in
15539 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15542 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15543 * the analog-loopback mixer widget
15545 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15552 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15559 * Set up output mixers (0x02 - 0x05)
15561 /* set vol=0 to output mixers */
15562 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15563 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15564 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15565 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15567 /* set up input amps for analog loopback */
15568 /* Amp Indices: DAC = 0, mixer = 1 */
15569 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15571 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15572 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15573 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15574 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15575 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15576 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15582 * 3-stack pin configuration:
15583 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15585 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15587 * Set pin mode and muting
15589 /* set front pin widgets 0x14 for output */
15590 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15591 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15592 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15594 /* Mic (rear) pin: input vref at 80% */
15595 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15596 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15597 /* Front Mic pin: input vref at 80% */
15598 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15599 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15600 /* Line In pin: input */
15601 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15602 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15603 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15604 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15605 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15606 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15607 /* CD pin widget for input */
15608 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15614 * 6-stack pin configuration:
15616 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15618 * Set pin mode and muting
15620 /* set front pin widgets 0x14 for output */
15621 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15622 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15623 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15625 /* Rear Pin: output 1 (0x0d) */
15626 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15628 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15629 /* CLFE Pin: output 2 (0x0e) */
15630 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15631 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15632 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15633 /* Side Pin: output 3 (0x0f) */
15634 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15635 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15636 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15638 /* Mic (rear) pin: input vref at 80% */
15639 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15640 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15641 /* Front Mic pin: input vref at 80% */
15642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15643 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15644 /* Line In pin: input */
15645 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15646 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15647 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15648 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15649 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15650 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15651 /* CD pin widget for input */
15652 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15657 static struct hda_verb alc861vd_eapd_verbs[] = {
15658 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15662 static struct hda_verb alc660vd_eapd_verbs[] = {
15663 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15664 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15668 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15670 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15671 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15672 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15673 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15677 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15679 unsigned int present;
15680 unsigned char bits;
15682 present = snd_hda_jack_detect(codec, 0x18);
15683 bits = present ? HDA_AMP_MUTE : 0;
15685 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15686 HDA_AMP_MUTE, bits);
15689 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15691 struct alc_spec *spec = codec->spec;
15692 spec->autocfg.hp_pins[0] = 0x1b;
15693 spec->autocfg.speaker_pins[0] = 0x14;
15696 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15698 alc_automute_amp(codec);
15699 alc861vd_lenovo_mic_automute(codec);
15702 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15705 switch (res >> 26) {
15706 case ALC880_MIC_EVENT:
15707 alc861vd_lenovo_mic_automute(codec);
15710 alc_automute_amp_unsol_event(codec, res);
15715 static struct hda_verb alc861vd_dallas_verbs[] = {
15716 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15717 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15718 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15719 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15724 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15728 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15731 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15732 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15734 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15735 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15736 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15737 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15739 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15745 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15746 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15750 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15751 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15753 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15754 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15755 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15760 /* toggle speaker-output according to the hp-jack state */
15761 static void alc861vd_dallas_setup(struct hda_codec *codec)
15763 struct alc_spec *spec = codec->spec;
15765 spec->autocfg.hp_pins[0] = 0x15;
15766 spec->autocfg.speaker_pins[0] = 0x14;
15769 #ifdef CONFIG_SND_HDA_POWER_SAVE
15770 #define alc861vd_loopbacks alc880_loopbacks
15773 /* pcm configuration: identical with ALC880 */
15774 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15775 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15776 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15777 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15780 * configuration and preset
15782 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15783 [ALC660VD_3ST] = "3stack-660",
15784 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15785 [ALC660VD_ASUS_V1S] = "asus-v1s",
15786 [ALC861VD_3ST] = "3stack",
15787 [ALC861VD_3ST_DIG] = "3stack-digout",
15788 [ALC861VD_6ST_DIG] = "6stack-digout",
15789 [ALC861VD_LENOVO] = "lenovo",
15790 [ALC861VD_DALLAS] = "dallas",
15791 [ALC861VD_HP] = "hp",
15792 [ALC861VD_AUTO] = "auto",
15795 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15796 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15797 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15798 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15799 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15800 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15801 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15802 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15803 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15804 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15805 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15806 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15807 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15808 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15809 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15810 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15814 static struct alc_config_preset alc861vd_presets[] = {
15816 .mixers = { alc861vd_3st_mixer },
15817 .init_verbs = { alc861vd_volume_init_verbs,
15818 alc861vd_3stack_init_verbs },
15819 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15820 .dac_nids = alc660vd_dac_nids,
15821 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15822 .channel_mode = alc861vd_3stack_2ch_modes,
15823 .input_mux = &alc861vd_capture_source,
15825 [ALC660VD_3ST_DIG] = {
15826 .mixers = { alc861vd_3st_mixer },
15827 .init_verbs = { alc861vd_volume_init_verbs,
15828 alc861vd_3stack_init_verbs },
15829 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15830 .dac_nids = alc660vd_dac_nids,
15831 .dig_out_nid = ALC861VD_DIGOUT_NID,
15832 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15833 .channel_mode = alc861vd_3stack_2ch_modes,
15834 .input_mux = &alc861vd_capture_source,
15837 .mixers = { alc861vd_3st_mixer },
15838 .init_verbs = { alc861vd_volume_init_verbs,
15839 alc861vd_3stack_init_verbs },
15840 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15841 .dac_nids = alc861vd_dac_nids,
15842 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15843 .channel_mode = alc861vd_3stack_2ch_modes,
15844 .input_mux = &alc861vd_capture_source,
15846 [ALC861VD_3ST_DIG] = {
15847 .mixers = { alc861vd_3st_mixer },
15848 .init_verbs = { alc861vd_volume_init_verbs,
15849 alc861vd_3stack_init_verbs },
15850 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15851 .dac_nids = alc861vd_dac_nids,
15852 .dig_out_nid = ALC861VD_DIGOUT_NID,
15853 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15854 .channel_mode = alc861vd_3stack_2ch_modes,
15855 .input_mux = &alc861vd_capture_source,
15857 [ALC861VD_6ST_DIG] = {
15858 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15859 .init_verbs = { alc861vd_volume_init_verbs,
15860 alc861vd_6stack_init_verbs },
15861 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15862 .dac_nids = alc861vd_dac_nids,
15863 .dig_out_nid = ALC861VD_DIGOUT_NID,
15864 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15865 .channel_mode = alc861vd_6stack_modes,
15866 .input_mux = &alc861vd_capture_source,
15868 [ALC861VD_LENOVO] = {
15869 .mixers = { alc861vd_lenovo_mixer },
15870 .init_verbs = { alc861vd_volume_init_verbs,
15871 alc861vd_3stack_init_verbs,
15872 alc861vd_eapd_verbs,
15873 alc861vd_lenovo_unsol_verbs },
15874 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15875 .dac_nids = alc660vd_dac_nids,
15876 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15877 .channel_mode = alc861vd_3stack_2ch_modes,
15878 .input_mux = &alc861vd_capture_source,
15879 .unsol_event = alc861vd_lenovo_unsol_event,
15880 .setup = alc861vd_lenovo_setup,
15881 .init_hook = alc861vd_lenovo_init_hook,
15883 [ALC861VD_DALLAS] = {
15884 .mixers = { alc861vd_dallas_mixer },
15885 .init_verbs = { alc861vd_dallas_verbs },
15886 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15887 .dac_nids = alc861vd_dac_nids,
15888 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15889 .channel_mode = alc861vd_3stack_2ch_modes,
15890 .input_mux = &alc861vd_dallas_capture_source,
15891 .unsol_event = alc_automute_amp_unsol_event,
15892 .setup = alc861vd_dallas_setup,
15893 .init_hook = alc_automute_amp,
15896 .mixers = { alc861vd_hp_mixer },
15897 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15898 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15899 .dac_nids = alc861vd_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_hp_capture_source,
15904 .unsol_event = alc_automute_amp_unsol_event,
15905 .setup = alc861vd_dallas_setup,
15906 .init_hook = alc_automute_amp,
15908 [ALC660VD_ASUS_V1S] = {
15909 .mixers = { alc861vd_lenovo_mixer },
15910 .init_verbs = { alc861vd_volume_init_verbs,
15911 alc861vd_3stack_init_verbs,
15912 alc861vd_eapd_verbs,
15913 alc861vd_lenovo_unsol_verbs },
15914 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15915 .dac_nids = alc660vd_dac_nids,
15916 .dig_out_nid = ALC861VD_DIGOUT_NID,
15917 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15918 .channel_mode = alc861vd_3stack_2ch_modes,
15919 .input_mux = &alc861vd_capture_source,
15920 .unsol_event = alc861vd_lenovo_unsol_event,
15921 .setup = alc861vd_lenovo_setup,
15922 .init_hook = alc861vd_lenovo_init_hook,
15927 * BIOS auto configuration
15929 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15930 const struct auto_pin_cfg *cfg)
15932 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15936 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15937 hda_nid_t nid, int pin_type, int dac_idx)
15939 alc_set_pin_output(codec, nid, pin_type);
15942 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15944 struct alc_spec *spec = codec->spec;
15947 for (i = 0; i <= HDA_SIDE; i++) {
15948 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15949 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15951 alc861vd_auto_set_output_and_unmute(codec, nid,
15957 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15959 struct alc_spec *spec = codec->spec;
15962 pin = spec->autocfg.hp_pins[0];
15963 if (pin) /* connect to front and use dac 0 */
15964 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15965 pin = spec->autocfg.speaker_pins[0];
15967 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15970 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15972 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15974 struct alc_spec *spec = codec->spec;
15977 for (i = 0; i < AUTO_PIN_LAST; i++) {
15978 hda_nid_t nid = spec->autocfg.input_pins[i];
15979 if (alc_is_input_pin(codec, nid)) {
15980 alc_set_input_pin(codec, nid, i);
15981 if (nid != ALC861VD_PIN_CD_NID &&
15982 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15983 snd_hda_codec_write(codec, nid, 0,
15984 AC_VERB_SET_AMP_GAIN_MUTE,
15990 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15992 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15993 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15995 /* add playback controls from the parsed DAC table */
15996 /* Based on ALC880 version. But ALC861VD has separate,
15997 * different NIDs for mute/unmute switch and volume control */
15998 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15999 const struct auto_pin_cfg *cfg)
16001 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16002 hda_nid_t nid_v, nid_s;
16005 for (i = 0; i < cfg->line_outs; i++) {
16006 if (!spec->multiout.dac_nids[i])
16008 nid_v = alc861vd_idx_to_mixer_vol(
16010 spec->multiout.dac_nids[i]));
16011 nid_s = alc861vd_idx_to_mixer_switch(
16013 spec->multiout.dac_nids[i]));
16017 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16019 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16023 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16025 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16029 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16031 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16035 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16037 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16043 if (cfg->line_outs == 1 &&
16044 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16051 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16052 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16056 if (cfg->line_outs == 1 &&
16057 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16059 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16060 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16069 /* add playback controls for speaker and HP outputs */
16070 /* Based on ALC880 version. But ALC861VD has separate,
16071 * different NIDs for mute/unmute switch and volume control */
16072 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16073 hda_nid_t pin, const char *pfx)
16075 hda_nid_t nid_v, nid_s;
16081 if (alc880_is_fixed_pin(pin)) {
16082 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16083 /* specify the DAC as the extra output */
16084 if (!spec->multiout.hp_nid)
16085 spec->multiout.hp_nid = nid_v;
16087 spec->multiout.extra_out_nid[0] = nid_v;
16088 /* control HP volume/switch on the output mixer amp */
16089 nid_v = alc861vd_idx_to_mixer_vol(
16090 alc880_fixed_pin_idx(pin));
16091 nid_s = alc861vd_idx_to_mixer_switch(
16092 alc880_fixed_pin_idx(pin));
16094 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16095 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16098 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16099 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16102 } else if (alc880_is_multi_pin(pin)) {
16103 /* set manual connection */
16104 /* we have only a switch on HP-out PIN */
16105 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16106 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16113 /* parse the BIOS configuration and set up the alc_spec
16114 * return 1 if successful, 0 if the proper config is not found,
16115 * or a negative error code
16116 * Based on ALC880 version - had to change it to override
16117 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16118 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16120 struct alc_spec *spec = codec->spec;
16122 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16124 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16128 if (!spec->autocfg.line_outs)
16129 return 0; /* can't find valid BIOS pin config */
16131 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16134 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16137 err = alc861vd_auto_create_extra_out(spec,
16138 spec->autocfg.speaker_pins[0],
16142 err = alc861vd_auto_create_extra_out(spec,
16143 spec->autocfg.hp_pins[0],
16147 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16151 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16153 if (spec->autocfg.dig_outs)
16154 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16156 if (spec->kctls.list)
16157 add_mixer(spec, spec->kctls.list);
16159 add_verb(spec, alc861vd_volume_init_verbs);
16161 spec->num_mux_defs = 1;
16162 spec->input_mux = &spec->private_imux[0];
16164 err = alc_auto_add_mic_boost(codec);
16168 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16173 /* additional initialization for auto-configuration model */
16174 static void alc861vd_auto_init(struct hda_codec *codec)
16176 struct alc_spec *spec = codec->spec;
16177 alc861vd_auto_init_multi_out(codec);
16178 alc861vd_auto_init_hp_out(codec);
16179 alc861vd_auto_init_analog_input(codec);
16180 alc861vd_auto_init_input_src(codec);
16181 if (spec->unsol_event)
16182 alc_inithook(codec);
16186 ALC660VD_FIX_ASUS_GPIO1
16190 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16191 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16192 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16193 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16197 static const struct alc_fixup alc861vd_fixups[] = {
16198 [ALC660VD_FIX_ASUS_GPIO1] = {
16199 .verbs = alc660vd_fix_asus_gpio1_verbs,
16203 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16204 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16208 static int patch_alc861vd(struct hda_codec *codec)
16210 struct alc_spec *spec;
16211 int err, board_config;
16213 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16217 codec->spec = spec;
16219 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16223 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16224 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16226 board_config = ALC861VD_AUTO;
16229 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16231 if (board_config == ALC861VD_AUTO) {
16232 /* automatic parse from the BIOS config */
16233 err = alc861vd_parse_auto_config(codec);
16239 "hda_codec: Cannot set up configuration "
16240 "from BIOS. Using base mode...\n");
16241 board_config = ALC861VD_3ST;
16245 err = snd_hda_attach_beep_device(codec, 0x23);
16251 if (board_config != ALC861VD_AUTO)
16252 setup_preset(codec, &alc861vd_presets[board_config]);
16254 if (codec->vendor_id == 0x10ec0660) {
16255 /* always turn on EAPD */
16256 add_verb(spec, alc660vd_eapd_verbs);
16259 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16260 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16262 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16263 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16265 if (!spec->adc_nids) {
16266 spec->adc_nids = alc861vd_adc_nids;
16267 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16269 if (!spec->capsrc_nids)
16270 spec->capsrc_nids = alc861vd_capsrc_nids;
16272 set_capture_mixer(codec);
16273 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16275 spec->vmaster_nid = 0x02;
16277 codec->patch_ops = alc_patch_ops;
16279 if (board_config == ALC861VD_AUTO)
16280 spec->init_hook = alc861vd_auto_init;
16281 #ifdef CONFIG_SND_HDA_POWER_SAVE
16282 if (!spec->loopback.amplist)
16283 spec->loopback.amplist = alc861vd_loopbacks;
16292 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16293 * configuration. Each pin widget can choose any input DACs and a mixer.
16294 * Each ADC is connected from a mixer of all inputs. This makes possible
16295 * 6-channel independent captures.
16297 * In addition, an independent DAC for the multi-playback (not used in this
16300 #define ALC662_DIGOUT_NID 0x06
16301 #define ALC662_DIGIN_NID 0x0a
16303 static hda_nid_t alc662_dac_nids[4] = {
16304 /* front, rear, clfe, rear_surr */
16308 static hda_nid_t alc272_dac_nids[2] = {
16312 static hda_nid_t alc662_adc_nids[2] = {
16317 static hda_nid_t alc272_adc_nids[1] = {
16322 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16323 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16327 /* FIXME: should be a matrix-type input source selection */
16328 static struct hda_input_mux alc662_capture_source = {
16332 { "Front Mic", 0x1 },
16338 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16346 static struct hda_input_mux alc663_capture_source = {
16350 { "Front Mic", 0x1 },
16355 #if 0 /* set to 1 for testing other input sources below */
16356 static struct hda_input_mux alc272_nc10_capture_source = {
16359 { "Autoselect Mic", 0x0 },
16360 { "Internal Mic", 0x1 },
16361 { "In-0x02", 0x2 },
16362 { "In-0x03", 0x3 },
16363 { "In-0x04", 0x4 },
16364 { "In-0x05", 0x5 },
16365 { "In-0x06", 0x6 },
16366 { "In-0x07", 0x7 },
16367 { "In-0x08", 0x8 },
16368 { "In-0x09", 0x9 },
16369 { "In-0x0a", 0x0a },
16370 { "In-0x0b", 0x0b },
16371 { "In-0x0c", 0x0c },
16372 { "In-0x0d", 0x0d },
16373 { "In-0x0e", 0x0e },
16374 { "In-0x0f", 0x0f },
16382 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16389 static struct hda_verb alc662_3ST_ch2_init[] = {
16390 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16391 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16392 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16393 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16400 static struct hda_verb alc662_3ST_ch6_init[] = {
16401 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16402 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16403 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16404 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16405 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16406 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16410 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16411 { 2, alc662_3ST_ch2_init },
16412 { 6, alc662_3ST_ch6_init },
16418 static struct hda_verb alc662_sixstack_ch6_init[] = {
16419 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16420 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16421 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16428 static struct hda_verb alc662_sixstack_ch8_init[] = {
16429 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16430 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16431 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16435 static struct hda_channel_mode alc662_5stack_modes[2] = {
16436 { 2, alc662_sixstack_ch6_init },
16437 { 6, alc662_sixstack_ch8_init },
16440 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16441 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16444 static struct snd_kcontrol_new alc662_base_mixer[] = {
16445 /* output mixer control */
16446 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16447 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16448 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16449 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16450 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16451 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16452 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16453 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16454 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16456 /*Input mixer control */
16457 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16458 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16459 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16460 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16461 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16462 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16463 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16464 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16468 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16469 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16470 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16471 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16472 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16473 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16474 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16475 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16476 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16477 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16478 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16479 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16483 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16484 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16485 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16486 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16487 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16488 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16489 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16490 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16491 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16492 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16493 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16494 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16495 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16496 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16499 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16500 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16504 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16505 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16506 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16507 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16508 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16509 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16510 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16511 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16513 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16517 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16518 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16519 ALC262_HIPPO_MASTER_SWITCH,
16521 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16522 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16523 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16525 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16526 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16527 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16531 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16532 ALC262_HIPPO_MASTER_SWITCH,
16533 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16534 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16535 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16536 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16537 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16538 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16539 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16541 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16545 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16546 .ops = &snd_hda_bind_vol,
16548 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16549 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16554 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16555 .ops = &snd_hda_bind_sw,
16557 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16558 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16563 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16564 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16565 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16567 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16571 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16572 .ops = &snd_hda_bind_sw,
16574 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16575 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16576 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16581 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16582 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16583 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16584 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16585 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16586 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16587 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16592 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16593 .ops = &snd_hda_bind_sw,
16595 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16596 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16597 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16602 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16603 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16604 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16605 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16606 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16607 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16608 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16612 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16613 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16614 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16615 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16618 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16619 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16623 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16624 .ops = &snd_hda_bind_vol,
16626 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16627 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16632 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16633 .ops = &snd_hda_bind_sw,
16635 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16636 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16641 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16642 HDA_BIND_VOL("Master Playback Volume",
16643 &alc663_asus_two_bind_master_vol),
16644 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16645 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16646 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16652 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16653 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16654 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16655 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16656 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16657 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16662 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16663 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16664 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16665 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16666 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16667 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16671 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16672 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16676 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16677 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16678 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16679 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16683 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16684 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16685 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16686 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16690 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16691 .ops = &snd_hda_bind_sw,
16693 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16694 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16695 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16696 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16697 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16702 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16703 .ops = &snd_hda_bind_sw,
16705 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16706 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16711 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16712 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16713 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16714 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16715 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16716 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16717 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16718 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16724 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16725 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16726 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16727 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16728 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16729 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16736 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16738 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16739 .name = "Channel Mode",
16740 .info = alc_ch_mode_info,
16741 .get = alc_ch_mode_get,
16742 .put = alc_ch_mode_put,
16747 static struct hda_verb alc662_init_verbs[] = {
16748 /* ADC: mute amp left and right */
16749 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16750 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16755 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16759 /* Front Pin: output 0 (0x0c) */
16760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16763 /* Rear Pin: output 1 (0x0d) */
16764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16767 /* CLFE Pin: output 2 (0x0e) */
16768 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16769 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16771 /* Mic (rear) pin: input vref at 80% */
16772 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16773 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16774 /* Front Mic pin: input vref at 80% */
16775 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16777 /* Line In pin: input */
16778 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16779 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16780 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16781 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16782 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16783 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16784 /* CD pin widget for input */
16785 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16787 /* FIXME: use matrix-type input source selection */
16788 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16791 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16793 /* always trun on EAPD */
16794 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16795 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16800 static struct hda_verb alc663_init_verbs[] = {
16801 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16802 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16803 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16804 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16805 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16806 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16810 static struct hda_verb alc272_init_verbs[] = {
16811 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16812 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16813 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16814 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16815 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16816 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16817 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16818 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16822 static struct hda_verb alc662_sue_init_verbs[] = {
16823 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16824 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16828 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16829 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16830 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16834 /* Set Unsolicited Event*/
16835 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16836 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16837 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16841 static struct hda_verb alc663_m51va_init_verbs[] = {
16842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16843 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16844 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16845 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16846 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16848 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16849 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16850 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16854 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16855 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16856 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16857 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16858 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16859 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16860 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16861 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16865 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16866 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16868 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16869 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16872 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16873 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16877 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16878 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16880 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16881 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16882 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16883 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16884 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16888 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16889 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16890 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16891 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16892 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16893 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16894 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16895 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16897 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16898 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16899 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16900 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16904 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16905 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16906 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16907 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16908 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16909 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16910 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16911 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16912 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16914 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16915 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16916 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16920 static struct hda_verb alc663_g71v_init_verbs[] = {
16921 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16922 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16923 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16925 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16926 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16927 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16929 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16930 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16931 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16935 static struct hda_verb alc663_g50v_init_verbs[] = {
16936 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16937 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16938 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16940 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16941 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16945 static struct hda_verb alc662_ecs_init_verbs[] = {
16946 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16947 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16948 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16949 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16953 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16954 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16955 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16956 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16957 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16958 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16959 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16960 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16961 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16962 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16963 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16964 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16968 static struct hda_verb alc272_dell_init_verbs[] = {
16969 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16970 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16971 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16972 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16973 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16974 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16975 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16976 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16977 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16978 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16979 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16983 static struct hda_verb alc663_mode7_init_verbs[] = {
16984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16985 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16986 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16987 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16988 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16989 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16990 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16991 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16992 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16993 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16996 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16997 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16998 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17002 static struct hda_verb alc663_mode8_init_verbs[] = {
17003 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17006 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17007 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17008 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17009 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17010 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17011 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17012 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17013 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17015 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17016 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17017 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17018 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17022 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17023 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17024 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17028 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17029 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17030 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17034 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17036 unsigned int present;
17037 unsigned char bits;
17039 present = snd_hda_jack_detect(codec, 0x14);
17040 bits = present ? HDA_AMP_MUTE : 0;
17042 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17043 HDA_AMP_MUTE, bits);
17046 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17048 unsigned int present;
17049 unsigned char bits;
17051 present = snd_hda_jack_detect(codec, 0x1b);
17052 bits = present ? HDA_AMP_MUTE : 0;
17054 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17055 HDA_AMP_MUTE, bits);
17056 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17057 HDA_AMP_MUTE, bits);
17060 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17063 if ((res >> 26) == ALC880_HP_EVENT)
17064 alc662_lenovo_101e_all_automute(codec);
17065 if ((res >> 26) == ALC880_FRONT_EVENT)
17066 alc662_lenovo_101e_ispeaker_automute(codec);
17069 /* unsolicited event for HP jack sensing */
17070 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17073 if ((res >> 26) == ALC880_MIC_EVENT)
17074 alc_mic_automute(codec);
17076 alc262_hippo_unsol_event(codec, res);
17079 static void alc662_eeepc_setup(struct hda_codec *codec)
17081 struct alc_spec *spec = codec->spec;
17083 alc262_hippo1_setup(codec);
17084 spec->ext_mic.pin = 0x18;
17085 spec->ext_mic.mux_idx = 0;
17086 spec->int_mic.pin = 0x19;
17087 spec->int_mic.mux_idx = 1;
17088 spec->auto_mic = 1;
17091 static void alc662_eeepc_inithook(struct hda_codec *codec)
17093 alc262_hippo_automute(codec);
17094 alc_mic_automute(codec);
17097 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17099 struct alc_spec *spec = codec->spec;
17101 spec->autocfg.hp_pins[0] = 0x14;
17102 spec->autocfg.speaker_pins[0] = 0x1b;
17105 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17107 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17109 unsigned int present;
17110 unsigned char bits;
17112 present = snd_hda_jack_detect(codec, 0x21);
17113 bits = present ? HDA_AMP_MUTE : 0;
17114 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17115 AMP_IN_MUTE(0), bits);
17116 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17117 AMP_IN_MUTE(0), bits);
17120 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17122 unsigned int present;
17123 unsigned char bits;
17125 present = snd_hda_jack_detect(codec, 0x21);
17126 bits = present ? HDA_AMP_MUTE : 0;
17127 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17128 AMP_IN_MUTE(0), bits);
17129 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17130 AMP_IN_MUTE(0), bits);
17131 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17132 AMP_IN_MUTE(0), bits);
17133 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17134 AMP_IN_MUTE(0), bits);
17137 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17139 unsigned int present;
17140 unsigned char bits;
17142 present = snd_hda_jack_detect(codec, 0x15);
17143 bits = present ? HDA_AMP_MUTE : 0;
17144 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17145 AMP_IN_MUTE(0), bits);
17146 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17147 AMP_IN_MUTE(0), bits);
17148 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17149 AMP_IN_MUTE(0), bits);
17150 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17151 AMP_IN_MUTE(0), bits);
17154 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17156 unsigned int present;
17157 unsigned char bits;
17159 present = snd_hda_jack_detect(codec, 0x1b);
17160 bits = present ? 0 : PIN_OUT;
17161 snd_hda_codec_write(codec, 0x14, 0,
17162 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17165 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17167 unsigned int present1, present2;
17169 present1 = snd_hda_jack_detect(codec, 0x21);
17170 present2 = snd_hda_jack_detect(codec, 0x15);
17172 if (present1 || present2) {
17173 snd_hda_codec_write_cache(codec, 0x14, 0,
17174 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17176 snd_hda_codec_write_cache(codec, 0x14, 0,
17177 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17181 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17183 unsigned int present1, present2;
17185 present1 = snd_hda_jack_detect(codec, 0x1b);
17186 present2 = snd_hda_jack_detect(codec, 0x15);
17188 if (present1 || present2) {
17189 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17190 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17191 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17192 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17194 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17195 AMP_IN_MUTE(0), 0);
17196 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17197 AMP_IN_MUTE(0), 0);
17201 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17203 unsigned int present1, present2;
17205 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17206 AC_VERB_GET_PIN_SENSE, 0)
17207 & AC_PINSENSE_PRESENCE;
17208 present2 = snd_hda_codec_read(codec, 0x21, 0,
17209 AC_VERB_GET_PIN_SENSE, 0)
17210 & AC_PINSENSE_PRESENCE;
17212 if (present1 || present2) {
17213 snd_hda_codec_write_cache(codec, 0x14, 0,
17214 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17215 snd_hda_codec_write_cache(codec, 0x17, 0,
17216 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17218 snd_hda_codec_write_cache(codec, 0x14, 0,
17219 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17220 snd_hda_codec_write_cache(codec, 0x17, 0,
17221 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17225 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17227 unsigned int present1, present2;
17229 present1 = snd_hda_codec_read(codec, 0x21, 0,
17230 AC_VERB_GET_PIN_SENSE, 0)
17231 & AC_PINSENSE_PRESENCE;
17232 present2 = snd_hda_codec_read(codec, 0x15, 0,
17233 AC_VERB_GET_PIN_SENSE, 0)
17234 & AC_PINSENSE_PRESENCE;
17236 if (present1 || present2) {
17237 snd_hda_codec_write_cache(codec, 0x14, 0,
17238 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17239 snd_hda_codec_write_cache(codec, 0x17, 0,
17240 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17242 snd_hda_codec_write_cache(codec, 0x14, 0,
17243 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17244 snd_hda_codec_write_cache(codec, 0x17, 0,
17245 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17249 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17252 switch (res >> 26) {
17253 case ALC880_HP_EVENT:
17254 alc663_m51va_speaker_automute(codec);
17256 case ALC880_MIC_EVENT:
17257 alc_mic_automute(codec);
17262 static void alc663_m51va_setup(struct hda_codec *codec)
17264 struct alc_spec *spec = codec->spec;
17265 spec->ext_mic.pin = 0x18;
17266 spec->ext_mic.mux_idx = 0;
17267 spec->int_mic.pin = 0x12;
17268 spec->int_mic.mux_idx = 9;
17269 spec->auto_mic = 1;
17272 static void alc663_m51va_inithook(struct hda_codec *codec)
17274 alc663_m51va_speaker_automute(codec);
17275 alc_mic_automute(codec);
17278 /* ***************** Mode1 ******************************/
17279 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17281 static void alc663_mode1_setup(struct hda_codec *codec)
17283 struct alc_spec *spec = codec->spec;
17284 spec->ext_mic.pin = 0x18;
17285 spec->ext_mic.mux_idx = 0;
17286 spec->int_mic.pin = 0x19;
17287 spec->int_mic.mux_idx = 1;
17288 spec->auto_mic = 1;
17291 #define alc663_mode1_inithook alc663_m51va_inithook
17293 /* ***************** Mode2 ******************************/
17294 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17297 switch (res >> 26) {
17298 case ALC880_HP_EVENT:
17299 alc662_f5z_speaker_automute(codec);
17301 case ALC880_MIC_EVENT:
17302 alc_mic_automute(codec);
17307 #define alc662_mode2_setup alc663_mode1_setup
17309 static void alc662_mode2_inithook(struct hda_codec *codec)
17311 alc662_f5z_speaker_automute(codec);
17312 alc_mic_automute(codec);
17314 /* ***************** Mode3 ******************************/
17315 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17318 switch (res >> 26) {
17319 case ALC880_HP_EVENT:
17320 alc663_two_hp_m1_speaker_automute(codec);
17322 case ALC880_MIC_EVENT:
17323 alc_mic_automute(codec);
17328 #define alc663_mode3_setup alc663_mode1_setup
17330 static void alc663_mode3_inithook(struct hda_codec *codec)
17332 alc663_two_hp_m1_speaker_automute(codec);
17333 alc_mic_automute(codec);
17335 /* ***************** Mode4 ******************************/
17336 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17339 switch (res >> 26) {
17340 case ALC880_HP_EVENT:
17341 alc663_21jd_two_speaker_automute(codec);
17343 case ALC880_MIC_EVENT:
17344 alc_mic_automute(codec);
17349 #define alc663_mode4_setup alc663_mode1_setup
17351 static void alc663_mode4_inithook(struct hda_codec *codec)
17353 alc663_21jd_two_speaker_automute(codec);
17354 alc_mic_automute(codec);
17356 /* ***************** Mode5 ******************************/
17357 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17360 switch (res >> 26) {
17361 case ALC880_HP_EVENT:
17362 alc663_15jd_two_speaker_automute(codec);
17364 case ALC880_MIC_EVENT:
17365 alc_mic_automute(codec);
17370 #define alc663_mode5_setup alc663_mode1_setup
17372 static void alc663_mode5_inithook(struct hda_codec *codec)
17374 alc663_15jd_two_speaker_automute(codec);
17375 alc_mic_automute(codec);
17377 /* ***************** Mode6 ******************************/
17378 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17381 switch (res >> 26) {
17382 case ALC880_HP_EVENT:
17383 alc663_two_hp_m2_speaker_automute(codec);
17385 case ALC880_MIC_EVENT:
17386 alc_mic_automute(codec);
17391 #define alc663_mode6_setup alc663_mode1_setup
17393 static void alc663_mode6_inithook(struct hda_codec *codec)
17395 alc663_two_hp_m2_speaker_automute(codec);
17396 alc_mic_automute(codec);
17399 /* ***************** Mode7 ******************************/
17400 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17403 switch (res >> 26) {
17404 case ALC880_HP_EVENT:
17405 alc663_two_hp_m7_speaker_automute(codec);
17407 case ALC880_MIC_EVENT:
17408 alc_mic_automute(codec);
17413 #define alc663_mode7_setup alc663_mode1_setup
17415 static void alc663_mode7_inithook(struct hda_codec *codec)
17417 alc663_two_hp_m7_speaker_automute(codec);
17418 alc_mic_automute(codec);
17421 /* ***************** Mode8 ******************************/
17422 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17425 switch (res >> 26) {
17426 case ALC880_HP_EVENT:
17427 alc663_two_hp_m8_speaker_automute(codec);
17429 case ALC880_MIC_EVENT:
17430 alc_mic_automute(codec);
17435 #define alc663_mode8_setup alc663_m51va_setup
17437 static void alc663_mode8_inithook(struct hda_codec *codec)
17439 alc663_two_hp_m8_speaker_automute(codec);
17440 alc_mic_automute(codec);
17443 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17445 unsigned int present;
17446 unsigned char bits;
17448 present = snd_hda_jack_detect(codec, 0x21);
17449 bits = present ? HDA_AMP_MUTE : 0;
17450 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17451 HDA_AMP_MUTE, bits);
17452 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17453 HDA_AMP_MUTE, bits);
17456 static void alc663_g71v_front_automute(struct hda_codec *codec)
17458 unsigned int present;
17459 unsigned char bits;
17461 present = snd_hda_jack_detect(codec, 0x15);
17462 bits = present ? HDA_AMP_MUTE : 0;
17463 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17464 HDA_AMP_MUTE, bits);
17467 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17470 switch (res >> 26) {
17471 case ALC880_HP_EVENT:
17472 alc663_g71v_hp_automute(codec);
17474 case ALC880_FRONT_EVENT:
17475 alc663_g71v_front_automute(codec);
17477 case ALC880_MIC_EVENT:
17478 alc_mic_automute(codec);
17483 #define alc663_g71v_setup alc663_m51va_setup
17485 static void alc663_g71v_inithook(struct hda_codec *codec)
17487 alc663_g71v_front_automute(codec);
17488 alc663_g71v_hp_automute(codec);
17489 alc_mic_automute(codec);
17492 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17495 switch (res >> 26) {
17496 case ALC880_HP_EVENT:
17497 alc663_m51va_speaker_automute(codec);
17499 case ALC880_MIC_EVENT:
17500 alc_mic_automute(codec);
17505 #define alc663_g50v_setup alc663_m51va_setup
17507 static void alc663_g50v_inithook(struct hda_codec *codec)
17509 alc663_m51va_speaker_automute(codec);
17510 alc_mic_automute(codec);
17513 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17514 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17515 ALC262_HIPPO_MASTER_SWITCH,
17517 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17518 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17519 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17521 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17522 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17523 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17527 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17528 /* Master Playback automatically created from Speaker and Headphone */
17529 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17530 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17531 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17532 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17534 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17535 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17536 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17538 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17539 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17540 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17544 #ifdef CONFIG_SND_HDA_POWER_SAVE
17545 #define alc662_loopbacks alc880_loopbacks
17549 /* pcm configuration: identical with ALC880 */
17550 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17551 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17552 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17553 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17556 * configuration and preset
17558 static const char *alc662_models[ALC662_MODEL_LAST] = {
17559 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17560 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17561 [ALC662_3ST_6ch] = "3stack-6ch",
17562 [ALC662_5ST_DIG] = "6stack-dig",
17563 [ALC662_LENOVO_101E] = "lenovo-101e",
17564 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17565 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17566 [ALC662_ECS] = "ecs",
17567 [ALC663_ASUS_M51VA] = "m51va",
17568 [ALC663_ASUS_G71V] = "g71v",
17569 [ALC663_ASUS_H13] = "h13",
17570 [ALC663_ASUS_G50V] = "g50v",
17571 [ALC663_ASUS_MODE1] = "asus-mode1",
17572 [ALC662_ASUS_MODE2] = "asus-mode2",
17573 [ALC663_ASUS_MODE3] = "asus-mode3",
17574 [ALC663_ASUS_MODE4] = "asus-mode4",
17575 [ALC663_ASUS_MODE5] = "asus-mode5",
17576 [ALC663_ASUS_MODE6] = "asus-mode6",
17577 [ALC663_ASUS_MODE7] = "asus-mode7",
17578 [ALC663_ASUS_MODE8] = "asus-mode8",
17579 [ALC272_DELL] = "dell",
17580 [ALC272_DELL_ZM1] = "dell-zm1",
17581 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17582 [ALC662_AUTO] = "auto",
17585 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17586 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17587 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17588 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17589 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17590 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17591 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17592 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17593 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17594 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17595 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17596 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17597 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17598 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17599 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17600 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17601 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17602 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17603 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17604 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17605 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17606 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17607 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17608 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17609 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17610 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17611 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17612 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17613 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17614 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17615 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17616 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17617 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17618 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17619 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17620 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17621 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17622 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17623 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17624 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17625 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17626 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17627 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17628 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17629 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17630 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17631 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17632 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17633 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17634 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17635 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17636 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17637 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17638 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17639 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17640 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17641 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17642 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17643 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17644 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17645 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17646 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17647 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17648 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17649 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17650 ALC662_3ST_6ch_DIG),
17651 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17652 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17653 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17654 ALC662_3ST_6ch_DIG),
17655 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17656 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17657 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17658 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17659 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17660 ALC662_3ST_6ch_DIG),
17661 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17663 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17667 static struct alc_config_preset alc662_presets[] = {
17668 [ALC662_3ST_2ch_DIG] = {
17669 .mixers = { alc662_3ST_2ch_mixer },
17670 .init_verbs = { alc662_init_verbs },
17671 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17672 .dac_nids = alc662_dac_nids,
17673 .dig_out_nid = ALC662_DIGOUT_NID,
17674 .dig_in_nid = ALC662_DIGIN_NID,
17675 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17676 .channel_mode = alc662_3ST_2ch_modes,
17677 .input_mux = &alc662_capture_source,
17679 [ALC662_3ST_6ch_DIG] = {
17680 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17681 .init_verbs = { alc662_init_verbs },
17682 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17683 .dac_nids = alc662_dac_nids,
17684 .dig_out_nid = ALC662_DIGOUT_NID,
17685 .dig_in_nid = ALC662_DIGIN_NID,
17686 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17687 .channel_mode = alc662_3ST_6ch_modes,
17689 .input_mux = &alc662_capture_source,
17691 [ALC662_3ST_6ch] = {
17692 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17693 .init_verbs = { alc662_init_verbs },
17694 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17695 .dac_nids = alc662_dac_nids,
17696 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17697 .channel_mode = alc662_3ST_6ch_modes,
17699 .input_mux = &alc662_capture_source,
17701 [ALC662_5ST_DIG] = {
17702 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17703 .init_verbs = { alc662_init_verbs },
17704 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17705 .dac_nids = alc662_dac_nids,
17706 .dig_out_nid = ALC662_DIGOUT_NID,
17707 .dig_in_nid = ALC662_DIGIN_NID,
17708 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17709 .channel_mode = alc662_5stack_modes,
17710 .input_mux = &alc662_capture_source,
17712 [ALC662_LENOVO_101E] = {
17713 .mixers = { alc662_lenovo_101e_mixer },
17714 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17715 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17716 .dac_nids = alc662_dac_nids,
17717 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17718 .channel_mode = alc662_3ST_2ch_modes,
17719 .input_mux = &alc662_lenovo_101e_capture_source,
17720 .unsol_event = alc662_lenovo_101e_unsol_event,
17721 .init_hook = alc662_lenovo_101e_all_automute,
17723 [ALC662_ASUS_EEEPC_P701] = {
17724 .mixers = { alc662_eeepc_p701_mixer },
17725 .init_verbs = { alc662_init_verbs,
17726 alc662_eeepc_sue_init_verbs },
17727 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17728 .dac_nids = alc662_dac_nids,
17729 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17730 .channel_mode = alc662_3ST_2ch_modes,
17731 .unsol_event = alc662_eeepc_unsol_event,
17732 .setup = alc662_eeepc_setup,
17733 .init_hook = alc662_eeepc_inithook,
17735 [ALC662_ASUS_EEEPC_EP20] = {
17736 .mixers = { alc662_eeepc_ep20_mixer,
17737 alc662_chmode_mixer },
17738 .init_verbs = { alc662_init_verbs,
17739 alc662_eeepc_ep20_sue_init_verbs },
17740 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17741 .dac_nids = alc662_dac_nids,
17742 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17743 .channel_mode = alc662_3ST_6ch_modes,
17744 .input_mux = &alc662_lenovo_101e_capture_source,
17745 .unsol_event = alc662_eeepc_unsol_event,
17746 .setup = alc662_eeepc_ep20_setup,
17747 .init_hook = alc662_eeepc_ep20_inithook,
17750 .mixers = { alc662_ecs_mixer },
17751 .init_verbs = { alc662_init_verbs,
17752 alc662_ecs_init_verbs },
17753 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17754 .dac_nids = alc662_dac_nids,
17755 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17756 .channel_mode = alc662_3ST_2ch_modes,
17757 .unsol_event = alc662_eeepc_unsol_event,
17758 .setup = alc662_eeepc_setup,
17759 .init_hook = alc662_eeepc_inithook,
17761 [ALC663_ASUS_M51VA] = {
17762 .mixers = { alc663_m51va_mixer },
17763 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17764 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17765 .dac_nids = alc662_dac_nids,
17766 .dig_out_nid = ALC662_DIGOUT_NID,
17767 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17768 .channel_mode = alc662_3ST_2ch_modes,
17769 .unsol_event = alc663_m51va_unsol_event,
17770 .setup = alc663_m51va_setup,
17771 .init_hook = alc663_m51va_inithook,
17773 [ALC663_ASUS_G71V] = {
17774 .mixers = { alc663_g71v_mixer },
17775 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17776 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17777 .dac_nids = alc662_dac_nids,
17778 .dig_out_nid = ALC662_DIGOUT_NID,
17779 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17780 .channel_mode = alc662_3ST_2ch_modes,
17781 .unsol_event = alc663_g71v_unsol_event,
17782 .setup = alc663_g71v_setup,
17783 .init_hook = alc663_g71v_inithook,
17785 [ALC663_ASUS_H13] = {
17786 .mixers = { alc663_m51va_mixer },
17787 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17788 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17789 .dac_nids = alc662_dac_nids,
17790 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17791 .channel_mode = alc662_3ST_2ch_modes,
17792 .unsol_event = alc663_m51va_unsol_event,
17793 .init_hook = alc663_m51va_inithook,
17795 [ALC663_ASUS_G50V] = {
17796 .mixers = { alc663_g50v_mixer },
17797 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17798 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17799 .dac_nids = alc662_dac_nids,
17800 .dig_out_nid = ALC662_DIGOUT_NID,
17801 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17802 .channel_mode = alc662_3ST_6ch_modes,
17803 .input_mux = &alc663_capture_source,
17804 .unsol_event = alc663_g50v_unsol_event,
17805 .setup = alc663_g50v_setup,
17806 .init_hook = alc663_g50v_inithook,
17808 [ALC663_ASUS_MODE1] = {
17809 .mixers = { alc663_m51va_mixer },
17810 .cap_mixer = alc662_auto_capture_mixer,
17811 .init_verbs = { alc662_init_verbs,
17812 alc663_21jd_amic_init_verbs },
17813 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17815 .dac_nids = alc662_dac_nids,
17816 .dig_out_nid = ALC662_DIGOUT_NID,
17817 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17818 .channel_mode = alc662_3ST_2ch_modes,
17819 .unsol_event = alc663_mode1_unsol_event,
17820 .setup = alc663_mode1_setup,
17821 .init_hook = alc663_mode1_inithook,
17823 [ALC662_ASUS_MODE2] = {
17824 .mixers = { alc662_1bjd_mixer },
17825 .cap_mixer = alc662_auto_capture_mixer,
17826 .init_verbs = { alc662_init_verbs,
17827 alc662_1bjd_amic_init_verbs },
17828 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17829 .dac_nids = alc662_dac_nids,
17830 .dig_out_nid = ALC662_DIGOUT_NID,
17831 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17832 .channel_mode = alc662_3ST_2ch_modes,
17833 .unsol_event = alc662_mode2_unsol_event,
17834 .setup = alc662_mode2_setup,
17835 .init_hook = alc662_mode2_inithook,
17837 [ALC663_ASUS_MODE3] = {
17838 .mixers = { alc663_two_hp_m1_mixer },
17839 .cap_mixer = alc662_auto_capture_mixer,
17840 .init_verbs = { alc662_init_verbs,
17841 alc663_two_hp_amic_m1_init_verbs },
17842 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17844 .dac_nids = alc662_dac_nids,
17845 .dig_out_nid = ALC662_DIGOUT_NID,
17846 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17847 .channel_mode = alc662_3ST_2ch_modes,
17848 .unsol_event = alc663_mode3_unsol_event,
17849 .setup = alc663_mode3_setup,
17850 .init_hook = alc663_mode3_inithook,
17852 [ALC663_ASUS_MODE4] = {
17853 .mixers = { alc663_asus_21jd_clfe_mixer },
17854 .cap_mixer = alc662_auto_capture_mixer,
17855 .init_verbs = { alc662_init_verbs,
17856 alc663_21jd_amic_init_verbs},
17857 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17859 .dac_nids = alc662_dac_nids,
17860 .dig_out_nid = ALC662_DIGOUT_NID,
17861 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17862 .channel_mode = alc662_3ST_2ch_modes,
17863 .unsol_event = alc663_mode4_unsol_event,
17864 .setup = alc663_mode4_setup,
17865 .init_hook = alc663_mode4_inithook,
17867 [ALC663_ASUS_MODE5] = {
17868 .mixers = { alc663_asus_15jd_clfe_mixer },
17869 .cap_mixer = alc662_auto_capture_mixer,
17870 .init_verbs = { alc662_init_verbs,
17871 alc663_15jd_amic_init_verbs },
17872 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17874 .dac_nids = alc662_dac_nids,
17875 .dig_out_nid = ALC662_DIGOUT_NID,
17876 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17877 .channel_mode = alc662_3ST_2ch_modes,
17878 .unsol_event = alc663_mode5_unsol_event,
17879 .setup = alc663_mode5_setup,
17880 .init_hook = alc663_mode5_inithook,
17882 [ALC663_ASUS_MODE6] = {
17883 .mixers = { alc663_two_hp_m2_mixer },
17884 .cap_mixer = alc662_auto_capture_mixer,
17885 .init_verbs = { alc662_init_verbs,
17886 alc663_two_hp_amic_m2_init_verbs },
17887 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17889 .dac_nids = alc662_dac_nids,
17890 .dig_out_nid = ALC662_DIGOUT_NID,
17891 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17892 .channel_mode = alc662_3ST_2ch_modes,
17893 .unsol_event = alc663_mode6_unsol_event,
17894 .setup = alc663_mode6_setup,
17895 .init_hook = alc663_mode6_inithook,
17897 [ALC663_ASUS_MODE7] = {
17898 .mixers = { alc663_mode7_mixer },
17899 .cap_mixer = alc662_auto_capture_mixer,
17900 .init_verbs = { alc662_init_verbs,
17901 alc663_mode7_init_verbs },
17902 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17904 .dac_nids = alc662_dac_nids,
17905 .dig_out_nid = ALC662_DIGOUT_NID,
17906 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17907 .channel_mode = alc662_3ST_2ch_modes,
17908 .unsol_event = alc663_mode7_unsol_event,
17909 .setup = alc663_mode7_setup,
17910 .init_hook = alc663_mode7_inithook,
17912 [ALC663_ASUS_MODE8] = {
17913 .mixers = { alc663_mode8_mixer },
17914 .cap_mixer = alc662_auto_capture_mixer,
17915 .init_verbs = { alc662_init_verbs,
17916 alc663_mode8_init_verbs },
17917 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17919 .dac_nids = alc662_dac_nids,
17920 .dig_out_nid = ALC662_DIGOUT_NID,
17921 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17922 .channel_mode = alc662_3ST_2ch_modes,
17923 .unsol_event = alc663_mode8_unsol_event,
17924 .setup = alc663_mode8_setup,
17925 .init_hook = alc663_mode8_inithook,
17928 .mixers = { alc663_m51va_mixer },
17929 .cap_mixer = alc272_auto_capture_mixer,
17930 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17931 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17932 .dac_nids = alc662_dac_nids,
17933 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17934 .adc_nids = alc272_adc_nids,
17935 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17936 .capsrc_nids = alc272_capsrc_nids,
17937 .channel_mode = alc662_3ST_2ch_modes,
17938 .unsol_event = alc663_m51va_unsol_event,
17939 .setup = alc663_m51va_setup,
17940 .init_hook = alc663_m51va_inithook,
17942 [ALC272_DELL_ZM1] = {
17943 .mixers = { alc663_m51va_mixer },
17944 .cap_mixer = alc662_auto_capture_mixer,
17945 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17946 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17947 .dac_nids = alc662_dac_nids,
17948 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17949 .adc_nids = alc662_adc_nids,
17951 .capsrc_nids = alc662_capsrc_nids,
17952 .channel_mode = alc662_3ST_2ch_modes,
17953 .unsol_event = alc663_m51va_unsol_event,
17954 .setup = alc663_m51va_setup,
17955 .init_hook = alc663_m51va_inithook,
17957 [ALC272_SAMSUNG_NC10] = {
17958 .mixers = { alc272_nc10_mixer },
17959 .init_verbs = { alc662_init_verbs,
17960 alc663_21jd_amic_init_verbs },
17961 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17962 .dac_nids = alc272_dac_nids,
17963 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17964 .channel_mode = alc662_3ST_2ch_modes,
17965 /*.input_mux = &alc272_nc10_capture_source,*/
17966 .unsol_event = alc663_mode4_unsol_event,
17967 .setup = alc663_mode4_setup,
17968 .init_hook = alc663_mode4_inithook,
17974 * BIOS auto configuration
17977 /* convert from MIX nid to DAC */
17978 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17982 else if (nid >= 0x0c && nid <= 0x0e)
17983 return nid - 0x0c + 0x02;
17988 /* get MIX nid connected to the given pin targeted to DAC */
17989 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17995 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17996 for (i = 0; i < num; i++) {
17997 if (alc662_mix_to_dac(mix[i]) == dac)
18003 /* look for an empty DAC slot */
18004 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18006 struct alc_spec *spec = codec->spec;
18010 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18013 for (i = 0; i < num; i++) {
18014 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18017 for (j = 0; j < spec->multiout.num_dacs; j++)
18018 if (spec->multiout.dac_nids[j] == nid)
18020 if (j >= spec->multiout.num_dacs)
18026 /* fill in the dac_nids table from the parsed pin configuration */
18027 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18028 const struct auto_pin_cfg *cfg)
18030 struct alc_spec *spec = codec->spec;
18034 spec->multiout.dac_nids = spec->private_dac_nids;
18035 for (i = 0; i < cfg->line_outs; i++) {
18036 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18039 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18044 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18045 hda_nid_t nid, unsigned int chs)
18047 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18048 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18051 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18052 hda_nid_t nid, unsigned int chs)
18054 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18055 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18058 #define alc662_add_stereo_vol(spec, pfx, nid) \
18059 alc662_add_vol_ctl(spec, pfx, nid, 3)
18060 #define alc662_add_stereo_sw(spec, pfx, nid) \
18061 alc662_add_sw_ctl(spec, pfx, nid, 3)
18063 /* add playback controls from the parsed DAC table */
18064 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18065 const struct auto_pin_cfg *cfg)
18067 struct alc_spec *spec = codec->spec;
18068 static const char *chname[4] = {
18069 "Front", "Surround", NULL /*CLFE*/, "Side"
18071 hda_nid_t nid, mix;
18074 for (i = 0; i < cfg->line_outs; i++) {
18075 nid = spec->multiout.dac_nids[i];
18078 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18083 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18086 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18089 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18092 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18097 if (cfg->line_outs == 1 &&
18098 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18105 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18108 if (cfg->line_outs == 1 &&
18109 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18111 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18119 /* add playback controls for speaker and HP outputs */
18120 /* return DAC nid if any new DAC is assigned */
18121 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18124 struct alc_spec *spec = codec->spec;
18125 hda_nid_t nid, mix;
18130 nid = alc662_look_for_dac(codec, pin);
18132 /* the corresponding DAC is already occupied */
18133 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18134 return 0; /* no way */
18135 /* create a switch only */
18136 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18137 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18140 mix = alc662_dac_to_mix(codec, pin, nid);
18143 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18146 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18152 /* create playback/capture controls for input pins */
18153 #define alc662_auto_create_input_ctls \
18154 alc882_auto_create_input_ctls
18156 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18157 hda_nid_t nid, int pin_type,
18163 alc_set_pin_output(codec, nid, pin_type);
18164 /* need the manual connection? */
18165 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18168 for (i = 0; i < num; i++) {
18169 if (alc662_mix_to_dac(srcs[i]) != dac)
18171 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18176 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18178 struct alc_spec *spec = codec->spec;
18179 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18182 for (i = 0; i <= HDA_SIDE; i++) {
18183 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18185 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18186 spec->multiout.dac_nids[i]);
18190 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18192 struct alc_spec *spec = codec->spec;
18195 pin = spec->autocfg.hp_pins[0];
18197 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18198 spec->multiout.hp_nid);
18199 pin = spec->autocfg.speaker_pins[0];
18201 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18202 spec->multiout.extra_out_nid[0]);
18205 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18207 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18209 struct alc_spec *spec = codec->spec;
18212 for (i = 0; i < AUTO_PIN_LAST; i++) {
18213 hda_nid_t nid = spec->autocfg.input_pins[i];
18214 if (alc_is_input_pin(codec, nid)) {
18215 alc_set_input_pin(codec, nid, i);
18216 if (nid != ALC662_PIN_CD_NID &&
18217 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18218 snd_hda_codec_write(codec, nid, 0,
18219 AC_VERB_SET_AMP_GAIN_MUTE,
18225 #define alc662_auto_init_input_src alc882_auto_init_input_src
18227 static int alc662_parse_auto_config(struct hda_codec *codec)
18229 struct alc_spec *spec = codec->spec;
18231 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18233 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18237 if (!spec->autocfg.line_outs)
18238 return 0; /* can't find valid BIOS pin config */
18240 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18243 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18246 err = alc662_auto_create_extra_out(codec,
18247 spec->autocfg.speaker_pins[0],
18252 spec->multiout.extra_out_nid[0] = err;
18253 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18258 spec->multiout.hp_nid = err;
18259 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18263 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18265 if (spec->autocfg.dig_outs)
18266 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18268 if (spec->kctls.list)
18269 add_mixer(spec, spec->kctls.list);
18271 spec->num_mux_defs = 1;
18272 spec->input_mux = &spec->private_imux[0];
18274 add_verb(spec, alc662_init_verbs);
18275 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18276 codec->vendor_id == 0x10ec0665)
18277 add_verb(spec, alc663_init_verbs);
18279 if (codec->vendor_id == 0x10ec0272)
18280 add_verb(spec, alc272_init_verbs);
18282 err = alc_auto_add_mic_boost(codec);
18286 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18287 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18288 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18290 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18295 /* additional initialization for auto-configuration model */
18296 static void alc662_auto_init(struct hda_codec *codec)
18298 struct alc_spec *spec = codec->spec;
18299 alc662_auto_init_multi_out(codec);
18300 alc662_auto_init_hp_out(codec);
18301 alc662_auto_init_analog_input(codec);
18302 alc662_auto_init_input_src(codec);
18303 if (spec->unsol_event)
18304 alc_inithook(codec);
18307 static int patch_alc662(struct hda_codec *codec)
18309 struct alc_spec *spec;
18310 int err, board_config;
18312 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18316 codec->spec = spec;
18318 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18320 if (alc_read_coef_idx(codec, 0)==0x8020){
18321 kfree(codec->chip_name);
18322 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18323 if (!codec->chip_name) {
18329 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18332 if (board_config < 0) {
18333 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18335 board_config = ALC662_AUTO;
18338 if (board_config == ALC662_AUTO) {
18339 /* automatic parse from the BIOS config */
18340 err = alc662_parse_auto_config(codec);
18346 "hda_codec: Cannot set up configuration "
18347 "from BIOS. Using base mode...\n");
18348 board_config = ALC662_3ST_2ch_DIG;
18352 err = snd_hda_attach_beep_device(codec, 0x1);
18358 if (board_config != ALC662_AUTO)
18359 setup_preset(codec, &alc662_presets[board_config]);
18361 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18362 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18364 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18365 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18367 if (!spec->adc_nids) {
18368 spec->adc_nids = alc662_adc_nids;
18369 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18371 if (!spec->capsrc_nids)
18372 spec->capsrc_nids = alc662_capsrc_nids;
18374 if (!spec->cap_mixer)
18375 set_capture_mixer(codec);
18377 switch (codec->vendor_id) {
18379 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18384 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18387 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18390 spec->vmaster_nid = 0x02;
18392 codec->patch_ops = alc_patch_ops;
18393 if (board_config == ALC662_AUTO)
18394 spec->init_hook = alc662_auto_init;
18395 #ifdef CONFIG_SND_HDA_POWER_SAVE
18396 if (!spec->loopback.amplist)
18397 spec->loopback.amplist = alc662_loopbacks;
18403 static int patch_alc888(struct hda_codec *codec)
18405 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18406 kfree(codec->chip_name);
18407 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18408 if (!codec->chip_name) {
18412 return patch_alc662(codec);
18414 return patch_alc882(codec);
18420 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18421 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18422 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18423 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18424 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18425 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18426 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18427 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18428 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18429 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18430 .patch = patch_alc861 },
18431 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18432 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18433 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18434 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18435 .patch = patch_alc882 },
18436 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18437 .patch = patch_alc662 },
18438 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18439 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18440 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18441 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18442 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18443 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18444 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18445 .patch = patch_alc882 },
18446 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18447 .patch = patch_alc882 },
18448 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18449 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18450 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18451 .patch = patch_alc882 },
18452 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18453 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18454 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18455 {} /* terminator */
18458 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18460 MODULE_LICENSE("GPL");
18461 MODULE_DESCRIPTION("Realtek HD-audio codec");
18463 static struct hda_codec_preset_list realtek_list = {
18464 .preset = snd_hda_preset_realtek,
18465 .owner = THIS_MODULE,
18468 static int __init patch_realtek_init(void)
18470 return snd_hda_add_codec_preset(&realtek_list);
18473 static void __exit patch_realtek_exit(void)
18475 snd_hda_delete_codec_preset(&realtek_list);
18478 module_init(patch_realtek_init)
18479 module_exit(patch_realtek_exit)