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 */
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
219 ALC883_TARGA_2ch_DIG,
220 ALC883_TARGA_8ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
224 ALC888_ACER_ASPIRE_6530G,
225 ALC888_ACER_ASPIRE_8930G,
226 ALC888_ACER_ASPIRE_7730G,
230 ALC883_LENOVO_101E_2ch,
231 ALC883_LENOVO_NB0763,
232 ALC888_LENOVO_MS7195_DIG,
240 ALC883_FUJITSU_PI2515,
241 ALC888_FUJITSU_XA3530,
242 ALC883_3ST_6ch_INTEL,
255 #define GPIO_MASK 0x03
257 /* extra amp-initialization sequence types */
266 struct alc_mic_route {
268 unsigned char mux_idx;
269 unsigned char amix_idx;
272 #define MUX_IDX_UNDEF ((unsigned char)-1)
275 /* codec parameterization */
276 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
277 unsigned int num_mixers;
278 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
279 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
281 const struct hda_verb *init_verbs[10]; /* initialization verbs
285 unsigned int num_init_verbs;
287 char stream_name_analog[32]; /* analog PCM stream */
288 struct hda_pcm_stream *stream_analog_playback;
289 struct hda_pcm_stream *stream_analog_capture;
290 struct hda_pcm_stream *stream_analog_alt_playback;
291 struct hda_pcm_stream *stream_analog_alt_capture;
293 char stream_name_digital[32]; /* digital PCM stream */
294 struct hda_pcm_stream *stream_digital_playback;
295 struct hda_pcm_stream *stream_digital_capture;
298 struct hda_multi_out multiout; /* playback set-up
299 * max_channels, dacs must be set
300 * dig_out_nid and hp_nid are optional
302 hda_nid_t alt_dac_nid;
303 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
307 unsigned int num_adc_nids;
309 hda_nid_t *capsrc_nids;
310 hda_nid_t dig_in_nid; /* digital-in NID; optional */
313 unsigned int num_mux_defs;
314 const struct hda_input_mux *input_mux;
315 unsigned int cur_mux[3];
316 struct alc_mic_route ext_mic;
317 struct alc_mic_route int_mic;
320 const struct hda_channel_mode *channel_mode;
321 int num_channel_mode;
323 int const_channel_count;
324 int ext_channel_count;
326 /* PCM information */
327 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
329 /* dynamic controls, init_verbs and input_mux */
330 struct auto_pin_cfg autocfg;
331 struct snd_array kctls;
332 struct hda_input_mux private_imux[3];
333 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
334 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
335 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340 #ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec, int power);
344 /* for pin sensing */
345 unsigned int sense_updated: 1;
346 unsigned int jack_present: 1;
347 unsigned int master_sw: 1;
348 unsigned int auto_mic:1;
351 unsigned int no_analog :1; /* digital I/O only */
354 /* for virtual master */
355 hda_nid_t vmaster_nid;
356 #ifdef CONFIG_SND_HDA_POWER_SAVE
357 struct hda_loopback_check loopback;
362 unsigned int pll_coef_idx, pll_coef_bit;
366 * configuration template - to be copied to the spec instance
368 struct alc_config_preset {
369 struct snd_kcontrol_new *mixers[5]; /* should be identical size
372 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
373 const struct hda_verb *init_verbs[5];
374 unsigned int num_dacs;
376 hda_nid_t dig_out_nid; /* optional */
377 hda_nid_t hp_nid; /* optional */
378 hda_nid_t *slave_dig_outs;
379 unsigned int num_adc_nids;
381 hda_nid_t *capsrc_nids;
382 hda_nid_t dig_in_nid;
383 unsigned int num_channel_mode;
384 const struct hda_channel_mode *channel_mode;
386 int const_channel_count;
387 unsigned int num_mux_defs;
388 const struct hda_input_mux *input_mux;
389 void (*unsol_event)(struct hda_codec *, unsigned int);
390 void (*setup)(struct hda_codec *);
391 void (*init_hook)(struct hda_codec *);
392 #ifdef CONFIG_SND_HDA_POWER_SAVE
393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec, int power);
402 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
403 struct snd_ctl_elem_info *uinfo)
405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
406 struct alc_spec *spec = codec->spec;
407 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
408 if (mux_idx >= spec->num_mux_defs)
410 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
413 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
414 struct snd_ctl_elem_value *ucontrol)
416 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
417 struct alc_spec *spec = codec->spec;
418 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
420 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
424 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_value *ucontrol)
427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
428 struct alc_spec *spec = codec->spec;
429 const struct hda_input_mux *imux;
430 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
431 unsigned int mux_idx;
432 hda_nid_t nid = spec->capsrc_nids ?
433 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
436 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
437 imux = &spec->input_mux[mux_idx];
439 type = get_wcaps_type(get_wcaps(codec, nid));
440 if (type == AC_WID_AUD_MIX) {
441 /* Matrix-mixer style (e.g. ALC882) */
442 unsigned int *cur_val = &spec->cur_mux[adc_idx];
445 idx = ucontrol->value.enumerated.item[0];
446 if (idx >= imux->num_items)
447 idx = imux->num_items - 1;
450 for (i = 0; i < imux->num_items; i++) {
451 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
452 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
453 imux->items[i].index,
459 /* MUX style (e.g. ALC880) */
460 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
461 &spec->cur_mux[adc_idx]);
466 * channel mode setting
468 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_info *uinfo)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
474 spec->num_channel_mode);
477 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
483 spec->num_channel_mode,
484 spec->ext_channel_count);
487 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
488 struct snd_ctl_elem_value *ucontrol)
490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
491 struct alc_spec *spec = codec->spec;
492 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
493 spec->num_channel_mode,
494 &spec->ext_channel_count);
495 if (err >= 0 && !spec->const_channel_count) {
496 spec->multiout.max_channels = spec->ext_channel_count;
497 if (spec->need_dac_fix)
498 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
504 * Control the mode of pin widget settings via the mixer. "pc" is used
505 * instead of "%" to avoid consequences of accidently treating the % as
506 * being part of a format specifier. Maximum allowed length of a value is
507 * 63 characters plus NULL terminator.
509 * Note: some retasking pin complexes seem to ignore requests for input
510 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
511 * are requested. Therefore order this list so that this behaviour will not
512 * cause problems when mixer clients move through the enum sequentially.
513 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
516 static char *alc_pin_mode_names[] = {
517 "Mic 50pc bias", "Mic 80pc bias",
518 "Line in", "Line out", "Headphone out",
520 static unsigned char alc_pin_mode_values[] = {
521 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
523 /* The control can present all 5 options, or it can limit the options based
524 * in the pin being assumed to be exclusively an input or an output pin. In
525 * addition, "input" pins may or may not process the mic bias option
526 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
527 * accept requests for bias as of chip versions up to March 2006) and/or
528 * wiring in the computer.
530 #define ALC_PIN_DIR_IN 0x00
531 #define ALC_PIN_DIR_OUT 0x01
532 #define ALC_PIN_DIR_INOUT 0x02
533 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
534 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
536 /* Info about the pin modes supported by the different pin direction modes.
537 * For each direction the minimum and maximum values are given.
539 static signed char alc_pin_mode_dir_info[5][2] = {
540 { 0, 2 }, /* ALC_PIN_DIR_IN */
541 { 3, 4 }, /* ALC_PIN_DIR_OUT */
542 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
543 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
544 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
546 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
547 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
548 #define alc_pin_mode_n_items(_dir) \
549 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
551 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_info *uinfo)
554 unsigned int item_num = uinfo->value.enumerated.item;
555 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
557 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
559 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
561 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
562 item_num = alc_pin_mode_min(dir);
563 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
567 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
568 struct snd_ctl_elem_value *ucontrol)
571 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
572 hda_nid_t nid = kcontrol->private_value & 0xffff;
573 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
574 long *valp = ucontrol->value.integer.value;
575 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
576 AC_VERB_GET_PIN_WIDGET_CONTROL,
579 /* Find enumerated value for current pinctl setting */
580 i = alc_pin_mode_min(dir);
581 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
583 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
587 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
588 struct snd_ctl_elem_value *ucontrol)
591 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
592 hda_nid_t nid = kcontrol->private_value & 0xffff;
593 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
594 long val = *ucontrol->value.integer.value;
595 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
596 AC_VERB_GET_PIN_WIDGET_CONTROL,
599 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
600 val = alc_pin_mode_min(dir);
602 change = pinctl != alc_pin_mode_values[val];
604 /* Set pin mode to that requested */
605 snd_hda_codec_write_cache(codec, nid, 0,
606 AC_VERB_SET_PIN_WIDGET_CONTROL,
607 alc_pin_mode_values[val]);
609 /* Also enable the retasking pin's input/output as required
610 * for the requested pin mode. Enum values of 2 or less are
613 * Dynamically switching the input/output buffers probably
614 * reduces noise slightly (particularly on input) so we'll
615 * do it. However, having both input and output buffers
616 * enabled simultaneously doesn't seem to be problematic if
617 * this turns out to be necessary in the future.
620 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
621 HDA_AMP_MUTE, HDA_AMP_MUTE);
622 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
625 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
626 HDA_AMP_MUTE, HDA_AMP_MUTE);
627 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
634 #define ALC_PIN_MODE(xname, nid, dir) \
635 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
636 .info = alc_pin_mode_info, \
637 .get = alc_pin_mode_get, \
638 .put = alc_pin_mode_put, \
639 .private_value = nid | (dir<<16) }
641 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
642 * together using a mask with more than one bit set. This control is
643 * currently used only by the ALC260 test model. At this stage they are not
644 * needed for any "production" models.
646 #ifdef CONFIG_SND_DEBUG
647 #define alc_gpio_data_info snd_ctl_boolean_mono_info
649 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
650 struct snd_ctl_elem_value *ucontrol)
652 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
653 hda_nid_t nid = kcontrol->private_value & 0xffff;
654 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
655 long *valp = ucontrol->value.integer.value;
656 unsigned int val = snd_hda_codec_read(codec, nid, 0,
657 AC_VERB_GET_GPIO_DATA, 0x00);
659 *valp = (val & mask) != 0;
662 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
663 struct snd_ctl_elem_value *ucontrol)
666 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
667 hda_nid_t nid = kcontrol->private_value & 0xffff;
668 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
669 long val = *ucontrol->value.integer.value;
670 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
671 AC_VERB_GET_GPIO_DATA,
674 /* Set/unset the masked GPIO bit(s) as needed */
675 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
680 snd_hda_codec_write_cache(codec, nid, 0,
681 AC_VERB_SET_GPIO_DATA, gpio_data);
685 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
686 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
687 .info = alc_gpio_data_info, \
688 .get = alc_gpio_data_get, \
689 .put = alc_gpio_data_put, \
690 .private_value = nid | (mask<<16) }
691 #endif /* CONFIG_SND_DEBUG */
693 /* A switch control to allow the enabling of the digital IO pins on the
694 * ALC260. This is incredibly simplistic; the intention of this control is
695 * to provide something in the test model allowing digital outputs to be
696 * identified if present. If models are found which can utilise these
697 * outputs a more complete mixer control can be devised for those models if
700 #ifdef CONFIG_SND_DEBUG
701 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
703 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
704 struct snd_ctl_elem_value *ucontrol)
706 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
707 hda_nid_t nid = kcontrol->private_value & 0xffff;
708 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
709 long *valp = ucontrol->value.integer.value;
710 unsigned int val = snd_hda_codec_read(codec, nid, 0,
711 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
713 *valp = (val & mask) != 0;
716 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
717 struct snd_ctl_elem_value *ucontrol)
720 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
721 hda_nid_t nid = kcontrol->private_value & 0xffff;
722 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
723 long val = *ucontrol->value.integer.value;
724 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
725 AC_VERB_GET_DIGI_CONVERT_1,
728 /* Set/unset the masked control bit(s) as needed */
729 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
734 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
739 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
740 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
741 .info = alc_spdif_ctrl_info, \
742 .get = alc_spdif_ctrl_get, \
743 .put = alc_spdif_ctrl_put, \
744 .private_value = nid | (mask<<16) }
745 #endif /* CONFIG_SND_DEBUG */
747 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
748 * Again, this is only used in the ALC26x test models to help identify when
749 * the EAPD line must be asserted for features to work.
751 #ifdef CONFIG_SND_DEBUG
752 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
754 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
755 struct snd_ctl_elem_value *ucontrol)
757 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
758 hda_nid_t nid = kcontrol->private_value & 0xffff;
759 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
760 long *valp = ucontrol->value.integer.value;
761 unsigned int val = snd_hda_codec_read(codec, nid, 0,
762 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
764 *valp = (val & mask) != 0;
768 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
769 struct snd_ctl_elem_value *ucontrol)
772 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
773 hda_nid_t nid = kcontrol->private_value & 0xffff;
774 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
775 long val = *ucontrol->value.integer.value;
776 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
777 AC_VERB_GET_EAPD_BTLENABLE,
780 /* Set/unset the masked control bit(s) as needed */
781 change = (!val ? 0 : mask) != (ctrl_data & mask);
786 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
792 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
793 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
794 .info = alc_eapd_ctrl_info, \
795 .get = alc_eapd_ctrl_get, \
796 .put = alc_eapd_ctrl_put, \
797 .private_value = nid | (mask<<16) }
798 #endif /* CONFIG_SND_DEBUG */
801 * set up the input pin config (depending on the given auto-pin type)
803 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
806 unsigned int val = PIN_IN;
808 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
810 pincap = snd_hda_query_pin_caps(codec, nid);
811 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
812 if (pincap & AC_PINCAP_VREF_80)
814 else if (pincap & AC_PINCAP_VREF_50)
816 else if (pincap & AC_PINCAP_VREF_100)
818 else if (pincap & AC_PINCAP_VREF_GRD)
821 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
826 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
828 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
830 spec->mixers[spec->num_mixers++] = mix;
833 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
835 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
837 spec->init_verbs[spec->num_init_verbs++] = verb;
840 #ifdef CONFIG_PROC_FS
844 static void print_realtek_coef(struct snd_info_buffer *buffer,
845 struct hda_codec *codec, hda_nid_t nid)
851 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
852 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
853 coeff = snd_hda_codec_read(codec, nid, 0,
854 AC_VERB_GET_COEF_INDEX, 0);
855 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
858 #define print_realtek_coef NULL
862 * set up from the preset table
864 static void setup_preset(struct hda_codec *codec,
865 const struct alc_config_preset *preset)
867 struct alc_spec *spec = codec->spec;
870 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
871 add_mixer(spec, preset->mixers[i]);
872 spec->cap_mixer = preset->cap_mixer;
873 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
875 add_verb(spec, preset->init_verbs[i]);
877 spec->channel_mode = preset->channel_mode;
878 spec->num_channel_mode = preset->num_channel_mode;
879 spec->need_dac_fix = preset->need_dac_fix;
880 spec->const_channel_count = preset->const_channel_count;
882 if (preset->const_channel_count)
883 spec->multiout.max_channels = preset->const_channel_count;
885 spec->multiout.max_channels = spec->channel_mode[0].channels;
886 spec->ext_channel_count = spec->channel_mode[0].channels;
888 spec->multiout.num_dacs = preset->num_dacs;
889 spec->multiout.dac_nids = preset->dac_nids;
890 spec->multiout.dig_out_nid = preset->dig_out_nid;
891 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
892 spec->multiout.hp_nid = preset->hp_nid;
894 spec->num_mux_defs = preset->num_mux_defs;
895 if (!spec->num_mux_defs)
896 spec->num_mux_defs = 1;
897 spec->input_mux = preset->input_mux;
899 spec->num_adc_nids = preset->num_adc_nids;
900 spec->adc_nids = preset->adc_nids;
901 spec->capsrc_nids = preset->capsrc_nids;
902 spec->dig_in_nid = preset->dig_in_nid;
904 spec->unsol_event = preset->unsol_event;
905 spec->init_hook = preset->init_hook;
906 #ifdef CONFIG_SND_HDA_POWER_SAVE
907 spec->power_hook = preset->power_hook;
908 spec->loopback.amplist = preset->loopbacks;
912 preset->setup(codec);
915 /* Enable GPIO mask and set output */
916 static struct hda_verb alc_gpio1_init_verbs[] = {
917 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
918 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
919 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
923 static struct hda_verb alc_gpio2_init_verbs[] = {
924 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
925 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
926 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
930 static struct hda_verb alc_gpio3_init_verbs[] = {
931 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
932 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
933 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
938 * Fix hardware PLL issue
939 * On some codecs, the analog PLL gating control must be off while
940 * the default value is 1.
942 static void alc_fix_pll(struct hda_codec *codec)
944 struct alc_spec *spec = codec->spec;
949 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
951 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
952 AC_VERB_GET_PROC_COEF, 0);
953 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
955 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
956 val & ~(1 << spec->pll_coef_bit));
959 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
960 unsigned int coef_idx, unsigned int coef_bit)
962 struct alc_spec *spec = codec->spec;
964 spec->pll_coef_idx = coef_idx;
965 spec->pll_coef_bit = coef_bit;
969 static void alc_automute_pin(struct hda_codec *codec)
971 struct alc_spec *spec = codec->spec;
972 unsigned int nid = spec->autocfg.hp_pins[0];
977 spec->jack_present = snd_hda_jack_detect(codec, nid);
978 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
979 nid = spec->autocfg.speaker_pins[i];
982 snd_hda_codec_write(codec, nid, 0,
983 AC_VERB_SET_PIN_WIDGET_CONTROL,
984 spec->jack_present ? 0 : PIN_OUT);
988 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
991 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
994 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
995 for (i = 0; i < nums; i++)
1001 static void alc_mic_automute(struct hda_codec *codec)
1003 struct alc_spec *spec = codec->spec;
1004 struct alc_mic_route *dead, *alive;
1005 unsigned int present, type;
1008 if (!spec->auto_mic)
1010 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1012 if (snd_BUG_ON(!spec->adc_nids))
1015 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1017 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1019 alive = &spec->ext_mic;
1020 dead = &spec->int_mic;
1022 alive = &spec->int_mic;
1023 dead = &spec->ext_mic;
1026 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1027 if (type == AC_WID_AUD_MIX) {
1028 /* Matrix-mixer style (e.g. ALC882) */
1029 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1032 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1034 HDA_AMP_MUTE, HDA_AMP_MUTE);
1036 /* MUX style (e.g. ALC880) */
1037 snd_hda_codec_write_cache(codec, cap_nid, 0,
1038 AC_VERB_SET_CONNECT_SEL,
1042 /* FIXME: analog mixer */
1045 /* unsolicited event for HP jack sensing */
1046 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1048 if (codec->vendor_id == 0x10ec0880)
1053 case ALC880_HP_EVENT:
1054 alc_automute_pin(codec);
1056 case ALC880_MIC_EVENT:
1057 alc_mic_automute(codec);
1062 static void alc_inithook(struct hda_codec *codec)
1064 alc_automute_pin(codec);
1065 alc_mic_automute(codec);
1068 /* additional initialization for ALC888 variants */
1069 static void alc888_coef_init(struct hda_codec *codec)
1073 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1074 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1075 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1076 if ((tmp & 0xf0) == 0x20)
1078 snd_hda_codec_read(codec, 0x20, 0,
1079 AC_VERB_SET_PROC_COEF, 0x830);
1082 snd_hda_codec_read(codec, 0x20, 0,
1083 AC_VERB_SET_PROC_COEF, 0x3030);
1086 static void alc889_coef_init(struct hda_codec *codec)
1090 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1091 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1092 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1093 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1096 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1101 case ALC_INIT_GPIO1:
1102 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1104 case ALC_INIT_GPIO2:
1105 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1107 case ALC_INIT_GPIO3:
1108 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1110 case ALC_INIT_DEFAULT:
1111 switch (codec->vendor_id) {
1113 snd_hda_codec_write(codec, 0x0f, 0,
1114 AC_VERB_SET_EAPD_BTLENABLE, 2);
1115 snd_hda_codec_write(codec, 0x10, 0,
1116 AC_VERB_SET_EAPD_BTLENABLE, 2);
1128 snd_hda_codec_write(codec, 0x14, 0,
1129 AC_VERB_SET_EAPD_BTLENABLE, 2);
1130 snd_hda_codec_write(codec, 0x15, 0,
1131 AC_VERB_SET_EAPD_BTLENABLE, 2);
1134 switch (codec->vendor_id) {
1136 snd_hda_codec_write(codec, 0x1a, 0,
1137 AC_VERB_SET_COEF_INDEX, 7);
1138 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1139 AC_VERB_GET_PROC_COEF, 0);
1140 snd_hda_codec_write(codec, 0x1a, 0,
1141 AC_VERB_SET_COEF_INDEX, 7);
1142 snd_hda_codec_write(codec, 0x1a, 0,
1143 AC_VERB_SET_PROC_COEF,
1153 alc889_coef_init(codec);
1156 alc888_coef_init(codec);
1160 snd_hda_codec_write(codec, 0x20, 0,
1161 AC_VERB_SET_COEF_INDEX, 7);
1162 tmp = snd_hda_codec_read(codec, 0x20, 0,
1163 AC_VERB_GET_PROC_COEF, 0);
1164 snd_hda_codec_write(codec, 0x20, 0,
1165 AC_VERB_SET_COEF_INDEX, 7);
1166 snd_hda_codec_write(codec, 0x20, 0,
1167 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 */
1233 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1234 return; /* no unsol support */
1235 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1237 spec->ext_mic.pin = ext;
1238 spec->int_mic.pin = fixed;
1239 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1240 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1242 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1243 AC_VERB_SET_UNSOLICITED_ENABLE,
1244 AC_USRSP_EN | ALC880_MIC_EVENT);
1245 spec->unsol_event = alc_sku_unsol_event;
1248 /* check subsystem ID and set up device-specific initialization;
1249 * return 1 if initialized, 0 if invalid SSID
1251 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1252 * 31 ~ 16 : Manufacture ID
1254 * 7 ~ 0 : Assembly ID
1255 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1257 static int alc_subsystem_id(struct hda_codec *codec,
1258 hda_nid_t porta, hda_nid_t porte,
1261 unsigned int ass, tmp, i;
1263 struct alc_spec *spec = codec->spec;
1265 ass = codec->subsystem_id & 0xffff;
1266 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1269 /* invalid SSID, check the special NID pin defcfg instead */
1271 * 31~30 : port connectivity
1274 * 19~16 : Check sum (15:1)
1279 if (codec->vendor_id == 0x10ec0260)
1281 ass = snd_hda_codec_get_pincfg(codec, nid);
1282 snd_printd("realtek: No valid SSID, "
1283 "checking pincfg 0x%08x for NID 0x%x\n",
1285 if (!(ass & 1) && !(ass & 0x100000))
1287 if ((ass >> 30) != 1) /* no physical connection */
1292 for (i = 1; i < 16; i++) {
1296 if (((ass >> 16) & 0xf) != tmp)
1299 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1300 ass & 0xffff, codec->vendor_id);
1304 * 2 : 0 --> Desktop, 1 --> Laptop
1305 * 3~5 : External Amplifier control
1308 tmp = (ass & 0x38) >> 3; /* external Amp control */
1311 spec->init_amp = ALC_INIT_GPIO1;
1314 spec->init_amp = ALC_INIT_GPIO2;
1317 spec->init_amp = ALC_INIT_GPIO3;
1320 spec->init_amp = ALC_INIT_DEFAULT;
1324 /* is laptop or Desktop and enable the function "Mute internal speaker
1325 * when the external headphone out jack is plugged"
1327 if (!(ass & 0x8000))
1330 * 10~8 : Jack location
1331 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1333 * 15 : 1 --> enable the function "Mute internal speaker
1334 * when the external headphone out jack is plugged"
1336 if (!spec->autocfg.hp_pins[0]) {
1338 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1347 for (i = 0; i < spec->autocfg.line_outs; i++)
1348 if (spec->autocfg.line_out_pins[i] == nid)
1350 spec->autocfg.hp_pins[0] = nid;
1353 alc_init_auto_hp(codec);
1354 alc_init_auto_mic(codec);
1358 static void alc_ssid_check(struct hda_codec *codec,
1359 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1361 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1362 struct alc_spec *spec = codec->spec;
1363 snd_printd("realtek: "
1364 "Enable default setup for auto mode as fallback\n");
1365 spec->init_amp = ALC_INIT_DEFAULT;
1366 alc_init_auto_hp(codec);
1367 alc_init_auto_mic(codec);
1372 * Fix-up pin default configurations and add default verbs
1381 const struct alc_pincfg *pins;
1382 const struct hda_verb *verbs;
1385 static void alc_pick_fixup(struct hda_codec *codec,
1386 const struct snd_pci_quirk *quirk,
1387 const struct alc_fixup *fix)
1389 const struct alc_pincfg *cfg;
1391 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1395 fix += quirk->value;
1398 for (; cfg->nid; cfg++)
1399 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1402 add_verb(codec->spec, fix->verbs);
1405 static int alc_read_coef_idx(struct hda_codec *codec,
1406 unsigned int coef_idx)
1409 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1411 val = snd_hda_codec_read(codec, 0x20, 0,
1412 AC_VERB_GET_PROC_COEF, 0);
1423 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1424 /* Mic-in jack as mic in */
1425 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1426 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1427 /* Line-in jack as Line in */
1428 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1429 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1430 /* Line-Out as Front */
1431 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1438 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1439 /* Mic-in jack as mic in */
1440 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1441 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1442 /* Line-in jack as Surround */
1443 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1444 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1445 /* Line-Out as Front */
1446 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1453 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1454 /* Mic-in jack as CLFE */
1455 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1456 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1457 /* Line-in jack as Surround */
1458 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1459 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1460 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1461 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1468 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1469 /* Mic-in jack as CLFE */
1470 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1471 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1472 /* Line-in jack as Surround */
1473 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1474 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1475 /* Line-Out as Side */
1476 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1480 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1481 { 2, alc888_4ST_ch2_intel_init },
1482 { 4, alc888_4ST_ch4_intel_init },
1483 { 6, alc888_4ST_ch6_intel_init },
1484 { 8, alc888_4ST_ch8_intel_init },
1488 * ALC888 Fujitsu Siemens Amillo xa3530
1491 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1492 /* Front Mic: set to PIN_IN (empty by default) */
1493 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1494 /* Connect Internal HP to Front */
1495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1497 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1498 /* Connect Bass HP to Front */
1499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1500 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1502 /* Connect Line-Out side jack (SPDIF) to Side */
1503 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1504 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1505 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1506 /* Connect Mic jack to CLFE */
1507 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1510 /* Connect Line-in jack to Surround */
1511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1512 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1513 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1514 /* Connect HP out jack to Front */
1515 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1516 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1517 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1518 /* Enable unsolicited event for HP jack and Line-out jack */
1519 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1520 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1524 static void alc_automute_amp(struct hda_codec *codec)
1526 struct alc_spec *spec = codec->spec;
1531 spec->jack_present = 0;
1532 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1533 nid = spec->autocfg.hp_pins[i];
1536 if (snd_hda_jack_detect(codec, nid)) {
1537 spec->jack_present = 1;
1542 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1543 /* Toggle internal speakers muting */
1544 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1545 nid = spec->autocfg.speaker_pins[i];
1548 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1549 HDA_AMP_MUTE, mute);
1553 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1556 if (codec->vendor_id == 0x10ec0880)
1560 if (res == ALC880_HP_EVENT)
1561 alc_automute_amp(codec);
1564 static void alc889_automute_setup(struct hda_codec *codec)
1566 struct alc_spec *spec = codec->spec;
1568 spec->autocfg.hp_pins[0] = 0x15;
1569 spec->autocfg.speaker_pins[0] = 0x14;
1570 spec->autocfg.speaker_pins[1] = 0x16;
1571 spec->autocfg.speaker_pins[2] = 0x17;
1572 spec->autocfg.speaker_pins[3] = 0x19;
1573 spec->autocfg.speaker_pins[4] = 0x1a;
1576 static void alc889_intel_init_hook(struct hda_codec *codec)
1578 alc889_coef_init(codec);
1579 alc_automute_amp(codec);
1582 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1584 struct alc_spec *spec = codec->spec;
1586 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1587 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1588 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1589 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1593 * ALC888 Acer Aspire 4930G model
1596 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1597 /* Front Mic: set to PIN_IN (empty by default) */
1598 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1599 /* Unselect Front Mic by default in input mixer 3 */
1600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1601 /* Enable unsolicited event for HP jack */
1602 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1603 /* Connect Internal HP to front */
1604 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1606 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1607 /* Connect HP out to front */
1608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1610 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1615 * ALC888 Acer Aspire 6530G model
1618 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1619 /* Bias voltage on for external mic port */
1620 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1621 /* Front Mic: set to PIN_IN (empty by default) */
1622 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1623 /* Unselect Front Mic by default in input mixer 3 */
1624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1625 /* Enable unsolicited event for HP jack */
1626 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1627 /* Enable speaker output */
1628 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1629 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1630 /* Enable headphone output */
1631 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1633 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1638 * ALC889 Acer Aspire 8930G model
1641 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1642 /* Front Mic: set to PIN_IN (empty by default) */
1643 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1644 /* Unselect Front Mic by default in input mixer 3 */
1645 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1646 /* Enable unsolicited event for HP jack */
1647 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1648 /* Connect Internal Front to Front */
1649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1650 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1651 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1652 /* Connect Internal Rear to Rear */
1653 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1654 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1655 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1656 /* Connect Internal CLFE to CLFE */
1657 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1658 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1659 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1660 /* Connect HP out to Front */
1661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1663 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1664 /* Enable all DACs */
1665 /* DAC DISABLE/MUTE 1? */
1666 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1667 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1668 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1669 /* DAC DISABLE/MUTE 2? */
1670 /* some bit here disables the other DACs. Init=0x4900 */
1671 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1672 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1674 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1675 * which makes the stereo useless. However, either the mic or the ALC889
1676 * makes the signal become a difference/sum signal instead of standard
1677 * stereo, which is annoying. So instead we flip this bit which makes the
1678 * codec replicate the sum signal to both channels, turning it into a
1681 /* DMIC_CONTROL? Init value = 0x0001 */
1682 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1683 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1687 static struct hda_input_mux alc888_2_capture_sources[2] = {
1688 /* Front mic only available on one ADC */
1695 { "Front Mic", 0xb },
1708 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1709 /* Interal mic only available on one ADC */
1716 { "Input Mix", 0xa },
1726 { "Input Mix", 0xa },
1731 static struct hda_input_mux alc889_capture_sources[3] = {
1732 /* Digital mic only available on first "ADC" */
1739 { "Front Mic", 0xb },
1740 { "Input Mix", 0xa },
1749 { "Input Mix", 0xa },
1758 { "Input Mix", 0xa },
1763 static struct snd_kcontrol_new alc888_base_mixer[] = {
1764 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1766 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1767 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1768 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1770 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1771 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1772 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1774 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1775 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1776 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1778 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1780 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1785 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1786 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1789 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1790 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1799 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1804 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1806 struct alc_spec *spec = codec->spec;
1808 spec->autocfg.hp_pins[0] = 0x15;
1809 spec->autocfg.speaker_pins[0] = 0x14;
1810 spec->autocfg.speaker_pins[1] = 0x16;
1811 spec->autocfg.speaker_pins[2] = 0x17;
1814 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1816 struct alc_spec *spec = codec->spec;
1818 spec->autocfg.hp_pins[0] = 0x15;
1819 spec->autocfg.speaker_pins[0] = 0x14;
1820 spec->autocfg.speaker_pins[1] = 0x16;
1821 spec->autocfg.speaker_pins[2] = 0x17;
1824 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1826 struct alc_spec *spec = codec->spec;
1828 spec->autocfg.hp_pins[0] = 0x15;
1829 spec->autocfg.speaker_pins[0] = 0x14;
1830 spec->autocfg.speaker_pins[1] = 0x16;
1831 spec->autocfg.speaker_pins[2] = 0x1b;
1834 #ifdef CONFIG_SND_HDA_POWER_SAVE
1835 static void alc889_power_eapd(struct hda_codec *codec, int power)
1837 snd_hda_codec_write(codec, 0x14, 0,
1838 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1839 snd_hda_codec_write(codec, 0x15, 0,
1840 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1845 * ALC880 3-stack model
1847 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1848 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1849 * F-Mic = 0x1b, HP = 0x19
1852 static hda_nid_t alc880_dac_nids[4] = {
1853 /* front, rear, clfe, rear_surr */
1854 0x02, 0x05, 0x04, 0x03
1857 static hda_nid_t alc880_adc_nids[3] = {
1862 /* The datasheet says the node 0x07 is connected from inputs,
1863 * but it shows zero connection in the real implementation on some devices.
1864 * Note: this is a 915GAV bug, fixed on 915GLV
1866 static hda_nid_t alc880_adc_nids_alt[2] = {
1871 #define ALC880_DIGOUT_NID 0x06
1872 #define ALC880_DIGIN_NID 0x0a
1874 static struct hda_input_mux alc880_capture_source = {
1878 { "Front Mic", 0x3 },
1884 /* channel source setting (2/6 channel selection for 3-stack) */
1886 static struct hda_verb alc880_threestack_ch2_init[] = {
1887 /* set line-in to input, mute it */
1888 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1889 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1890 /* set mic-in to input vref 80%, mute it */
1891 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1892 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1897 static struct hda_verb alc880_threestack_ch6_init[] = {
1898 /* set line-in to output, unmute it */
1899 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1900 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1901 /* set mic-in to output, unmute it */
1902 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1903 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1907 static struct hda_channel_mode alc880_threestack_modes[2] = {
1908 { 2, alc880_threestack_ch2_init },
1909 { 6, alc880_threestack_ch6_init },
1912 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1913 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1914 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1915 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1916 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1917 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1918 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1919 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1920 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1921 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1922 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1923 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1924 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1925 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1927 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1928 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1929 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1932 .name = "Channel Mode",
1933 .info = alc_ch_mode_info,
1934 .get = alc_ch_mode_get,
1935 .put = alc_ch_mode_put,
1940 /* capture mixer elements */
1941 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1942 struct snd_ctl_elem_info *uinfo)
1944 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1945 struct alc_spec *spec = codec->spec;
1948 mutex_lock(&codec->control_mutex);
1949 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1951 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1952 mutex_unlock(&codec->control_mutex);
1956 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1957 unsigned int size, unsigned int __user *tlv)
1959 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1960 struct alc_spec *spec = codec->spec;
1963 mutex_lock(&codec->control_mutex);
1964 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1966 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1967 mutex_unlock(&codec->control_mutex);
1971 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1972 struct snd_ctl_elem_value *ucontrol);
1974 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1975 struct snd_ctl_elem_value *ucontrol,
1978 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1979 struct alc_spec *spec = codec->spec;
1980 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1983 mutex_lock(&codec->control_mutex);
1984 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1986 err = func(kcontrol, ucontrol);
1987 mutex_unlock(&codec->control_mutex);
1991 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1992 struct snd_ctl_elem_value *ucontrol)
1994 return alc_cap_getput_caller(kcontrol, ucontrol,
1995 snd_hda_mixer_amp_volume_get);
1998 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1999 struct snd_ctl_elem_value *ucontrol)
2001 return alc_cap_getput_caller(kcontrol, ucontrol,
2002 snd_hda_mixer_amp_volume_put);
2005 /* capture mixer elements */
2006 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2008 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2009 struct snd_ctl_elem_value *ucontrol)
2011 return alc_cap_getput_caller(kcontrol, ucontrol,
2012 snd_hda_mixer_amp_switch_get);
2015 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2016 struct snd_ctl_elem_value *ucontrol)
2018 return alc_cap_getput_caller(kcontrol, ucontrol,
2019 snd_hda_mixer_amp_switch_put);
2022 #define _DEFINE_CAPMIX(num) \
2024 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2025 .name = "Capture Switch", \
2026 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2028 .info = alc_cap_sw_info, \
2029 .get = alc_cap_sw_get, \
2030 .put = alc_cap_sw_put, \
2033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2034 .name = "Capture Volume", \
2035 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2036 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2037 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2039 .info = alc_cap_vol_info, \
2040 .get = alc_cap_vol_get, \
2041 .put = alc_cap_vol_put, \
2042 .tlv = { .c = alc_cap_vol_tlv }, \
2045 #define _DEFINE_CAPSRC(num) \
2047 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2048 /* .name = "Capture Source", */ \
2049 .name = "Input Source", \
2051 .info = alc_mux_enum_info, \
2052 .get = alc_mux_enum_get, \
2053 .put = alc_mux_enum_put, \
2056 #define DEFINE_CAPMIX(num) \
2057 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2058 _DEFINE_CAPMIX(num), \
2059 _DEFINE_CAPSRC(num), \
2063 #define DEFINE_CAPMIX_NOSRC(num) \
2064 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2065 _DEFINE_CAPMIX(num), \
2069 /* up to three ADCs */
2073 DEFINE_CAPMIX_NOSRC(1);
2074 DEFINE_CAPMIX_NOSRC(2);
2075 DEFINE_CAPMIX_NOSRC(3);
2078 * ALC880 5-stack model
2080 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2082 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2083 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2086 /* additional mixers to alc880_three_stack_mixer */
2087 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2088 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2089 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2093 /* channel source setting (6/8 channel selection for 5-stack) */
2095 static struct hda_verb alc880_fivestack_ch6_init[] = {
2096 /* set line-in to input, mute it */
2097 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2098 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2103 static struct hda_verb alc880_fivestack_ch8_init[] = {
2104 /* set line-in to output, unmute it */
2105 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2106 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2110 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2111 { 6, alc880_fivestack_ch6_init },
2112 { 8, alc880_fivestack_ch8_init },
2117 * ALC880 6-stack model
2119 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2120 * Side = 0x05 (0x0f)
2121 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2122 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2125 static hda_nid_t alc880_6st_dac_nids[4] = {
2126 /* front, rear, clfe, rear_surr */
2127 0x02, 0x03, 0x04, 0x05
2130 static struct hda_input_mux alc880_6stack_capture_source = {
2134 { "Front Mic", 0x1 },
2140 /* fixed 8-channels */
2141 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2145 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2147 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2148 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2149 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2150 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2151 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2152 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2153 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2154 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2155 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2156 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2157 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2158 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2159 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2161 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2162 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2163 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2165 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2166 .name = "Channel Mode",
2167 .info = alc_ch_mode_info,
2168 .get = alc_ch_mode_get,
2169 .put = alc_ch_mode_put,
2178 * W810 has rear IO for:
2181 * Center/LFE (DAC 04)
2184 * The system also has a pair of internal speakers, and a headphone jack.
2185 * These are both connected to Line2 on the codec, hence to DAC 02.
2187 * There is a variable resistor to control the speaker or headphone
2188 * volume. This is a hardware-only device without a software API.
2190 * Plugging headphones in will disable the internal speakers. This is
2191 * implemented in hardware, not via the driver using jack sense. In
2192 * a similar fashion, plugging into the rear socket marked "front" will
2193 * disable both the speakers and headphones.
2195 * For input, there's a microphone jack, and an "audio in" jack.
2196 * These may not do anything useful with this driver yet, because I
2197 * haven't setup any initialization verbs for these yet...
2200 static hda_nid_t alc880_w810_dac_nids[3] = {
2201 /* front, rear/surround, clfe */
2205 /* fixed 6 channels */
2206 static struct hda_channel_mode alc880_w810_modes[1] = {
2210 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2211 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2212 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2213 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2214 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2215 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2216 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2217 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2219 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2228 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2229 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2233 static hda_nid_t alc880_z71v_dac_nids[1] = {
2236 #define ALC880_Z71V_HP_DAC 0x03
2238 /* fixed 2 channels */
2239 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2243 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2244 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2245 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2246 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2247 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2248 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2249 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2257 * ALC880 F1734 model
2259 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2260 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2263 static hda_nid_t alc880_f1734_dac_nids[1] = {
2266 #define ALC880_F1734_HP_DAC 0x02
2268 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2269 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2270 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2271 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2272 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2273 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2274 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2275 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2276 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2280 static struct hda_input_mux alc880_f1734_capture_source = {
2292 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2293 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2294 * Mic = 0x18, Line = 0x1a
2297 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2298 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2300 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2301 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2302 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2303 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2304 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2305 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2306 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2307 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2308 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2309 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2310 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2311 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2312 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2314 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2316 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2317 .name = "Channel Mode",
2318 .info = alc_ch_mode_info,
2319 .get = alc_ch_mode_get,
2320 .put = alc_ch_mode_put,
2326 * ALC880 ASUS W1V model
2328 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2329 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2330 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2333 /* additional mixers to alc880_asus_mixer */
2334 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2335 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2336 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2341 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2342 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2343 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2345 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2346 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2348 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2349 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2350 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2355 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2356 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2357 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2358 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2359 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2360 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2361 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2362 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2363 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2364 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2365 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2366 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2367 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2369 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2371 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2373 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2374 .name = "Channel Mode",
2375 .info = alc_ch_mode_info,
2376 .get = alc_ch_mode_get,
2377 .put = alc_ch_mode_put,
2382 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2383 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2384 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2385 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2386 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2389 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2390 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2391 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2392 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2396 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2397 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2398 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2399 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2400 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2407 * virtual master controls
2411 * slave controls for virtual master
2413 static const char *alc_slave_vols[] = {
2414 "Front Playback Volume",
2415 "Surround Playback Volume",
2416 "Center Playback Volume",
2417 "LFE Playback Volume",
2418 "Side Playback Volume",
2419 "Headphone Playback Volume",
2420 "Speaker Playback Volume",
2421 "Mono Playback Volume",
2422 "Line-Out Playback Volume",
2423 "PCM Playback Volume",
2427 static const char *alc_slave_sws[] = {
2428 "Front Playback Switch",
2429 "Surround Playback Switch",
2430 "Center Playback Switch",
2431 "LFE Playback Switch",
2432 "Side Playback Switch",
2433 "Headphone Playback Switch",
2434 "Speaker Playback Switch",
2435 "Mono Playback Switch",
2436 "IEC958 Playback Switch",
2437 "Line-Out Playback Switch",
2438 "PCM Playback Switch",
2443 * build control elements
2446 static void alc_free_kctls(struct hda_codec *codec);
2448 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2449 /* additional beep mixers; the actual parameters are overwritten at build */
2450 static struct snd_kcontrol_new alc_beep_mixer[] = {
2451 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2452 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2457 static int alc_build_controls(struct hda_codec *codec)
2459 struct alc_spec *spec = codec->spec;
2463 for (i = 0; i < spec->num_mixers; i++) {
2464 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2468 if (spec->cap_mixer) {
2469 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2473 if (spec->multiout.dig_out_nid) {
2474 err = snd_hda_create_spdif_out_ctls(codec,
2475 spec->multiout.dig_out_nid);
2478 if (!spec->no_analog) {
2479 err = snd_hda_create_spdif_share_sw(codec,
2483 spec->multiout.share_spdif = 1;
2486 if (spec->dig_in_nid) {
2487 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2492 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2493 /* create beep controls if needed */
2494 if (spec->beep_amp) {
2495 struct snd_kcontrol_new *knew;
2496 for (knew = alc_beep_mixer; knew->name; knew++) {
2497 struct snd_kcontrol *kctl;
2498 kctl = snd_ctl_new1(knew, codec);
2501 kctl->private_value = spec->beep_amp;
2502 err = snd_hda_ctl_add(codec,
2503 get_amp_nid_(spec->beep_amp), kctl);
2510 /* if we have no master control, let's create it */
2511 if (!spec->no_analog &&
2512 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2513 unsigned int vmaster_tlv[4];
2514 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2515 HDA_OUTPUT, vmaster_tlv);
2516 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2517 vmaster_tlv, alc_slave_vols);
2521 if (!spec->no_analog &&
2522 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2523 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2524 NULL, alc_slave_sws);
2529 alc_free_kctls(codec); /* no longer needed */
2535 * initialize the codec volumes, etc
2539 * generic initialization of ADC, input mixers and output mixers
2541 static struct hda_verb alc880_volume_init_verbs[] = {
2543 * Unmute ADC0-2 and set the default input to mic-in
2545 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2547 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2548 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2549 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2550 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2552 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2554 * Note: PASD motherboards uses the Line In 2 as the input for front
2557 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2558 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2559 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2560 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2561 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2562 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2563 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2564 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2567 * Set up output mixers (0x0c - 0x0f)
2569 /* set vol=0 to output mixers */
2570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2571 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2572 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2573 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2574 /* set up input amps for analog loopback */
2575 /* Amp Indices: DAC = 0, mixer = 1 */
2576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2579 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2580 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2581 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2582 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2583 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2589 * 3-stack pin configuration:
2590 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2592 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2594 * preset connection lists of input pins
2595 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2597 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2598 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2599 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2602 * Set pin mode and muting
2604 /* set front pin widgets 0x14 for output */
2605 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2606 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2607 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2608 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2609 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2610 /* Mic2 (as headphone out) for HP output */
2611 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2612 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2613 /* Line In pin widget for input */
2614 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2615 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2616 /* Line2 (as front mic) pin widget for input and vref at 80% */
2617 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2618 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2619 /* CD pin widget for input */
2620 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2626 * 5-stack pin configuration:
2627 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2628 * line-in/side = 0x1a, f-mic = 0x1b
2630 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2632 * preset connection lists of input pins
2633 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2635 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2636 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2639 * Set pin mode and muting
2641 /* set pin widgets 0x14-0x17 for output */
2642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2643 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2644 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2645 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2646 /* unmute pins for output (no gain on this amp) */
2647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2648 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2649 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2650 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2652 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2653 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2654 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2655 /* Mic2 (as headphone out) for HP output */
2656 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2657 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2658 /* Line In pin widget for input */
2659 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2660 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2661 /* Line2 (as front mic) pin widget for input and vref at 80% */
2662 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2663 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2664 /* CD pin widget for input */
2665 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2671 * W810 pin configuration:
2672 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2674 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2675 /* hphone/speaker input selector: front DAC */
2676 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2679 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2682 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2683 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2685 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2686 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2692 * Z71V pin configuration:
2693 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2695 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2696 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2697 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2699 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2701 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2702 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2703 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2704 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2710 * 6-stack pin configuration:
2711 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2712 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2714 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2715 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2718 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2721 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2722 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2723 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2724 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2726 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2727 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2728 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2729 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2730 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2731 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2732 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2733 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2740 * Uniwill pin configuration:
2741 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2744 static struct hda_verb alc880_uniwill_init_verbs[] = {
2745 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2748 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2751 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2752 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2753 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2754 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2757 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2758 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2759 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2760 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2763 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2765 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2767 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2768 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2769 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2770 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2772 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2773 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2780 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2782 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2783 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2789 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2790 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2791 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2792 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2793 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2794 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2795 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2796 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2800 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2802 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2805 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2806 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2811 static struct hda_verb alc880_beep_init_verbs[] = {
2812 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2816 /* auto-toggle front mic */
2817 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2819 unsigned int present;
2822 present = snd_hda_jack_detect(codec, 0x18);
2823 bits = present ? HDA_AMP_MUTE : 0;
2824 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2827 static void alc880_uniwill_setup(struct hda_codec *codec)
2829 struct alc_spec *spec = codec->spec;
2831 spec->autocfg.hp_pins[0] = 0x14;
2832 spec->autocfg.speaker_pins[0] = 0x15;
2833 spec->autocfg.speaker_pins[0] = 0x16;
2836 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2838 alc_automute_amp(codec);
2839 alc880_uniwill_mic_automute(codec);
2842 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2845 /* Looks like the unsol event is incompatible with the standard
2846 * definition. 4bit tag is placed at 28 bit!
2848 switch (res >> 28) {
2849 case ALC880_MIC_EVENT:
2850 alc880_uniwill_mic_automute(codec);
2853 alc_automute_amp_unsol_event(codec, res);
2858 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2860 struct alc_spec *spec = codec->spec;
2862 spec->autocfg.hp_pins[0] = 0x14;
2863 spec->autocfg.speaker_pins[0] = 0x15;
2866 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2868 unsigned int present;
2870 present = snd_hda_codec_read(codec, 0x21, 0,
2871 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2872 present &= HDA_AMP_VOLMASK;
2873 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2874 HDA_AMP_VOLMASK, present);
2875 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2876 HDA_AMP_VOLMASK, present);
2879 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2882 /* Looks like the unsol event is incompatible with the standard
2883 * definition. 4bit tag is placed at 28 bit!
2885 if ((res >> 28) == ALC880_DCVOL_EVENT)
2886 alc880_uniwill_p53_dcvol_automute(codec);
2888 alc_automute_amp_unsol_event(codec, res);
2892 * F1734 pin configuration:
2893 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2895 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2896 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2897 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2898 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2899 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2900 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2902 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2903 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2907 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2908 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2910 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2911 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2913 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2914 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2917 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2918 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2924 * ASUS pin configuration:
2925 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2927 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2928 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2929 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2930 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2931 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2933 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2934 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2935 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2936 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2937 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2939 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2940 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2942 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2943 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2945 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2947 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2948 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2950 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2955 /* Enable GPIO mask and set output */
2956 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2957 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2958 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2960 /* Clevo m520g init */
2961 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2962 /* headphone output */
2963 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2965 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2966 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2968 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2969 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2971 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2972 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2973 /* Mic1 (rear panel) */
2974 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2975 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2976 /* Mic2 (front panel) */
2977 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2978 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2980 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2981 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2982 /* change to EAPD mode */
2983 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2984 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2989 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2990 /* change to EAPD mode */
2991 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2992 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2994 /* Headphone output */
2995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2998 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3000 /* Line In pin widget for input */
3001 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3002 /* CD pin widget for input */
3003 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3004 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3005 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3007 /* change to EAPD mode */
3008 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3009 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3015 * LG m1 express dual
3018 * Rear Line-In/Out (blue): 0x14
3019 * Build-in Mic-In: 0x15
3021 * HP-Out (green): 0x1b
3022 * Mic-In/Out (red): 0x19
3026 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3027 static hda_nid_t alc880_lg_dac_nids[3] = {
3031 /* seems analog CD is not working */
3032 static struct hda_input_mux alc880_lg_capture_source = {
3037 { "Internal Mic", 0x6 },
3041 /* 2,4,6 channel modes */
3042 static struct hda_verb alc880_lg_ch2_init[] = {
3043 /* set line-in and mic-in to input */
3044 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3045 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3049 static struct hda_verb alc880_lg_ch4_init[] = {
3050 /* set line-in to out and mic-in to input */
3051 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3052 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3056 static struct hda_verb alc880_lg_ch6_init[] = {
3057 /* set line-in and mic-in to output */
3058 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3059 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3063 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3064 { 2, alc880_lg_ch2_init },
3065 { 4, alc880_lg_ch4_init },
3066 { 6, alc880_lg_ch6_init },
3069 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3070 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3071 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3072 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3073 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3074 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3075 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3076 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3077 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3079 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3080 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3081 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3082 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3083 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3086 .name = "Channel Mode",
3087 .info = alc_ch_mode_info,
3088 .get = alc_ch_mode_get,
3089 .put = alc_ch_mode_put,
3094 static struct hda_verb alc880_lg_init_verbs[] = {
3095 /* set capture source to mic-in */
3096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3097 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3098 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3099 /* mute all amp mixer inputs */
3100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3103 /* line-in to input */
3104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3105 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3107 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3110 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3111 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3112 /* mic-in to input */
3113 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3114 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3115 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3117 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3118 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3119 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3121 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3125 /* toggle speaker-output according to the hp-jack state */
3126 static void alc880_lg_setup(struct hda_codec *codec)
3128 struct alc_spec *spec = codec->spec;
3130 spec->autocfg.hp_pins[0] = 0x1b;
3131 spec->autocfg.speaker_pins[0] = 0x17;
3140 * Built-in Mic-In: 0x19
3146 static struct hda_input_mux alc880_lg_lw_capture_source = {
3150 { "Internal Mic", 0x1 },
3155 #define alc880_lg_lw_modes alc880_threestack_modes
3157 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3159 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3160 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3161 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3162 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3163 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3164 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3165 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3166 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3167 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3170 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3171 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3173 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3174 .name = "Channel Mode",
3175 .info = alc_ch_mode_info,
3176 .get = alc_ch_mode_get,
3177 .put = alc_ch_mode_put,
3182 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3183 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3184 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3185 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3187 /* set capture source to mic-in */
3188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3189 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3190 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3191 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3193 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3194 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3198 /* mic-in to input */
3199 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3200 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3202 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3203 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3205 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3209 /* toggle speaker-output according to the hp-jack state */
3210 static void alc880_lg_lw_setup(struct hda_codec *codec)
3212 struct alc_spec *spec = codec->spec;
3214 spec->autocfg.hp_pins[0] = 0x1b;
3215 spec->autocfg.speaker_pins[0] = 0x14;
3218 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3219 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3220 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3223 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3224 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3228 static struct hda_input_mux alc880_medion_rim_capture_source = {
3232 { "Internal Mic", 0x1 },
3236 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3237 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3239 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3240 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3242 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3243 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3244 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3245 /* Mic2 (as headphone out) for HP output */
3246 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3247 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3248 /* Internal Speaker */
3249 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3250 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3252 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3253 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3255 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3259 /* toggle speaker-output according to the hp-jack state */
3260 static void alc880_medion_rim_automute(struct hda_codec *codec)
3262 struct alc_spec *spec = codec->spec;
3263 alc_automute_amp(codec);
3265 if (spec->jack_present)
3266 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3268 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3271 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3274 /* Looks like the unsol event is incompatible with the standard
3275 * definition. 4bit tag is placed at 28 bit!
3277 if ((res >> 28) == ALC880_HP_EVENT)
3278 alc880_medion_rim_automute(codec);
3281 static void alc880_medion_rim_setup(struct hda_codec *codec)
3283 struct alc_spec *spec = codec->spec;
3285 spec->autocfg.hp_pins[0] = 0x14;
3286 spec->autocfg.speaker_pins[0] = 0x1b;
3289 #ifdef CONFIG_SND_HDA_POWER_SAVE
3290 static struct hda_amp_list alc880_loopbacks[] = {
3291 { 0x0b, HDA_INPUT, 0 },
3292 { 0x0b, HDA_INPUT, 1 },
3293 { 0x0b, HDA_INPUT, 2 },
3294 { 0x0b, HDA_INPUT, 3 },
3295 { 0x0b, HDA_INPUT, 4 },
3299 static struct hda_amp_list alc880_lg_loopbacks[] = {
3300 { 0x0b, HDA_INPUT, 1 },
3301 { 0x0b, HDA_INPUT, 6 },
3302 { 0x0b, HDA_INPUT, 7 },
3311 static int alc_init(struct hda_codec *codec)
3313 struct alc_spec *spec = codec->spec;
3317 alc_auto_init_amp(codec, spec->init_amp);
3319 for (i = 0; i < spec->num_init_verbs; i++)
3320 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3322 if (spec->init_hook)
3323 spec->init_hook(codec);
3328 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3330 struct alc_spec *spec = codec->spec;
3332 if (spec->unsol_event)
3333 spec->unsol_event(codec, res);
3336 #ifdef CONFIG_SND_HDA_POWER_SAVE
3337 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3339 struct alc_spec *spec = codec->spec;
3340 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3345 * Analog playback callbacks
3347 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3348 struct hda_codec *codec,
3349 struct snd_pcm_substream *substream)
3351 struct alc_spec *spec = codec->spec;
3352 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3356 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3357 struct hda_codec *codec,
3358 unsigned int stream_tag,
3359 unsigned int format,
3360 struct snd_pcm_substream *substream)
3362 struct alc_spec *spec = codec->spec;
3363 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3364 stream_tag, format, substream);
3367 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3368 struct hda_codec *codec,
3369 struct snd_pcm_substream *substream)
3371 struct alc_spec *spec = codec->spec;
3372 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3378 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3379 struct hda_codec *codec,
3380 struct snd_pcm_substream *substream)
3382 struct alc_spec *spec = codec->spec;
3383 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3386 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3387 struct hda_codec *codec,
3388 unsigned int stream_tag,
3389 unsigned int format,
3390 struct snd_pcm_substream *substream)
3392 struct alc_spec *spec = codec->spec;
3393 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3394 stream_tag, format, substream);
3397 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3398 struct hda_codec *codec,
3399 struct snd_pcm_substream *substream)
3401 struct alc_spec *spec = codec->spec;
3402 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3405 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3406 struct hda_codec *codec,
3407 struct snd_pcm_substream *substream)
3409 struct alc_spec *spec = codec->spec;
3410 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3416 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3417 struct hda_codec *codec,
3418 unsigned int stream_tag,
3419 unsigned int format,
3420 struct snd_pcm_substream *substream)
3422 struct alc_spec *spec = codec->spec;
3424 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3425 stream_tag, 0, format);
3429 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3430 struct hda_codec *codec,
3431 struct snd_pcm_substream *substream)
3433 struct alc_spec *spec = codec->spec;
3435 snd_hda_codec_cleanup_stream(codec,
3436 spec->adc_nids[substream->number + 1]);
3443 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3447 /* NID is set in alc_build_pcms */
3449 .open = alc880_playback_pcm_open,
3450 .prepare = alc880_playback_pcm_prepare,
3451 .cleanup = alc880_playback_pcm_cleanup
3455 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3459 /* NID is set in alc_build_pcms */
3462 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3466 /* NID is set in alc_build_pcms */
3469 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3470 .substreams = 2, /* can be overridden */
3473 /* NID is set in alc_build_pcms */
3475 .prepare = alc880_alt_capture_pcm_prepare,
3476 .cleanup = alc880_alt_capture_pcm_cleanup
3480 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3484 /* NID is set in alc_build_pcms */
3486 .open = alc880_dig_playback_pcm_open,
3487 .close = alc880_dig_playback_pcm_close,
3488 .prepare = alc880_dig_playback_pcm_prepare,
3489 .cleanup = alc880_dig_playback_pcm_cleanup
3493 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3497 /* NID is set in alc_build_pcms */
3500 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3501 static struct hda_pcm_stream alc_pcm_null_stream = {
3507 static int alc_build_pcms(struct hda_codec *codec)
3509 struct alc_spec *spec = codec->spec;
3510 struct hda_pcm *info = spec->pcm_rec;
3513 codec->num_pcms = 1;
3514 codec->pcm_info = info;
3516 if (spec->no_analog)
3519 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3520 "%s Analog", codec->chip_name);
3521 info->name = spec->stream_name_analog;
3523 if (spec->stream_analog_playback) {
3524 if (snd_BUG_ON(!spec->multiout.dac_nids))
3526 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3527 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3529 if (spec->stream_analog_capture) {
3530 if (snd_BUG_ON(!spec->adc_nids))
3532 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3533 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3536 if (spec->channel_mode) {
3537 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3538 for (i = 0; i < spec->num_channel_mode; i++) {
3539 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3540 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3546 /* SPDIF for stream index #1 */
3547 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3548 snprintf(spec->stream_name_digital,
3549 sizeof(spec->stream_name_digital),
3550 "%s Digital", codec->chip_name);
3551 codec->num_pcms = 2;
3552 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3553 info = spec->pcm_rec + 1;
3554 info->name = spec->stream_name_digital;
3555 if (spec->dig_out_type)
3556 info->pcm_type = spec->dig_out_type;
3558 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3559 if (spec->multiout.dig_out_nid &&
3560 spec->stream_digital_playback) {
3561 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3562 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3564 if (spec->dig_in_nid &&
3565 spec->stream_digital_capture) {
3566 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3567 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3569 /* FIXME: do we need this for all Realtek codec models? */
3570 codec->spdif_status_reset = 1;
3573 if (spec->no_analog)
3576 /* If the use of more than one ADC is requested for the current
3577 * model, configure a second analog capture-only PCM.
3579 /* Additional Analaog capture for index #2 */
3580 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3581 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3582 codec->num_pcms = 3;
3583 info = spec->pcm_rec + 2;
3584 info->name = spec->stream_name_analog;
3585 if (spec->alt_dac_nid) {
3586 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3587 *spec->stream_analog_alt_playback;
3588 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3591 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3592 alc_pcm_null_stream;
3593 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3595 if (spec->num_adc_nids > 1) {
3596 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3597 *spec->stream_analog_alt_capture;
3598 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3600 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3601 spec->num_adc_nids - 1;
3603 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3604 alc_pcm_null_stream;
3605 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3612 static void alc_free_kctls(struct hda_codec *codec)
3614 struct alc_spec *spec = codec->spec;
3616 if (spec->kctls.list) {
3617 struct snd_kcontrol_new *kctl = spec->kctls.list;
3619 for (i = 0; i < spec->kctls.used; i++)
3620 kfree(kctl[i].name);
3622 snd_array_free(&spec->kctls);
3625 static void alc_free(struct hda_codec *codec)
3627 struct alc_spec *spec = codec->spec;
3632 alc_free_kctls(codec);
3634 snd_hda_detach_beep_device(codec);
3637 #ifdef CONFIG_SND_HDA_POWER_SAVE
3638 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3640 struct alc_spec *spec = codec->spec;
3641 if (spec && spec->power_hook)
3642 spec->power_hook(codec, 0);
3647 #ifdef SND_HDA_NEEDS_RESUME
3648 static int alc_resume(struct hda_codec *codec)
3650 #ifdef CONFIG_SND_HDA_POWER_SAVE
3651 struct alc_spec *spec = codec->spec;
3653 codec->patch_ops.init(codec);
3654 snd_hda_codec_resume_amp(codec);
3655 snd_hda_codec_resume_cache(codec);
3656 #ifdef CONFIG_SND_HDA_POWER_SAVE
3657 if (spec && spec->power_hook)
3658 spec->power_hook(codec, 1);
3666 static struct hda_codec_ops alc_patch_ops = {
3667 .build_controls = alc_build_controls,
3668 .build_pcms = alc_build_pcms,
3671 .unsol_event = alc_unsol_event,
3672 #ifdef SND_HDA_NEEDS_RESUME
3673 .resume = alc_resume,
3675 #ifdef CONFIG_SND_HDA_POWER_SAVE
3676 .suspend = alc_suspend,
3677 .check_power_status = alc_check_power_status,
3683 * Test configuration for debugging
3685 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3688 #ifdef CONFIG_SND_DEBUG
3689 static hda_nid_t alc880_test_dac_nids[4] = {
3690 0x02, 0x03, 0x04, 0x05
3693 static struct hda_input_mux alc880_test_capture_source = {
3702 { "Surround", 0x6 },
3706 static struct hda_channel_mode alc880_test_modes[4] = {
3713 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3714 struct snd_ctl_elem_info *uinfo)
3716 static char *texts[] = {
3717 "N/A", "Line Out", "HP Out",
3718 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3720 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3722 uinfo->value.enumerated.items = 8;
3723 if (uinfo->value.enumerated.item >= 8)
3724 uinfo->value.enumerated.item = 7;
3725 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3729 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3730 struct snd_ctl_elem_value *ucontrol)
3732 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3733 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3734 unsigned int pin_ctl, item = 0;
3736 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3737 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3738 if (pin_ctl & AC_PINCTL_OUT_EN) {
3739 if (pin_ctl & AC_PINCTL_HP_EN)
3743 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3744 switch (pin_ctl & AC_PINCTL_VREFEN) {
3745 case AC_PINCTL_VREF_HIZ: item = 3; break;
3746 case AC_PINCTL_VREF_50: item = 4; break;
3747 case AC_PINCTL_VREF_GRD: item = 5; break;
3748 case AC_PINCTL_VREF_80: item = 6; break;
3749 case AC_PINCTL_VREF_100: item = 7; break;
3752 ucontrol->value.enumerated.item[0] = item;
3756 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3757 struct snd_ctl_elem_value *ucontrol)
3759 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3760 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3761 static unsigned int ctls[] = {
3762 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3763 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3764 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3765 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3766 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3767 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3769 unsigned int old_ctl, new_ctl;
3771 old_ctl = snd_hda_codec_read(codec, nid, 0,
3772 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3773 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3774 if (old_ctl != new_ctl) {
3776 snd_hda_codec_write_cache(codec, nid, 0,
3777 AC_VERB_SET_PIN_WIDGET_CONTROL,
3779 val = ucontrol->value.enumerated.item[0] >= 3 ?
3781 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3788 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3789 struct snd_ctl_elem_info *uinfo)
3791 static char *texts[] = {
3792 "Front", "Surround", "CLFE", "Side"
3794 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3796 uinfo->value.enumerated.items = 4;
3797 if (uinfo->value.enumerated.item >= 4)
3798 uinfo->value.enumerated.item = 3;
3799 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3803 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3804 struct snd_ctl_elem_value *ucontrol)
3806 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3807 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3810 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3811 ucontrol->value.enumerated.item[0] = sel & 3;
3815 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3816 struct snd_ctl_elem_value *ucontrol)
3818 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3819 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3822 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3823 if (ucontrol->value.enumerated.item[0] != sel) {
3824 sel = ucontrol->value.enumerated.item[0] & 3;
3825 snd_hda_codec_write_cache(codec, nid, 0,
3826 AC_VERB_SET_CONNECT_SEL, sel);
3832 #define PIN_CTL_TEST(xname,nid) { \
3833 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3835 .info = alc_test_pin_ctl_info, \
3836 .get = alc_test_pin_ctl_get, \
3837 .put = alc_test_pin_ctl_put, \
3838 .private_value = nid \
3841 #define PIN_SRC_TEST(xname,nid) { \
3842 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3844 .info = alc_test_pin_src_info, \
3845 .get = alc_test_pin_src_get, \
3846 .put = alc_test_pin_src_put, \
3847 .private_value = nid \
3850 static struct snd_kcontrol_new alc880_test_mixer[] = {
3851 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3852 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3853 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3854 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3855 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3856 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3857 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3858 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3859 PIN_CTL_TEST("Front Pin Mode", 0x14),
3860 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3861 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3862 PIN_CTL_TEST("Side Pin Mode", 0x17),
3863 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3864 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3865 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3866 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3867 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3868 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3869 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3870 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3871 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3872 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3873 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3874 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3875 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3876 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3877 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3878 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3879 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3880 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3882 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3883 .name = "Channel Mode",
3884 .info = alc_ch_mode_info,
3885 .get = alc_ch_mode_get,
3886 .put = alc_ch_mode_put,
3891 static struct hda_verb alc880_test_init_verbs[] = {
3892 /* Unmute inputs of 0x0c - 0x0f */
3893 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3896 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3899 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3900 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3901 /* Vol output for 0x0c-0x0f */
3902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3905 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3906 /* Set output pins 0x14-0x17 */
3907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3908 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3909 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3910 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3911 /* Unmute output pins 0x14-0x17 */
3912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3914 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3915 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3916 /* Set input pins 0x18-0x1c */
3917 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3918 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3919 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3920 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3921 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3922 /* Mute input pins 0x18-0x1b */
3923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3924 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3925 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3926 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3929 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3931 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3932 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3933 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3934 /* Analog input/passthru */
3935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3947 static const char *alc880_models[ALC880_MODEL_LAST] = {
3948 [ALC880_3ST] = "3stack",
3949 [ALC880_TCL_S700] = "tcl",
3950 [ALC880_3ST_DIG] = "3stack-digout",
3951 [ALC880_CLEVO] = "clevo",
3952 [ALC880_5ST] = "5stack",
3953 [ALC880_5ST_DIG] = "5stack-digout",
3954 [ALC880_W810] = "w810",
3955 [ALC880_Z71V] = "z71v",
3956 [ALC880_6ST] = "6stack",
3957 [ALC880_6ST_DIG] = "6stack-digout",
3958 [ALC880_ASUS] = "asus",
3959 [ALC880_ASUS_W1V] = "asus-w1v",
3960 [ALC880_ASUS_DIG] = "asus-dig",
3961 [ALC880_ASUS_DIG2] = "asus-dig2",
3962 [ALC880_UNIWILL_DIG] = "uniwill",
3963 [ALC880_UNIWILL_P53] = "uniwill-p53",
3964 [ALC880_FUJITSU] = "fujitsu",
3965 [ALC880_F1734] = "F1734",
3967 [ALC880_LG_LW] = "lg-lw",
3968 [ALC880_MEDION_RIM] = "medion",
3969 #ifdef CONFIG_SND_DEBUG
3970 [ALC880_TEST] = "test",
3972 [ALC880_AUTO] = "auto",
3975 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3976 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3977 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3978 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3979 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3980 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3981 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3982 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3983 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3984 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3985 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3986 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3987 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3988 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3989 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3990 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3991 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3992 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3993 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3994 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3995 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3996 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3997 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3998 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3999 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4000 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4001 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4002 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4003 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4004 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4005 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4006 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4007 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4008 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4009 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4010 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4011 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4012 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4013 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4014 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4015 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4016 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4017 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4018 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4019 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4020 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4021 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4022 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4023 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4024 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4025 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4026 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4027 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4028 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4029 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4030 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4031 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4032 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4033 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4034 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4035 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4036 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4037 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4038 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4039 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4040 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4041 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4042 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4043 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4045 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4046 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4047 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4052 * ALC880 codec presets
4054 static struct alc_config_preset alc880_presets[] = {
4056 .mixers = { alc880_three_stack_mixer },
4057 .init_verbs = { alc880_volume_init_verbs,
4058 alc880_pin_3stack_init_verbs },
4059 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4060 .dac_nids = alc880_dac_nids,
4061 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4062 .channel_mode = alc880_threestack_modes,
4064 .input_mux = &alc880_capture_source,
4066 [ALC880_3ST_DIG] = {
4067 .mixers = { alc880_three_stack_mixer },
4068 .init_verbs = { alc880_volume_init_verbs,
4069 alc880_pin_3stack_init_verbs },
4070 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4071 .dac_nids = alc880_dac_nids,
4072 .dig_out_nid = ALC880_DIGOUT_NID,
4073 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4074 .channel_mode = alc880_threestack_modes,
4076 .input_mux = &alc880_capture_source,
4078 [ALC880_TCL_S700] = {
4079 .mixers = { alc880_tcl_s700_mixer },
4080 .init_verbs = { alc880_volume_init_verbs,
4081 alc880_pin_tcl_S700_init_verbs,
4082 alc880_gpio2_init_verbs },
4083 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4084 .dac_nids = alc880_dac_nids,
4085 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4086 .num_adc_nids = 1, /* single ADC */
4088 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4089 .channel_mode = alc880_2_jack_modes,
4090 .input_mux = &alc880_capture_source,
4093 .mixers = { alc880_three_stack_mixer,
4094 alc880_five_stack_mixer},
4095 .init_verbs = { alc880_volume_init_verbs,
4096 alc880_pin_5stack_init_verbs },
4097 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4098 .dac_nids = alc880_dac_nids,
4099 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4100 .channel_mode = alc880_fivestack_modes,
4101 .input_mux = &alc880_capture_source,
4103 [ALC880_5ST_DIG] = {
4104 .mixers = { alc880_three_stack_mixer,
4105 alc880_five_stack_mixer },
4106 .init_verbs = { alc880_volume_init_verbs,
4107 alc880_pin_5stack_init_verbs },
4108 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4109 .dac_nids = alc880_dac_nids,
4110 .dig_out_nid = ALC880_DIGOUT_NID,
4111 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4112 .channel_mode = alc880_fivestack_modes,
4113 .input_mux = &alc880_capture_source,
4116 .mixers = { alc880_six_stack_mixer },
4117 .init_verbs = { alc880_volume_init_verbs,
4118 alc880_pin_6stack_init_verbs },
4119 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4120 .dac_nids = alc880_6st_dac_nids,
4121 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4122 .channel_mode = alc880_sixstack_modes,
4123 .input_mux = &alc880_6stack_capture_source,
4125 [ALC880_6ST_DIG] = {
4126 .mixers = { alc880_six_stack_mixer },
4127 .init_verbs = { alc880_volume_init_verbs,
4128 alc880_pin_6stack_init_verbs },
4129 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4130 .dac_nids = alc880_6st_dac_nids,
4131 .dig_out_nid = ALC880_DIGOUT_NID,
4132 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4133 .channel_mode = alc880_sixstack_modes,
4134 .input_mux = &alc880_6stack_capture_source,
4137 .mixers = { alc880_w810_base_mixer },
4138 .init_verbs = { alc880_volume_init_verbs,
4139 alc880_pin_w810_init_verbs,
4140 alc880_gpio2_init_verbs },
4141 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4142 .dac_nids = alc880_w810_dac_nids,
4143 .dig_out_nid = ALC880_DIGOUT_NID,
4144 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4145 .channel_mode = alc880_w810_modes,
4146 .input_mux = &alc880_capture_source,
4149 .mixers = { alc880_z71v_mixer },
4150 .init_verbs = { alc880_volume_init_verbs,
4151 alc880_pin_z71v_init_verbs },
4152 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4153 .dac_nids = alc880_z71v_dac_nids,
4154 .dig_out_nid = ALC880_DIGOUT_NID,
4156 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4157 .channel_mode = alc880_2_jack_modes,
4158 .input_mux = &alc880_capture_source,
4161 .mixers = { alc880_f1734_mixer },
4162 .init_verbs = { alc880_volume_init_verbs,
4163 alc880_pin_f1734_init_verbs },
4164 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4165 .dac_nids = alc880_f1734_dac_nids,
4167 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4168 .channel_mode = alc880_2_jack_modes,
4169 .input_mux = &alc880_f1734_capture_source,
4170 .unsol_event = alc880_uniwill_p53_unsol_event,
4171 .setup = alc880_uniwill_p53_setup,
4172 .init_hook = alc_automute_amp,
4175 .mixers = { alc880_asus_mixer },
4176 .init_verbs = { alc880_volume_init_verbs,
4177 alc880_pin_asus_init_verbs,
4178 alc880_gpio1_init_verbs },
4179 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4180 .dac_nids = alc880_asus_dac_nids,
4181 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4182 .channel_mode = alc880_asus_modes,
4184 .input_mux = &alc880_capture_source,
4186 [ALC880_ASUS_DIG] = {
4187 .mixers = { alc880_asus_mixer },
4188 .init_verbs = { alc880_volume_init_verbs,
4189 alc880_pin_asus_init_verbs,
4190 alc880_gpio1_init_verbs },
4191 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4192 .dac_nids = alc880_asus_dac_nids,
4193 .dig_out_nid = ALC880_DIGOUT_NID,
4194 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4195 .channel_mode = alc880_asus_modes,
4197 .input_mux = &alc880_capture_source,
4199 [ALC880_ASUS_DIG2] = {
4200 .mixers = { alc880_asus_mixer },
4201 .init_verbs = { alc880_volume_init_verbs,
4202 alc880_pin_asus_init_verbs,
4203 alc880_gpio2_init_verbs }, /* use GPIO2 */
4204 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4205 .dac_nids = alc880_asus_dac_nids,
4206 .dig_out_nid = ALC880_DIGOUT_NID,
4207 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4208 .channel_mode = alc880_asus_modes,
4210 .input_mux = &alc880_capture_source,
4212 [ALC880_ASUS_W1V] = {
4213 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4214 .init_verbs = { alc880_volume_init_verbs,
4215 alc880_pin_asus_init_verbs,
4216 alc880_gpio1_init_verbs },
4217 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4218 .dac_nids = alc880_asus_dac_nids,
4219 .dig_out_nid = ALC880_DIGOUT_NID,
4220 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4221 .channel_mode = alc880_asus_modes,
4223 .input_mux = &alc880_capture_source,
4225 [ALC880_UNIWILL_DIG] = {
4226 .mixers = { alc880_asus_mixer },
4227 .init_verbs = { alc880_volume_init_verbs,
4228 alc880_pin_asus_init_verbs },
4229 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4230 .dac_nids = alc880_asus_dac_nids,
4231 .dig_out_nid = ALC880_DIGOUT_NID,
4232 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4233 .channel_mode = alc880_asus_modes,
4235 .input_mux = &alc880_capture_source,
4237 [ALC880_UNIWILL] = {
4238 .mixers = { alc880_uniwill_mixer },
4239 .init_verbs = { alc880_volume_init_verbs,
4240 alc880_uniwill_init_verbs },
4241 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4242 .dac_nids = alc880_asus_dac_nids,
4243 .dig_out_nid = ALC880_DIGOUT_NID,
4244 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4245 .channel_mode = alc880_threestack_modes,
4247 .input_mux = &alc880_capture_source,
4248 .unsol_event = alc880_uniwill_unsol_event,
4249 .setup = alc880_uniwill_setup,
4250 .init_hook = alc880_uniwill_init_hook,
4252 [ALC880_UNIWILL_P53] = {
4253 .mixers = { alc880_uniwill_p53_mixer },
4254 .init_verbs = { alc880_volume_init_verbs,
4255 alc880_uniwill_p53_init_verbs },
4256 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4257 .dac_nids = alc880_asus_dac_nids,
4258 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4259 .channel_mode = alc880_threestack_modes,
4260 .input_mux = &alc880_capture_source,
4261 .unsol_event = alc880_uniwill_p53_unsol_event,
4262 .setup = alc880_uniwill_p53_setup,
4263 .init_hook = alc_automute_amp,
4265 [ALC880_FUJITSU] = {
4266 .mixers = { alc880_fujitsu_mixer },
4267 .init_verbs = { alc880_volume_init_verbs,
4268 alc880_uniwill_p53_init_verbs,
4269 alc880_beep_init_verbs },
4270 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4271 .dac_nids = alc880_dac_nids,
4272 .dig_out_nid = ALC880_DIGOUT_NID,
4273 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4274 .channel_mode = alc880_2_jack_modes,
4275 .input_mux = &alc880_capture_source,
4276 .unsol_event = alc880_uniwill_p53_unsol_event,
4277 .setup = alc880_uniwill_p53_setup,
4278 .init_hook = alc_automute_amp,
4281 .mixers = { alc880_three_stack_mixer },
4282 .init_verbs = { alc880_volume_init_verbs,
4283 alc880_pin_clevo_init_verbs },
4284 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4285 .dac_nids = alc880_dac_nids,
4287 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4288 .channel_mode = alc880_threestack_modes,
4290 .input_mux = &alc880_capture_source,
4293 .mixers = { alc880_lg_mixer },
4294 .init_verbs = { alc880_volume_init_verbs,
4295 alc880_lg_init_verbs },
4296 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4297 .dac_nids = alc880_lg_dac_nids,
4298 .dig_out_nid = ALC880_DIGOUT_NID,
4299 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4300 .channel_mode = alc880_lg_ch_modes,
4302 .input_mux = &alc880_lg_capture_source,
4303 .unsol_event = alc_automute_amp_unsol_event,
4304 .setup = alc880_lg_setup,
4305 .init_hook = alc_automute_amp,
4306 #ifdef CONFIG_SND_HDA_POWER_SAVE
4307 .loopbacks = alc880_lg_loopbacks,
4311 .mixers = { alc880_lg_lw_mixer },
4312 .init_verbs = { alc880_volume_init_verbs,
4313 alc880_lg_lw_init_verbs },
4314 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4315 .dac_nids = alc880_dac_nids,
4316 .dig_out_nid = ALC880_DIGOUT_NID,
4317 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4318 .channel_mode = alc880_lg_lw_modes,
4319 .input_mux = &alc880_lg_lw_capture_source,
4320 .unsol_event = alc_automute_amp_unsol_event,
4321 .setup = alc880_lg_lw_setup,
4322 .init_hook = alc_automute_amp,
4324 [ALC880_MEDION_RIM] = {
4325 .mixers = { alc880_medion_rim_mixer },
4326 .init_verbs = { alc880_volume_init_verbs,
4327 alc880_medion_rim_init_verbs,
4328 alc_gpio2_init_verbs },
4329 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4330 .dac_nids = alc880_dac_nids,
4331 .dig_out_nid = ALC880_DIGOUT_NID,
4332 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4333 .channel_mode = alc880_2_jack_modes,
4334 .input_mux = &alc880_medion_rim_capture_source,
4335 .unsol_event = alc880_medion_rim_unsol_event,
4336 .setup = alc880_medion_rim_setup,
4337 .init_hook = alc880_medion_rim_automute,
4339 #ifdef CONFIG_SND_DEBUG
4341 .mixers = { alc880_test_mixer },
4342 .init_verbs = { alc880_test_init_verbs },
4343 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4344 .dac_nids = alc880_test_dac_nids,
4345 .dig_out_nid = ALC880_DIGOUT_NID,
4346 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4347 .channel_mode = alc880_test_modes,
4348 .input_mux = &alc880_test_capture_source,
4354 * Automatic parse of I/O pins from the BIOS configuration
4359 ALC_CTL_WIDGET_MUTE,
4362 static struct snd_kcontrol_new alc880_control_templates[] = {
4363 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4364 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4365 HDA_BIND_MUTE(NULL, 0, 0, 0),
4368 /* add dynamic controls */
4369 static int add_control(struct alc_spec *spec, int type, const char *name,
4372 struct snd_kcontrol_new *knew;
4374 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4375 knew = snd_array_new(&spec->kctls);
4378 *knew = alc880_control_templates[type];
4379 knew->name = kstrdup(name, GFP_KERNEL);
4382 if (get_amp_nid_(val))
4383 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
4384 knew->private_value = val;
4388 static int add_control_with_pfx(struct alc_spec *spec, int type,
4389 const char *pfx, const char *dir,
4390 const char *sfx, unsigned long val)
4393 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4394 return add_control(spec, type, name, val);
4397 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4398 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4399 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4400 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4402 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4403 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4404 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4405 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4406 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4407 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4408 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4409 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4410 #define ALC880_PIN_CD_NID 0x1c
4412 /* fill in the dac_nids table from the parsed pin configuration */
4413 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4414 const struct auto_pin_cfg *cfg)
4420 memset(assigned, 0, sizeof(assigned));
4421 spec->multiout.dac_nids = spec->private_dac_nids;
4423 /* check the pins hardwired to audio widget */
4424 for (i = 0; i < cfg->line_outs; i++) {
4425 nid = cfg->line_out_pins[i];
4426 if (alc880_is_fixed_pin(nid)) {
4427 int idx = alc880_fixed_pin_idx(nid);
4428 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4432 /* left pins can be connect to any audio widget */
4433 for (i = 0; i < cfg->line_outs; i++) {
4434 nid = cfg->line_out_pins[i];
4435 if (alc880_is_fixed_pin(nid))
4437 /* search for an empty channel */
4438 for (j = 0; j < cfg->line_outs; j++) {
4440 spec->multiout.dac_nids[i] =
4441 alc880_idx_to_dac(j);
4447 spec->multiout.num_dacs = cfg->line_outs;
4451 /* add playback controls from the parsed DAC table */
4452 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4453 const struct auto_pin_cfg *cfg)
4455 static const char *chname[4] = {
4456 "Front", "Surround", NULL /*CLFE*/, "Side"
4461 for (i = 0; i < cfg->line_outs; i++) {
4462 if (!spec->multiout.dac_nids[i])
4464 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4467 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4469 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4473 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4475 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4479 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4481 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4485 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4487 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4493 if (cfg->line_outs == 1 &&
4494 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4498 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4499 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4503 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4504 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4513 /* add playback controls for speaker and HP outputs */
4514 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4523 if (alc880_is_fixed_pin(pin)) {
4524 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4525 /* specify the DAC as the extra output */
4526 if (!spec->multiout.hp_nid)
4527 spec->multiout.hp_nid = nid;
4529 spec->multiout.extra_out_nid[0] = nid;
4530 /* control HP volume/switch on the output mixer amp */
4531 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4532 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4533 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4536 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4537 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4540 } else if (alc880_is_multi_pin(pin)) {
4541 /* set manual connection */
4542 /* we have only a switch on HP-out PIN */
4543 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4544 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4551 /* create input playback/capture controls for the given pin */
4552 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4553 const char *ctlname,
4554 int idx, hda_nid_t mix_nid)
4558 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4559 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4562 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4563 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4569 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4571 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4572 return (pincap & AC_PINCAP_IN) != 0;
4575 /* create playback/capture controls for input pins */
4576 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4577 const struct auto_pin_cfg *cfg,
4579 hda_nid_t cap1, hda_nid_t cap2)
4581 struct alc_spec *spec = codec->spec;
4582 struct hda_input_mux *imux = &spec->private_imux[0];
4585 for (i = 0; i < AUTO_PIN_LAST; i++) {
4588 pin = cfg->input_pins[i];
4589 if (!alc_is_input_pin(codec, pin))
4593 idx = get_connection_index(codec, mixer, pin);
4595 err = new_analog_input(spec, pin,
4596 auto_pin_cfg_labels[i],
4605 idx = get_connection_index(codec, cap1, pin);
4606 if (idx < 0 && cap2)
4607 idx = get_connection_index(codec, cap2, pin);
4609 imux->items[imux->num_items].label =
4610 auto_pin_cfg_labels[i];
4611 imux->items[imux->num_items].index = idx;
4618 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4619 const struct auto_pin_cfg *cfg)
4621 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4624 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4625 unsigned int pin_type)
4627 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4630 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4634 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4635 hda_nid_t nid, int pin_type,
4638 alc_set_pin_output(codec, nid, pin_type);
4639 /* need the manual connection? */
4640 if (alc880_is_multi_pin(nid)) {
4641 struct alc_spec *spec = codec->spec;
4642 int idx = alc880_multi_pin_idx(nid);
4643 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4644 AC_VERB_SET_CONNECT_SEL,
4645 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4649 static int get_pin_type(int line_out_type)
4651 if (line_out_type == AUTO_PIN_HP_OUT)
4657 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4659 struct alc_spec *spec = codec->spec;
4662 for (i = 0; i < spec->autocfg.line_outs; i++) {
4663 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4664 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4665 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4669 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4671 struct alc_spec *spec = codec->spec;
4674 pin = spec->autocfg.speaker_pins[0];
4675 if (pin) /* connect to front */
4676 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4677 pin = spec->autocfg.hp_pins[0];
4678 if (pin) /* connect to front */
4679 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4682 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4684 struct alc_spec *spec = codec->spec;
4687 for (i = 0; i < AUTO_PIN_LAST; i++) {
4688 hda_nid_t nid = spec->autocfg.input_pins[i];
4689 if (alc_is_input_pin(codec, nid)) {
4690 alc_set_input_pin(codec, nid, i);
4691 if (nid != ALC880_PIN_CD_NID &&
4692 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4693 snd_hda_codec_write(codec, nid, 0,
4694 AC_VERB_SET_AMP_GAIN_MUTE,
4700 /* parse the BIOS configuration and set up the alc_spec */
4701 /* return 1 if successful, 0 if the proper config is not found,
4702 * or a negative error code
4704 static int alc880_parse_auto_config(struct hda_codec *codec)
4706 struct alc_spec *spec = codec->spec;
4708 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4710 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4714 if (!spec->autocfg.line_outs)
4715 return 0; /* can't find valid BIOS pin config */
4717 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4720 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4723 err = alc880_auto_create_extra_out(spec,
4724 spec->autocfg.speaker_pins[0],
4728 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4732 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4736 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4738 /* check multiple SPDIF-out (for recent codecs) */
4739 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4741 err = snd_hda_get_connections(codec,
4742 spec->autocfg.dig_out_pins[i],
4747 spec->multiout.dig_out_nid = dig_nid;
4749 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4750 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4752 spec->slave_dig_outs[i - 1] = dig_nid;
4755 if (spec->autocfg.dig_in_pin)
4756 spec->dig_in_nid = ALC880_DIGIN_NID;
4758 if (spec->kctls.list)
4759 add_mixer(spec, spec->kctls.list);
4761 add_verb(spec, alc880_volume_init_verbs);
4763 spec->num_mux_defs = 1;
4764 spec->input_mux = &spec->private_imux[0];
4766 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4771 /* additional initialization for auto-configuration model */
4772 static void alc880_auto_init(struct hda_codec *codec)
4774 struct alc_spec *spec = codec->spec;
4775 alc880_auto_init_multi_out(codec);
4776 alc880_auto_init_extra_out(codec);
4777 alc880_auto_init_analog_input(codec);
4778 if (spec->unsol_event)
4779 alc_inithook(codec);
4782 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4783 * one of two digital mic pins, e.g. on ALC272
4785 static void fixup_automic_adc(struct hda_codec *codec)
4787 struct alc_spec *spec = codec->spec;
4790 for (i = 0; i < spec->num_adc_nids; i++) {
4791 hda_nid_t cap = spec->capsrc_nids ?
4792 spec->capsrc_nids[i] : spec->adc_nids[i];
4795 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4798 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4801 spec->int_mic.mux_idx = iidx;
4802 spec->ext_mic.mux_idx = eidx;
4803 if (spec->capsrc_nids)
4804 spec->capsrc_nids += i;
4805 spec->adc_nids += i;
4806 spec->num_adc_nids = 1;
4809 snd_printd(KERN_INFO "hda_codec: %s: "
4810 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4811 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4812 spec->auto_mic = 0; /* disable auto-mic to be sure */
4815 static void set_capture_mixer(struct hda_codec *codec)
4817 struct alc_spec *spec = codec->spec;
4818 static struct snd_kcontrol_new *caps[2][3] = {
4819 { alc_capture_mixer_nosrc1,
4820 alc_capture_mixer_nosrc2,
4821 alc_capture_mixer_nosrc3 },
4822 { alc_capture_mixer1,
4824 alc_capture_mixer3 },
4826 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4828 if (spec->auto_mic) {
4830 fixup_automic_adc(codec);
4831 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4835 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4839 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4840 #define set_beep_amp(spec, nid, idx, dir) \
4841 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4843 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4847 * OK, here we have finally the patch for ALC880
4850 static int patch_alc880(struct hda_codec *codec)
4852 struct alc_spec *spec;
4856 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4862 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4865 if (board_config < 0) {
4866 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4868 board_config = ALC880_AUTO;
4871 if (board_config == ALC880_AUTO) {
4872 /* automatic parse from the BIOS config */
4873 err = alc880_parse_auto_config(codec);
4879 "hda_codec: Cannot set up configuration "
4880 "from BIOS. Using 3-stack mode...\n");
4881 board_config = ALC880_3ST;
4885 err = snd_hda_attach_beep_device(codec, 0x1);
4891 if (board_config != ALC880_AUTO)
4892 setup_preset(codec, &alc880_presets[board_config]);
4894 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4895 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4896 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4898 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4899 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4901 if (!spec->adc_nids && spec->input_mux) {
4902 /* check whether NID 0x07 is valid */
4903 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4905 wcap = get_wcaps_type(wcap);
4906 if (wcap != AC_WID_AUD_IN) {
4907 spec->adc_nids = alc880_adc_nids_alt;
4908 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4910 spec->adc_nids = alc880_adc_nids;
4911 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4914 set_capture_mixer(codec);
4915 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4917 spec->vmaster_nid = 0x0c;
4919 codec->patch_ops = alc_patch_ops;
4920 if (board_config == ALC880_AUTO)
4921 spec->init_hook = alc880_auto_init;
4922 #ifdef CONFIG_SND_HDA_POWER_SAVE
4923 if (!spec->loopback.amplist)
4924 spec->loopback.amplist = alc880_loopbacks;
4926 codec->proc_widget_hook = print_realtek_coef;
4936 static hda_nid_t alc260_dac_nids[1] = {
4941 static hda_nid_t alc260_adc_nids[1] = {
4946 static hda_nid_t alc260_adc_nids_alt[1] = {
4951 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4952 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4954 static hda_nid_t alc260_dual_adc_nids[2] = {
4959 #define ALC260_DIGOUT_NID 0x03
4960 #define ALC260_DIGIN_NID 0x06
4962 static struct hda_input_mux alc260_capture_source = {
4966 { "Front Mic", 0x1 },
4972 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4973 * headphone jack and the internal CD lines since these are the only pins at
4974 * which audio can appear. For flexibility, also allow the option of
4975 * recording the mixer output on the second ADC (ADC0 doesn't have a
4976 * connection to the mixer output).
4978 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4982 { "Mic/Line", 0x0 },
4984 { "Headphone", 0x2 },
4990 { "Mic/Line", 0x0 },
4992 { "Headphone", 0x2 },
4999 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5000 * the Fujitsu S702x, but jacks are marked differently.
5002 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5009 { "Headphone", 0x5 },
5018 { "Headphone", 0x6 },
5024 /* Maxdata Favorit 100XS */
5025 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5029 { "Line/Mic", 0x0 },
5036 { "Line/Mic", 0x0 },
5044 * This is just place-holder, so there's something for alc_build_pcms to look
5045 * at when it calculates the maximum number of channels. ALC260 has no mixer
5046 * element which allows changing the channel mode, so the verb list is
5049 static struct hda_channel_mode alc260_modes[1] = {
5054 /* Mixer combinations
5056 * basic: base_output + input + pc_beep + capture
5057 * HP: base_output + input + capture_alt
5058 * HP_3013: hp_3013 + input + capture
5059 * fujitsu: fujitsu + capture
5060 * acer: acer + capture
5063 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5064 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5065 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5066 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5067 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5068 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5069 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5073 static struct snd_kcontrol_new alc260_input_mixer[] = {
5074 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5075 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5076 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5077 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5079 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5080 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5081 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5085 /* update HP, line and mono out pins according to the master switch */
5086 static void alc260_hp_master_update(struct hda_codec *codec,
5087 hda_nid_t hp, hda_nid_t line,
5090 struct alc_spec *spec = codec->spec;
5091 unsigned int val = spec->master_sw ? PIN_HP : 0;
5092 /* change HP and line-out pins */
5093 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5095 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5097 /* mono (speaker) depending on the HP jack sense */
5098 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5099 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5103 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5104 struct snd_ctl_elem_value *ucontrol)
5106 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5107 struct alc_spec *spec = codec->spec;
5108 *ucontrol->value.integer.value = spec->master_sw;
5112 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5113 struct snd_ctl_elem_value *ucontrol)
5115 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5116 struct alc_spec *spec = codec->spec;
5117 int val = !!*ucontrol->value.integer.value;
5118 hda_nid_t hp, line, mono;
5120 if (val == spec->master_sw)
5122 spec->master_sw = val;
5123 hp = (kcontrol->private_value >> 16) & 0xff;
5124 line = (kcontrol->private_value >> 8) & 0xff;
5125 mono = kcontrol->private_value & 0xff;
5126 alc260_hp_master_update(codec, hp, line, mono);
5130 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5133 .name = "Master Playback Switch",
5134 .info = snd_ctl_boolean_mono_info,
5135 .get = alc260_hp_master_sw_get,
5136 .put = alc260_hp_master_sw_put,
5137 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5139 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5140 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5141 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5142 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5143 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5145 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5149 static struct hda_verb alc260_hp_unsol_verbs[] = {
5150 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5154 static void alc260_hp_automute(struct hda_codec *codec)
5156 struct alc_spec *spec = codec->spec;
5158 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5159 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5162 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5164 if ((res >> 26) == ALC880_HP_EVENT)
5165 alc260_hp_automute(codec);
5168 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5170 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5171 .name = "Master Playback Switch",
5172 .info = snd_ctl_boolean_mono_info,
5173 .get = alc260_hp_master_sw_get,
5174 .put = alc260_hp_master_sw_put,
5175 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5177 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5178 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5179 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5180 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5181 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5183 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5184 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5188 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5189 .ops = &snd_hda_bind_vol,
5191 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5192 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5193 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5198 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5199 .ops = &snd_hda_bind_sw,
5201 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5202 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5207 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5208 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5209 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5210 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5211 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5215 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5216 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5220 static void alc260_hp_3013_automute(struct hda_codec *codec)
5222 struct alc_spec *spec = codec->spec;
5224 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5225 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5228 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5231 if ((res >> 26) == ALC880_HP_EVENT)
5232 alc260_hp_3013_automute(codec);
5235 static void alc260_hp_3012_automute(struct hda_codec *codec)
5237 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5239 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5241 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5243 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5247 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5250 if ((res >> 26) == ALC880_HP_EVENT)
5251 alc260_hp_3012_automute(codec);
5254 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5255 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5257 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5259 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5260 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5261 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5262 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5263 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5264 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5265 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5266 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5267 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5271 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5272 * versions of the ALC260 don't act on requests to enable mic bias from NID
5273 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5274 * datasheet doesn't mention this restriction. At this stage it's not clear
5275 * whether this behaviour is intentional or is a hardware bug in chip
5276 * revisions available in early 2006. Therefore for now allow the
5277 * "Headphone Jack Mode" control to span all choices, but if it turns out
5278 * that the lack of mic bias for this NID is intentional we could change the
5279 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5281 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5282 * don't appear to make the mic bias available from the "line" jack, even
5283 * though the NID used for this jack (0x14) can supply it. The theory is
5284 * that perhaps Acer have included blocking capacitors between the ALC260
5285 * and the output jack. If this turns out to be the case for all such
5286 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5287 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5289 * The C20x Tablet series have a mono internal speaker which is controlled
5290 * via the chip's Mono sum widget and pin complex, so include the necessary
5291 * controls for such models. On models without a "mono speaker" the control
5292 * won't do anything.
5294 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5295 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5296 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5297 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5298 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5300 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5302 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5303 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5304 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5305 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5306 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5307 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5308 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5309 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5313 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5315 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5316 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5317 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5318 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5319 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5320 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5321 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5325 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5326 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5328 static struct snd_kcontrol_new alc260_will_mixer[] = {
5329 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5330 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5332 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5333 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5334 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5335 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5336 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5337 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5338 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5342 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5343 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5345 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5346 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5347 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5349 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5350 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5351 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5352 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5353 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5354 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5355 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5360 * initialization verbs
5362 static struct hda_verb alc260_init_verbs[] = {
5363 /* Line In pin widget for input */
5364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5365 /* CD pin widget for input */
5366 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5367 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5368 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5369 /* Mic2 (front panel) pin widget for input and vref at 80% */
5370 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5371 /* LINE-2 is used for line-out in rear */
5372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5373 /* select line-out */
5374 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5376 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5378 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5380 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5381 /* mute capture amp left and right */
5382 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5383 /* set connection select to line in (default select for this ADC) */
5384 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5385 /* mute capture amp left and right */
5386 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5387 /* set connection select to line in (default select for this ADC) */
5388 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5389 /* set vol=0 Line-Out mixer amp left and right */
5390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5391 /* unmute pin widget amp left and right (no gain on this amp) */
5392 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5393 /* set vol=0 HP mixer amp left and right */
5394 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5395 /* unmute pin widget amp left and right (no gain on this amp) */
5396 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5397 /* set vol=0 Mono mixer amp left and right */
5398 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5399 /* unmute pin widget amp left and right (no gain on this amp) */
5400 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5401 /* unmute LINE-2 out pin */
5402 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5403 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5406 /* mute analog inputs */
5407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5412 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5413 /* mute Front out path */
5414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5415 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5416 /* mute Headphone out path */
5417 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5419 /* mute Mono out path */
5420 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5421 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5425 #if 0 /* should be identical with alc260_init_verbs? */
5426 static struct hda_verb alc260_hp_init_verbs[] = {
5427 /* Headphone and output */
5428 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5430 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5431 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5432 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5433 /* Mic2 (front panel) pin widget for input and vref at 80% */
5434 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5435 /* Line In pin widget for input */
5436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5437 /* Line-2 pin widget for output */
5438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5439 /* CD pin widget for input */
5440 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5441 /* unmute amp left and right */
5442 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5443 /* set connection select to line in (default select for this ADC) */
5444 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5445 /* unmute Line-Out mixer amp left and right (volume = 0) */
5446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5447 /* mute pin widget amp left and right (no gain on this amp) */
5448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5449 /* unmute HP mixer amp left and right (volume = 0) */
5450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5451 /* mute pin widget amp left and right (no gain on this amp) */
5452 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5453 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5456 /* mute analog inputs */
5457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5462 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5463 /* Unmute Front out path */
5464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5466 /* Unmute Headphone out path */
5467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5469 /* Unmute Mono out path */
5470 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5471 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5476 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5477 /* Line out and output */
5478 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5480 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5481 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5482 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5483 /* Mic2 (front panel) pin widget for input and vref at 80% */
5484 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5485 /* Line In pin widget for input */
5486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5487 /* Headphone pin widget for output */
5488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5489 /* CD pin widget for input */
5490 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5491 /* unmute amp left and right */
5492 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5493 /* set connection select to line in (default select for this ADC) */
5494 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5495 /* unmute Line-Out mixer amp left and right (volume = 0) */
5496 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5497 /* mute pin widget amp left and right (no gain on this amp) */
5498 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5499 /* unmute HP mixer amp left and right (volume = 0) */
5500 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5501 /* mute pin widget amp left and right (no gain on this amp) */
5502 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5503 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5506 /* mute analog inputs */
5507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5512 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5513 /* Unmute Front out path */
5514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5515 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5516 /* Unmute Headphone out path */
5517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5518 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5519 /* Unmute Mono out path */
5520 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5521 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5525 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5526 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5527 * audio = 0x16, internal speaker = 0x10.
5529 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5530 /* Disable all GPIOs */
5531 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5532 /* Internal speaker is connected to headphone pin */
5533 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5534 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5536 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5537 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5538 /* Ensure all other unused pins are disabled and muted. */
5539 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5541 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5542 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5543 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5544 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5546 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5548 /* Disable digital (SPDIF) pins */
5549 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5550 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5552 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5553 * when acting as an output.
5555 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5557 /* Start with output sum widgets muted and their output gains at min */
5558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5559 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5560 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5562 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5563 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5564 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5565 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5566 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5568 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5569 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5570 /* Unmute Line1 pin widget output buffer since it starts as an output.
5571 * If the pin mode is changed by the user the pin mode control will
5572 * take care of enabling the pin's input/output buffers as needed.
5573 * Therefore there's no need to enable the input buffer at this
5576 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5577 /* Unmute input buffer of pin widget used for Line-in (no equiv
5580 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5582 /* Mute capture amp left and right */
5583 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5584 /* Set ADC connection select to match default mixer setting - line
5587 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5589 /* Do the same for the second ADC: mute capture input amp and
5590 * set ADC connection to line in (on mic1 pin)
5592 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5593 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5595 /* Mute all inputs to mixer widget (even unconnected ones) */
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5603 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5608 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5609 * similar laptops (adapted from Fujitsu init verbs).
5611 static struct hda_verb alc260_acer_init_verbs[] = {
5612 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5613 * the headphone jack. Turn this on and rely on the standard mute
5614 * methods whenever the user wants to turn these outputs off.
5616 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5617 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5618 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5619 /* Internal speaker/Headphone jack is connected to Line-out pin */
5620 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5621 /* Internal microphone/Mic jack is connected to Mic1 pin */
5622 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5623 /* Line In jack is connected to Line1 pin */
5624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5625 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5626 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5627 /* Ensure all other unused pins are disabled and muted. */
5628 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5629 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5630 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5631 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5632 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5634 /* Disable digital (SPDIF) pins */
5635 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5636 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5638 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5639 * bus when acting as outputs.
5641 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5642 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5644 /* Start with output sum widgets muted and their output gains at min */
5645 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5646 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5647 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5648 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5649 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5650 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5651 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5652 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5653 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5655 /* Unmute Line-out pin widget amp left and right
5656 * (no equiv mixer ctrl)
5658 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5659 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5660 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5661 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5662 * inputs. If the pin mode is changed by the user the pin mode control
5663 * will take care of enabling the pin's input/output buffers as needed.
5664 * Therefore there's no need to enable the input buffer at this
5667 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5668 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5670 /* Mute capture amp left and right */
5671 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5672 /* Set ADC connection select to match default mixer setting - mic
5675 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5677 /* Do similar with the second ADC: mute capture input amp and
5678 * set ADC connection to mic to match ALSA's default state.
5680 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5681 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5683 /* Mute all inputs to mixer widget (even unconnected ones) */
5684 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5686 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5696 /* Initialisation sequence for Maxdata Favorit 100XS
5697 * (adapted from Acer init verbs).
5699 static struct hda_verb alc260_favorit100_init_verbs[] = {
5700 /* GPIO 0 enables the output jack.
5701 * Turn this on and rely on the standard mute
5702 * methods whenever the user wants to turn these outputs off.
5704 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5705 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5706 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5707 /* Line/Mic input jack is connected to Mic1 pin */
5708 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5709 /* Ensure all other unused pins are disabled and muted. */
5710 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5711 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5712 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5713 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5714 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5715 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5718 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5720 /* Disable digital (SPDIF) pins */
5721 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5722 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5724 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5725 * bus when acting as outputs.
5727 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5728 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5730 /* Start with output sum widgets muted and their output gains at min */
5731 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5734 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5735 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5736 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5737 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5738 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5739 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5741 /* Unmute Line-out pin widget amp left and right
5742 * (no equiv mixer ctrl)
5744 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5745 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5746 * inputs. If the pin mode is changed by the user the pin mode control
5747 * will take care of enabling the pin's input/output buffers as needed.
5748 * Therefore there's no need to enable the input buffer at this
5751 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5753 /* Mute capture amp left and right */
5754 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5755 /* Set ADC connection select to match default mixer setting - mic
5758 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5760 /* Do similar with the second ADC: mute capture input amp and
5761 * set ADC connection to mic to match ALSA's default state.
5763 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5764 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5766 /* Mute all inputs to mixer widget (even unconnected ones) */
5767 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5768 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5769 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5770 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5771 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5772 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5773 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5774 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5779 static struct hda_verb alc260_will_verbs[] = {
5780 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5781 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5782 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5783 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5784 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5785 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5789 static struct hda_verb alc260_replacer_672v_verbs[] = {
5790 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5791 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5792 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5794 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5795 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5796 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5798 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5802 /* toggle speaker-output according to the hp-jack state */
5803 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5805 unsigned int present;
5807 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5808 present = snd_hda_jack_detect(codec, 0x0f);
5810 snd_hda_codec_write_cache(codec, 0x01, 0,
5811 AC_VERB_SET_GPIO_DATA, 1);
5812 snd_hda_codec_write_cache(codec, 0x0f, 0,
5813 AC_VERB_SET_PIN_WIDGET_CONTROL,
5816 snd_hda_codec_write_cache(codec, 0x01, 0,
5817 AC_VERB_SET_GPIO_DATA, 0);
5818 snd_hda_codec_write_cache(codec, 0x0f, 0,
5819 AC_VERB_SET_PIN_WIDGET_CONTROL,
5824 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5827 if ((res >> 26) == ALC880_HP_EVENT)
5828 alc260_replacer_672v_automute(codec);
5831 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5832 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5833 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5834 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5835 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5836 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5838 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5839 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5840 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5841 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5845 /* Test configuration for debugging, modelled after the ALC880 test
5848 #ifdef CONFIG_SND_DEBUG
5849 static hda_nid_t alc260_test_dac_nids[1] = {
5852 static hda_nid_t alc260_test_adc_nids[2] = {
5855 /* For testing the ALC260, each input MUX needs its own definition since
5856 * the signal assignments are different. This assumes that the first ADC
5859 static struct hda_input_mux alc260_test_capture_sources[2] = {
5863 { "MIC1 pin", 0x0 },
5864 { "MIC2 pin", 0x1 },
5865 { "LINE1 pin", 0x2 },
5866 { "LINE2 pin", 0x3 },
5868 { "LINE-OUT pin", 0x5 },
5869 { "HP-OUT pin", 0x6 },
5875 { "MIC1 pin", 0x0 },
5876 { "MIC2 pin", 0x1 },
5877 { "LINE1 pin", 0x2 },
5878 { "LINE2 pin", 0x3 },
5881 { "LINE-OUT pin", 0x6 },
5882 { "HP-OUT pin", 0x7 },
5886 static struct snd_kcontrol_new alc260_test_mixer[] = {
5887 /* Output driver widgets */
5888 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5889 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5890 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5891 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5892 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5893 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5895 /* Modes for retasking pin widgets
5896 * Note: the ALC260 doesn't seem to act on requests to enable mic
5897 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5898 * mention this restriction. At this stage it's not clear whether
5899 * this behaviour is intentional or is a hardware bug in chip
5900 * revisions available at least up until early 2006. Therefore for
5901 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5902 * choices, but if it turns out that the lack of mic bias for these
5903 * NIDs is intentional we could change their modes from
5904 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5906 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5907 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5908 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5909 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5910 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5911 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5913 /* Loopback mixer controls */
5914 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5915 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5916 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5917 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5918 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5919 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5920 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5921 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5922 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5923 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5924 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5925 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5926 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5927 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5929 /* Controls for GPIO pins, assuming they are configured as outputs */
5930 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5931 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5932 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5933 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5935 /* Switches to allow the digital IO pins to be enabled. The datasheet
5936 * is ambigious as to which NID is which; testing on laptops which
5937 * make this output available should provide clarification.
5939 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5940 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5942 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5943 * this output to turn on an external amplifier.
5945 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5946 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5950 static struct hda_verb alc260_test_init_verbs[] = {
5951 /* Enable all GPIOs as outputs with an initial value of 0 */
5952 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5953 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5954 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5956 /* Enable retasking pins as output, initially without power amp */
5957 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5958 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5959 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5960 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5961 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5962 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5964 /* Disable digital (SPDIF) pins initially, but users can enable
5965 * them via a mixer switch. In the case of SPDIF-out, this initverb
5966 * payload also sets the generation to 0, output to be in "consumer"
5967 * PCM format, copyright asserted, no pre-emphasis and no validity
5970 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5971 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5973 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5974 * OUT1 sum bus when acting as an output.
5976 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5977 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5978 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5979 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5981 /* Start with output sum widgets muted and their output gains at min */
5982 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5985 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5988 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5989 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5990 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5992 /* Unmute retasking pin widget output buffers since the default
5993 * state appears to be output. As the pin mode is changed by the
5994 * user the pin mode control will take care of enabling the pin's
5995 * input/output buffers as needed.
5997 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5998 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6000 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6001 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6002 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6003 /* Also unmute the mono-out pin widget */
6004 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6006 /* Mute capture amp left and right */
6007 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6008 /* Set ADC connection select to match default mixer setting (mic1
6011 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6013 /* Do the same for the second ADC: mute capture input amp and
6014 * set ADC connection to mic1 pin
6016 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6017 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6019 /* Mute all inputs to mixer widget (even unconnected ones) */
6020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6021 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6022 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6033 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6034 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6036 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6037 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6040 * for BIOS auto-configuration
6043 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6044 const char *pfx, int *vol_bits)
6047 unsigned long vol_val, sw_val;
6050 if (nid >= 0x0f && nid < 0x11) {
6051 nid_vol = nid - 0x7;
6052 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6053 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6054 } else if (nid == 0x11) {
6055 nid_vol = nid - 0x7;
6056 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6057 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6058 } else if (nid >= 0x12 && nid <= 0x15) {
6060 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6061 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6065 if (!(*vol_bits & (1 << nid_vol))) {
6066 /* first control for the volume widget */
6067 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6070 *vol_bits |= (1 << nid_vol);
6072 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6078 /* add playback controls from the parsed DAC table */
6079 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6080 const struct auto_pin_cfg *cfg)
6086 spec->multiout.num_dacs = 1;
6087 spec->multiout.dac_nids = spec->private_dac_nids;
6088 spec->multiout.dac_nids[0] = 0x02;
6090 nid = cfg->line_out_pins[0];
6093 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6095 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6099 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6104 nid = cfg->speaker_pins[0];
6106 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6111 nid = cfg->hp_pins[0];
6113 err = alc260_add_playback_controls(spec, nid, "Headphone",
6121 /* create playback/capture controls for input pins */
6122 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6123 const struct auto_pin_cfg *cfg)
6125 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6128 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6129 hda_nid_t nid, int pin_type,
6132 alc_set_pin_output(codec, nid, pin_type);
6133 /* need the manual connection? */
6135 int idx = nid - 0x12;
6136 snd_hda_codec_write(codec, idx + 0x0b, 0,
6137 AC_VERB_SET_CONNECT_SEL, sel_idx);
6141 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6143 struct alc_spec *spec = codec->spec;
6146 nid = spec->autocfg.line_out_pins[0];
6148 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6149 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6152 nid = spec->autocfg.speaker_pins[0];
6154 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6156 nid = spec->autocfg.hp_pins[0];
6158 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6161 #define ALC260_PIN_CD_NID 0x16
6162 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6164 struct alc_spec *spec = codec->spec;
6167 for (i = 0; i < AUTO_PIN_LAST; i++) {
6168 hda_nid_t nid = spec->autocfg.input_pins[i];
6170 alc_set_input_pin(codec, nid, i);
6171 if (nid != ALC260_PIN_CD_NID &&
6172 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6173 snd_hda_codec_write(codec, nid, 0,
6174 AC_VERB_SET_AMP_GAIN_MUTE,
6181 * generic initialization of ADC, input mixers and output mixers
6183 static struct hda_verb alc260_volume_init_verbs[] = {
6185 * Unmute ADC0-1 and set the default input to mic-in
6187 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6188 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6189 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6190 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6192 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6194 * Note: PASD motherboards uses the Line In 2 as the input for
6195 * front panel mic (mic 2)
6197 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6198 /* mute analog inputs */
6199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6201 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6202 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6203 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6206 * Set up output mixers (0x08 - 0x0a)
6208 /* set vol=0 to output mixers */
6209 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6210 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6211 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6212 /* set up input amps for analog loopback */
6213 /* Amp Indices: DAC = 0, mixer = 1 */
6214 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6216 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6217 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6218 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6219 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6224 static int alc260_parse_auto_config(struct hda_codec *codec)
6226 struct alc_spec *spec = codec->spec;
6228 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6230 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6234 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6237 if (!spec->kctls.list)
6238 return 0; /* can't find valid BIOS pin config */
6239 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6243 spec->multiout.max_channels = 2;
6245 if (spec->autocfg.dig_outs)
6246 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6247 if (spec->kctls.list)
6248 add_mixer(spec, spec->kctls.list);
6250 add_verb(spec, alc260_volume_init_verbs);
6252 spec->num_mux_defs = 1;
6253 spec->input_mux = &spec->private_imux[0];
6255 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6260 /* additional initialization for auto-configuration model */
6261 static void alc260_auto_init(struct hda_codec *codec)
6263 struct alc_spec *spec = codec->spec;
6264 alc260_auto_init_multi_out(codec);
6265 alc260_auto_init_analog_input(codec);
6266 if (spec->unsol_event)
6267 alc_inithook(codec);
6270 #ifdef CONFIG_SND_HDA_POWER_SAVE
6271 static struct hda_amp_list alc260_loopbacks[] = {
6272 { 0x07, HDA_INPUT, 0 },
6273 { 0x07, HDA_INPUT, 1 },
6274 { 0x07, HDA_INPUT, 2 },
6275 { 0x07, HDA_INPUT, 3 },
6276 { 0x07, HDA_INPUT, 4 },
6282 * ALC260 configurations
6284 static const char *alc260_models[ALC260_MODEL_LAST] = {
6285 [ALC260_BASIC] = "basic",
6287 [ALC260_HP_3013] = "hp-3013",
6288 [ALC260_HP_DC7600] = "hp-dc7600",
6289 [ALC260_FUJITSU_S702X] = "fujitsu",
6290 [ALC260_ACER] = "acer",
6291 [ALC260_WILL] = "will",
6292 [ALC260_REPLACER_672V] = "replacer",
6293 [ALC260_FAVORIT100] = "favorit100",
6294 #ifdef CONFIG_SND_DEBUG
6295 [ALC260_TEST] = "test",
6297 [ALC260_AUTO] = "auto",
6300 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6301 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6302 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6303 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6304 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6305 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6306 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6307 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6308 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6309 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6310 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6311 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6312 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6313 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6314 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6315 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6316 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6317 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6318 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6319 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6320 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6324 static struct alc_config_preset alc260_presets[] = {
6326 .mixers = { alc260_base_output_mixer,
6327 alc260_input_mixer },
6328 .init_verbs = { alc260_init_verbs },
6329 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6330 .dac_nids = alc260_dac_nids,
6331 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6332 .adc_nids = alc260_adc_nids,
6333 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6334 .channel_mode = alc260_modes,
6335 .input_mux = &alc260_capture_source,
6338 .mixers = { alc260_hp_output_mixer,
6339 alc260_input_mixer },
6340 .init_verbs = { alc260_init_verbs,
6341 alc260_hp_unsol_verbs },
6342 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6343 .dac_nids = alc260_dac_nids,
6344 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6345 .adc_nids = alc260_adc_nids_alt,
6346 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6347 .channel_mode = alc260_modes,
6348 .input_mux = &alc260_capture_source,
6349 .unsol_event = alc260_hp_unsol_event,
6350 .init_hook = alc260_hp_automute,
6352 [ALC260_HP_DC7600] = {
6353 .mixers = { alc260_hp_dc7600_mixer,
6354 alc260_input_mixer },
6355 .init_verbs = { alc260_init_verbs,
6356 alc260_hp_dc7600_verbs },
6357 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6358 .dac_nids = alc260_dac_nids,
6359 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6360 .adc_nids = alc260_adc_nids_alt,
6361 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6362 .channel_mode = alc260_modes,
6363 .input_mux = &alc260_capture_source,
6364 .unsol_event = alc260_hp_3012_unsol_event,
6365 .init_hook = alc260_hp_3012_automute,
6367 [ALC260_HP_3013] = {
6368 .mixers = { alc260_hp_3013_mixer,
6369 alc260_input_mixer },
6370 .init_verbs = { alc260_hp_3013_init_verbs,
6371 alc260_hp_3013_unsol_verbs },
6372 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6373 .dac_nids = alc260_dac_nids,
6374 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6375 .adc_nids = alc260_adc_nids_alt,
6376 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6377 .channel_mode = alc260_modes,
6378 .input_mux = &alc260_capture_source,
6379 .unsol_event = alc260_hp_3013_unsol_event,
6380 .init_hook = alc260_hp_3013_automute,
6382 [ALC260_FUJITSU_S702X] = {
6383 .mixers = { alc260_fujitsu_mixer },
6384 .init_verbs = { alc260_fujitsu_init_verbs },
6385 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6386 .dac_nids = alc260_dac_nids,
6387 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6388 .adc_nids = alc260_dual_adc_nids,
6389 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6390 .channel_mode = alc260_modes,
6391 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6392 .input_mux = alc260_fujitsu_capture_sources,
6395 .mixers = { alc260_acer_mixer },
6396 .init_verbs = { alc260_acer_init_verbs },
6397 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6398 .dac_nids = alc260_dac_nids,
6399 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6400 .adc_nids = alc260_dual_adc_nids,
6401 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6402 .channel_mode = alc260_modes,
6403 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6404 .input_mux = alc260_acer_capture_sources,
6406 [ALC260_FAVORIT100] = {
6407 .mixers = { alc260_favorit100_mixer },
6408 .init_verbs = { alc260_favorit100_init_verbs },
6409 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6410 .dac_nids = alc260_dac_nids,
6411 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6412 .adc_nids = alc260_dual_adc_nids,
6413 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6414 .channel_mode = alc260_modes,
6415 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6416 .input_mux = alc260_favorit100_capture_sources,
6419 .mixers = { alc260_will_mixer },
6420 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6421 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6422 .dac_nids = alc260_dac_nids,
6423 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6424 .adc_nids = alc260_adc_nids,
6425 .dig_out_nid = ALC260_DIGOUT_NID,
6426 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6427 .channel_mode = alc260_modes,
6428 .input_mux = &alc260_capture_source,
6430 [ALC260_REPLACER_672V] = {
6431 .mixers = { alc260_replacer_672v_mixer },
6432 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6433 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6434 .dac_nids = alc260_dac_nids,
6435 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6436 .adc_nids = alc260_adc_nids,
6437 .dig_out_nid = ALC260_DIGOUT_NID,
6438 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6439 .channel_mode = alc260_modes,
6440 .input_mux = &alc260_capture_source,
6441 .unsol_event = alc260_replacer_672v_unsol_event,
6442 .init_hook = alc260_replacer_672v_automute,
6444 #ifdef CONFIG_SND_DEBUG
6446 .mixers = { alc260_test_mixer },
6447 .init_verbs = { alc260_test_init_verbs },
6448 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6449 .dac_nids = alc260_test_dac_nids,
6450 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6451 .adc_nids = alc260_test_adc_nids,
6452 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6453 .channel_mode = alc260_modes,
6454 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6455 .input_mux = alc260_test_capture_sources,
6460 static int patch_alc260(struct hda_codec *codec)
6462 struct alc_spec *spec;
6463 int err, board_config;
6465 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6471 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6474 if (board_config < 0) {
6475 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6477 board_config = ALC260_AUTO;
6480 if (board_config == ALC260_AUTO) {
6481 /* automatic parse from the BIOS config */
6482 err = alc260_parse_auto_config(codec);
6488 "hda_codec: Cannot set up configuration "
6489 "from BIOS. Using base mode...\n");
6490 board_config = ALC260_BASIC;
6494 err = snd_hda_attach_beep_device(codec, 0x1);
6500 if (board_config != ALC260_AUTO)
6501 setup_preset(codec, &alc260_presets[board_config]);
6503 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6504 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6506 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6507 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6509 if (!spec->adc_nids && spec->input_mux) {
6510 /* check whether NID 0x04 is valid */
6511 unsigned int wcap = get_wcaps(codec, 0x04);
6512 wcap = get_wcaps_type(wcap);
6514 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6515 spec->adc_nids = alc260_adc_nids_alt;
6516 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6518 spec->adc_nids = alc260_adc_nids;
6519 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6522 set_capture_mixer(codec);
6523 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6525 spec->vmaster_nid = 0x08;
6527 codec->patch_ops = alc_patch_ops;
6528 if (board_config == ALC260_AUTO)
6529 spec->init_hook = alc260_auto_init;
6530 #ifdef CONFIG_SND_HDA_POWER_SAVE
6531 if (!spec->loopback.amplist)
6532 spec->loopback.amplist = alc260_loopbacks;
6534 codec->proc_widget_hook = print_realtek_coef;
6541 * ALC882/883/885/888/889 support
6543 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6544 * configuration. Each pin widget can choose any input DACs and a mixer.
6545 * Each ADC is connected from a mixer of all inputs. This makes possible
6546 * 6-channel independent captures.
6548 * In addition, an independent DAC for the multi-playback (not used in this
6551 #define ALC882_DIGOUT_NID 0x06
6552 #define ALC882_DIGIN_NID 0x0a
6553 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6554 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6555 #define ALC1200_DIGOUT_NID 0x10
6558 static struct hda_channel_mode alc882_ch_modes[1] = {
6563 static hda_nid_t alc882_dac_nids[4] = {
6564 /* front, rear, clfe, rear_surr */
6565 0x02, 0x03, 0x04, 0x05
6567 #define alc883_dac_nids alc882_dac_nids
6570 #define alc882_adc_nids alc880_adc_nids
6571 #define alc882_adc_nids_alt alc880_adc_nids_alt
6572 #define alc883_adc_nids alc882_adc_nids_alt
6573 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6574 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6575 #define alc889_adc_nids alc880_adc_nids
6577 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6578 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6579 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6580 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6581 #define alc889_capsrc_nids alc882_capsrc_nids
6584 /* FIXME: should be a matrix-type input source selection */
6586 static struct hda_input_mux alc882_capture_source = {
6590 { "Front Mic", 0x1 },
6596 #define alc883_capture_source alc882_capture_source
6598 static struct hda_input_mux alc889_capture_source = {
6601 { "Front Mic", 0x0 },
6607 static struct hda_input_mux mb5_capture_source = {
6616 static struct hda_input_mux alc883_3stack_6ch_intel = {
6620 { "Front Mic", 0x0 },
6626 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6634 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6644 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6652 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6656 { "Front Mic", 0x1 },
6661 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6669 static struct hda_input_mux alc889A_mb31_capture_source = {
6673 /* Front Mic (0x01) unused */
6675 /* Line 2 (0x03) unused */
6676 /* CD (0x04) unused? */
6683 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6690 static struct hda_verb alc882_3ST_ch2_init[] = {
6691 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6692 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6693 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6694 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6701 static struct hda_verb alc882_3ST_ch4_init[] = {
6702 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6703 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6704 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6705 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6706 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6713 static struct hda_verb alc882_3ST_ch6_init[] = {
6714 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6715 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6716 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6717 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6718 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6719 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6723 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6724 { 2, alc882_3ST_ch2_init },
6725 { 4, alc882_3ST_ch4_init },
6726 { 6, alc882_3ST_ch6_init },
6729 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6734 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6735 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6736 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6737 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6738 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6739 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6746 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6747 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6748 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6749 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6750 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6751 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6752 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6759 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6760 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6761 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6762 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6763 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6764 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6765 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6766 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6770 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6771 { 2, alc883_3ST_ch2_clevo_init },
6772 { 4, alc883_3ST_ch4_clevo_init },
6773 { 6, alc883_3ST_ch6_clevo_init },
6780 static struct hda_verb alc882_sixstack_ch6_init[] = {
6781 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6782 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6783 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6784 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6791 static struct hda_verb alc882_sixstack_ch8_init[] = {
6792 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6793 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6794 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6795 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6799 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6800 { 6, alc882_sixstack_ch6_init },
6801 { 8, alc882_sixstack_ch8_init },
6805 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6811 static struct hda_verb alc885_mbp_ch2_init[] = {
6812 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6813 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6814 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6821 static struct hda_verb alc885_mbp_ch4_init[] = {
6822 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6823 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6824 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6825 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6826 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6830 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6831 { 2, alc885_mbp_ch2_init },
6832 { 4, alc885_mbp_ch4_init },
6837 * Speakers/Woofer/HP = Front
6840 static struct hda_verb alc885_mb5_ch2_init[] = {
6841 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6842 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6848 * Speakers/HP = Front
6852 static struct hda_verb alc885_mb5_ch6_init[] = {
6853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6859 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6860 { 2, alc885_mb5_ch2_init },
6861 { 6, alc885_mb5_ch6_init },
6868 static struct hda_verb alc883_4ST_ch2_init[] = {
6869 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6870 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6871 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6872 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6873 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6874 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6881 static struct hda_verb alc883_4ST_ch4_init[] = {
6882 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6883 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6884 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6885 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6886 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6887 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6888 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6895 static struct hda_verb alc883_4ST_ch6_init[] = {
6896 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6897 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6898 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6899 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6900 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6901 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6902 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6903 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6910 static struct hda_verb alc883_4ST_ch8_init[] = {
6911 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6912 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6913 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6914 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6915 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6916 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6917 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6918 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6919 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6923 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6924 { 2, alc883_4ST_ch2_init },
6925 { 4, alc883_4ST_ch4_init },
6926 { 6, alc883_4ST_ch6_init },
6927 { 8, alc883_4ST_ch8_init },
6934 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6935 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6936 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6937 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6938 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6945 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6946 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6947 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6948 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6949 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6950 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6957 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6958 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6959 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6960 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6961 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6962 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6963 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6967 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6968 { 2, alc883_3ST_ch2_intel_init },
6969 { 4, alc883_3ST_ch4_intel_init },
6970 { 6, alc883_3ST_ch6_intel_init },
6976 static struct hda_verb alc889_ch2_intel_init[] = {
6977 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6978 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6979 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6980 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6981 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6982 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6989 static struct hda_verb alc889_ch6_intel_init[] = {
6990 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6991 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6992 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6993 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6994 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6995 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7002 static struct hda_verb alc889_ch8_intel_init[] = {
7003 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7004 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7005 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7006 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7007 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7008 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7009 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7013 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7014 { 2, alc889_ch2_intel_init },
7015 { 6, alc889_ch6_intel_init },
7016 { 8, alc889_ch8_intel_init },
7022 static struct hda_verb alc883_sixstack_ch6_init[] = {
7023 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7024 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7025 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7026 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7033 static struct hda_verb alc883_sixstack_ch8_init[] = {
7034 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7035 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7036 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7037 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7041 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7042 { 6, alc883_sixstack_ch6_init },
7043 { 8, alc883_sixstack_ch8_init },
7047 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7048 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7050 static struct snd_kcontrol_new alc882_base_mixer[] = {
7051 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7052 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7053 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7054 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7055 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7056 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7057 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7058 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7059 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7060 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7061 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7062 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7063 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7064 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7065 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7069 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7071 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7075 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7076 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7077 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7078 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7079 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7080 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7081 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7082 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7084 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7085 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7090 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7091 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7092 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7093 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7094 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7095 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7096 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7098 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7100 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7102 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7104 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7108 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7109 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7110 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7111 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7112 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7113 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7114 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7116 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7122 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7124 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7130 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7135 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7136 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7137 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7139 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7140 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7141 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7142 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7146 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7152 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7153 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7155 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7156 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7157 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7158 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7159 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7160 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7161 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7165 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7172 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7173 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7174 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7177 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7181 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7186 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7188 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7189 .name = "Channel Mode",
7190 .info = alc_ch_mode_info,
7191 .get = alc_ch_mode_get,
7192 .put = alc_ch_mode_put,
7197 static struct hda_verb alc882_base_init_verbs[] = {
7198 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7203 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7204 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7205 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7207 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7208 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7209 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7211 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7212 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7213 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7215 /* mute analog input loopbacks */
7216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7218 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7219 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7220 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7222 /* Front Pin: output 0 (0x0c) */
7223 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7224 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7225 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7226 /* Rear Pin: output 1 (0x0d) */
7227 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7228 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7229 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7230 /* CLFE Pin: output 2 (0x0e) */
7231 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7232 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7233 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7234 /* Side Pin: output 3 (0x0f) */
7235 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7236 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7237 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7238 /* Mic (rear) pin: input vref at 80% */
7239 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7240 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7241 /* Front Mic pin: input vref at 80% */
7242 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7243 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7244 /* Line In pin: input */
7245 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7246 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7247 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7248 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7249 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7250 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7251 /* CD pin widget for input */
7252 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7254 /* FIXME: use matrix-type input source selection */
7255 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7257 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7258 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7266 /* ADC2: mute amp left and right */
7267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7268 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7269 /* ADC3: mute amp left and right */
7270 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7271 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7276 static struct hda_verb alc882_adc1_init_verbs[] = {
7277 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7282 /* ADC1: mute amp left and right */
7283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7284 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7288 static struct hda_verb alc882_eapd_verbs[] = {
7289 /* change to EAPD mode */
7290 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7291 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7295 static struct hda_verb alc889_eapd_verbs[] = {
7296 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7297 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7301 static struct hda_verb alc_hp15_unsol_verbs[] = {
7302 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7303 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7307 static struct hda_verb alc885_init_verbs[] = {
7308 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7313 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7314 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7317 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7321 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7322 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7323 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7325 /* mute analog input loopbacks */
7326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7330 /* Front HP Pin: output 0 (0x0c) */
7331 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7333 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7334 /* Front Pin: output 0 (0x0c) */
7335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7336 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7337 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7338 /* Rear Pin: output 1 (0x0d) */
7339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7341 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7342 /* CLFE Pin: output 2 (0x0e) */
7343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7344 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7345 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7346 /* Side Pin: output 3 (0x0f) */
7347 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7348 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7349 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7350 /* Mic (rear) pin: input vref at 80% */
7351 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7352 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7353 /* Front Mic pin: input vref at 80% */
7354 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7356 /* Line In pin: input */
7357 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7360 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7373 /* ADC2: mute amp left and right */
7374 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7375 /* ADC3: mute amp left and right */
7376 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7381 static struct hda_verb alc885_init_input_verbs[] = {
7382 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7389 /* Unmute Selector 24h and set the default input to front mic */
7390 static struct hda_verb alc889_init_input_verbs[] = {
7391 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7397 #define alc883_init_verbs alc882_base_init_verbs
7400 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7401 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7402 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7404 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7405 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7406 /* FIXME: this looks suspicious...
7407 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7408 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7413 static struct hda_verb alc882_macpro_init_verbs[] = {
7414 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7418 /* Front Pin: output 0 (0x0c) */
7419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7421 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7422 /* Front Mic pin: input vref at 80% */
7423 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7424 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7425 /* Speaker: output */
7426 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7427 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7428 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7429 /* Headphone output (output 0 - 0x0c) */
7430 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7432 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7434 /* FIXME: use matrix-type input source selection */
7435 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7436 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7443 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7444 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7445 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7447 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7448 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7449 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7450 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7451 /* ADC1: mute amp left and right */
7452 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7453 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7454 /* ADC2: mute amp left and right */
7455 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7456 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7457 /* ADC3: mute amp left and right */
7458 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7459 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7465 static struct hda_verb alc885_mb5_init_verbs[] = {
7467 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7468 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7469 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7470 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7475 /* Surround mixer */
7476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7477 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7480 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7485 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7486 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7487 /* Front Pin (0x0c) */
7488 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7489 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7490 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7491 /* LFE Pin (0x0e) */
7492 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7493 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7494 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7499 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7500 /* Front Mic pin: input vref at 80% */
7501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7504 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7507 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7508 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7509 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7510 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7514 /* Macbook Pro rev3 */
7515 static struct hda_verb alc885_mbp3_init_verbs[] = {
7516 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7522 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7523 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7525 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7526 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7527 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7528 /* Front Pin: output 0 (0x0c) */
7529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7530 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7531 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7532 /* HP Pin: output 0 (0x0e) */
7533 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7534 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7535 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7536 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7537 /* Mic (rear) pin: input vref at 80% */
7538 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7539 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7540 /* Front Mic pin: input vref at 80% */
7541 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7542 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7543 /* Line In pin: use output 1 when in LineOut mode */
7544 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7545 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7546 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7548 /* FIXME: use matrix-type input source selection */
7549 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7550 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7556 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7558 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7559 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7561 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7562 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7563 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7564 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7565 /* ADC1: mute amp left and right */
7566 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7567 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7568 /* ADC2: mute amp left and right */
7569 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7570 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7571 /* ADC3: mute amp left and right */
7572 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7573 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7579 static struct hda_verb alc885_imac91_init_verbs[] = {
7580 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7588 /* HP Pin: output 0 (0x0c) */
7589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7590 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7591 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7592 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7593 /* Internal Speakers: output 0 (0x0d) */
7594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7595 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7596 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7597 /* Mic (rear) pin: input vref at 80% */
7598 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7599 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7600 /* Front Mic pin: input vref at 80% */
7601 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7602 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7603 /* Line In pin: use output 1 when in LineOut mode */
7604 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7605 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7606 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7608 /* FIXME: use matrix-type input source selection */
7609 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7610 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7619 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7625 /* ADC1: mute amp left and right */
7626 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7627 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7628 /* ADC2: mute amp left and right */
7629 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7630 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7631 /* ADC3: mute amp left and right */
7632 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7633 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7638 /* iMac 24 mixer. */
7639 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7640 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7641 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7645 /* iMac 24 init verbs. */
7646 static struct hda_verb alc885_imac24_init_verbs[] = {
7647 /* Internal speakers: output 0 (0x0c) */
7648 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7649 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7650 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7651 /* Internal speakers: output 0 (0x0c) */
7652 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7653 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7654 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7655 /* Headphone: output 0 (0x0c) */
7656 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7658 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7659 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7660 /* Front Mic: input vref at 80% */
7661 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7662 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7666 /* Toggle speaker-output according to the hp-jack state */
7667 static void alc885_imac24_setup(struct hda_codec *codec)
7669 struct alc_spec *spec = codec->spec;
7671 spec->autocfg.hp_pins[0] = 0x14;
7672 spec->autocfg.speaker_pins[0] = 0x18;
7673 spec->autocfg.speaker_pins[1] = 0x1a;
7676 static void alc885_mbp3_setup(struct hda_codec *codec)
7678 struct alc_spec *spec = codec->spec;
7680 spec->autocfg.hp_pins[0] = 0x15;
7681 spec->autocfg.speaker_pins[0] = 0x14;
7684 static void alc885_mb5_automute(struct hda_codec *codec)
7686 unsigned int present;
7688 present = snd_hda_codec_read(codec, 0x14, 0,
7689 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7690 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7691 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7692 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7693 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7697 static void alc885_mb5_unsol_event(struct hda_codec *codec,
7700 /* Headphone insertion or removal. */
7701 if ((res >> 26) == ALC880_HP_EVENT)
7702 alc885_mb5_automute(codec);
7705 static void alc885_imac91_automute(struct hda_codec *codec)
7707 unsigned int present;
7709 present = snd_hda_codec_read(codec, 0x14, 0,
7710 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7711 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7712 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7713 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7714 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7718 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7721 /* Headphone insertion or removal. */
7722 if ((res >> 26) == ALC880_HP_EVENT)
7723 alc885_imac91_automute(codec);
7726 static struct hda_verb alc882_targa_verbs[] = {
7727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7731 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7733 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7734 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7735 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7737 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7741 /* toggle speaker-output according to the hp-jack state */
7742 static void alc882_targa_automute(struct hda_codec *codec)
7744 struct alc_spec *spec = codec->spec;
7745 alc_automute_amp(codec);
7746 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7747 spec->jack_present ? 1 : 3);
7750 static void alc882_targa_setup(struct hda_codec *codec)
7752 struct alc_spec *spec = codec->spec;
7754 spec->autocfg.hp_pins[0] = 0x14;
7755 spec->autocfg.speaker_pins[0] = 0x1b;
7758 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7760 if ((res >> 26) == ALC880_HP_EVENT)
7761 alc882_targa_automute(codec);
7764 static struct hda_verb alc882_asus_a7j_verbs[] = {
7765 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7766 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7768 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7769 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7770 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7772 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7773 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7774 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7776 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7777 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7778 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7782 static struct hda_verb alc882_asus_a7m_verbs[] = {
7783 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7784 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7787 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7788 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7790 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7791 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7792 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7794 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7795 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7796 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7800 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7802 unsigned int gpiostate, gpiomask, gpiodir;
7804 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7805 AC_VERB_GET_GPIO_DATA, 0);
7808 gpiostate |= (1 << pin);
7810 gpiostate &= ~(1 << pin);
7812 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7813 AC_VERB_GET_GPIO_MASK, 0);
7814 gpiomask |= (1 << pin);
7816 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7817 AC_VERB_GET_GPIO_DIRECTION, 0);
7818 gpiodir |= (1 << pin);
7821 snd_hda_codec_write(codec, codec->afg, 0,
7822 AC_VERB_SET_GPIO_MASK, gpiomask);
7823 snd_hda_codec_write(codec, codec->afg, 0,
7824 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7828 snd_hda_codec_write(codec, codec->afg, 0,
7829 AC_VERB_SET_GPIO_DATA, gpiostate);
7832 /* set up GPIO at initialization */
7833 static void alc885_macpro_init_hook(struct hda_codec *codec)
7835 alc882_gpio_mute(codec, 0, 0);
7836 alc882_gpio_mute(codec, 1, 0);
7839 /* set up GPIO and update auto-muting at initialization */
7840 static void alc885_imac24_init_hook(struct hda_codec *codec)
7842 alc885_macpro_init_hook(codec);
7843 alc_automute_amp(codec);
7847 * generic initialization of ADC, input mixers and output mixers
7849 static struct hda_verb alc883_auto_init_verbs[] = {
7851 * Unmute ADC0-2 and set the default input to mic-in
7853 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7854 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7855 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7858 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7860 * Note: PASD motherboards uses the Line In 2 as the input for
7861 * front panel mic (mic 2)
7863 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7864 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7865 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7866 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7867 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7868 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7871 * Set up output mixers (0x0c - 0x0f)
7873 /* set vol=0 to output mixers */
7874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7875 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7876 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7877 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7878 /* set up input amps for analog loopback */
7879 /* Amp Indices: DAC = 0, mixer = 1 */
7880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7882 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7884 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7885 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7886 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7888 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7889 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7891 /* FIXME: use matrix-type input source selection */
7892 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7894 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7895 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7896 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7897 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7899 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7900 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7907 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7908 static struct hda_verb alc889A_mb31_ch2_init[] = {
7909 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7910 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7911 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7916 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7917 static struct hda_verb alc889A_mb31_ch4_init[] = {
7918 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7919 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7920 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7921 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7925 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7926 static struct hda_verb alc889A_mb31_ch5_init[] = {
7927 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7928 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7929 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7934 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7935 static struct hda_verb alc889A_mb31_ch6_init[] = {
7936 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7937 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7938 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7939 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7943 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7944 { 2, alc889A_mb31_ch2_init },
7945 { 4, alc889A_mb31_ch4_init },
7946 { 5, alc889A_mb31_ch5_init },
7947 { 6, alc889A_mb31_ch6_init },
7950 static struct hda_verb alc883_medion_eapd_verbs[] = {
7951 /* eanable EAPD on medion laptop */
7952 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7953 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7957 #define alc883_base_mixer alc882_base_mixer
7959 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7960 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7962 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7963 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7964 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7965 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7966 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7968 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7969 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7970 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7971 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7972 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7976 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7977 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7978 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7980 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7984 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7986 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7990 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7991 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7992 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7994 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7996 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7998 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7999 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8000 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8004 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8005 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8006 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8010 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8011 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8013 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8021 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8022 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8023 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8025 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8026 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8027 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8028 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8029 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8031 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8032 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8033 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8034 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8036 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8037 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8039 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8040 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8044 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8045 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8046 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8047 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8048 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8049 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8051 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8052 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8053 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8054 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8055 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8056 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8057 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8058 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8061 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8062 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8063 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8064 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8068 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8069 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8070 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8071 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8072 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8073 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8075 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8076 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8077 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8079 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8080 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8081 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8082 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8084 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8086 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8087 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8092 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8093 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8094 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8095 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8096 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8097 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8098 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8099 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8100 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8101 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8102 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8103 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8104 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8105 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8106 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8107 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8109 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8110 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8115 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8116 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8117 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8119 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8120 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8121 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8122 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8123 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8124 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8125 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8126 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8127 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8128 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8129 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8130 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8131 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8136 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8137 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8138 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8139 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8140 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8144 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8146 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8147 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8148 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8152 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8153 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8154 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8155 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8156 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8157 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8161 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8162 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8163 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8164 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8165 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8173 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8174 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8175 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8176 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8177 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8178 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8179 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8180 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8181 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8182 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8186 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8188 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8189 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8190 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8191 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8195 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8199 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8200 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8201 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8203 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8204 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8206 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8207 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8211 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8212 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8213 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8214 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8215 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8218 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8219 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8221 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8226 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8229 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8230 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8231 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8232 0x0d, 1, 0x0, HDA_OUTPUT),
8233 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8234 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8235 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8236 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8237 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8238 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8239 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8240 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8241 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8243 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8245 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8247 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8251 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8253 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8254 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8255 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8256 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8257 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8259 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8260 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8261 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8262 /* Output switches */
8263 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8264 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8265 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8267 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8268 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8272 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8273 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8277 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8278 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8279 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8280 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8282 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8287 static struct hda_bind_ctls alc883_bind_cap_vol = {
8288 .ops = &snd_hda_bind_vol,
8290 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8291 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8296 static struct hda_bind_ctls alc883_bind_cap_switch = {
8297 .ops = &snd_hda_bind_sw,
8299 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8300 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8305 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8306 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8307 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8308 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8309 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8310 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8312 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8313 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8317 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8318 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8319 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8321 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8322 /* .name = "Capture Source", */
8323 .name = "Input Source",
8325 .info = alc_mux_enum_info,
8326 .get = alc_mux_enum_get,
8327 .put = alc_mux_enum_put,
8332 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8334 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8335 .name = "Channel Mode",
8336 .info = alc_ch_mode_info,
8337 .get = alc_ch_mode_get,
8338 .put = alc_ch_mode_put,
8343 /* toggle speaker-output according to the hp-jack state */
8344 static void alc883_mitac_setup(struct hda_codec *codec)
8346 struct alc_spec *spec = codec->spec;
8348 spec->autocfg.hp_pins[0] = 0x15;
8349 spec->autocfg.speaker_pins[0] = 0x14;
8350 spec->autocfg.speaker_pins[1] = 0x17;
8353 /* auto-toggle front mic */
8355 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8357 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8359 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8363 static struct hda_verb alc883_mitac_verbs[] = {
8365 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8368 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8369 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8371 /* enable unsolicited event */
8372 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8373 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8378 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8380 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8381 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8383 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8385 /* enable unsolicited event */
8387 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8388 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8394 static struct hda_verb alc883_clevo_m720_verbs[] = {
8396 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8399 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8400 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8402 /* enable unsolicited event */
8403 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8404 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8409 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8411 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8414 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8417 /* enable unsolicited event */
8418 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8423 static struct hda_verb alc883_targa_verbs[] = {
8424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8427 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8428 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8430 /* Connect Line-Out side jack (SPDIF) to Side */
8431 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8432 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8433 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8434 /* Connect Mic jack to CLFE */
8435 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8436 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8437 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8438 /* Connect Line-in jack to Surround */
8439 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8440 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8441 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8442 /* Connect HP out jack to Front */
8443 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8444 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8445 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8447 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8452 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8453 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8454 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8455 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8459 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8460 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8461 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8462 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8467 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8470 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8471 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8472 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8476 static struct hda_verb alc883_haier_w66_verbs[] = {
8477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8478 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8480 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8482 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8483 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8484 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8485 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8489 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8492 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8493 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8494 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8495 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8496 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8497 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8501 static struct hda_verb alc888_6st_dell_verbs[] = {
8502 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8506 static struct hda_verb alc883_vaiott_verbs[] = {
8508 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8509 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8511 /* enable unsolicited event */
8512 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8517 static void alc888_3st_hp_setup(struct hda_codec *codec)
8519 struct alc_spec *spec = codec->spec;
8521 spec->autocfg.hp_pins[0] = 0x1b;
8522 spec->autocfg.speaker_pins[0] = 0x14;
8523 spec->autocfg.speaker_pins[1] = 0x16;
8524 spec->autocfg.speaker_pins[2] = 0x18;
8527 static struct hda_verb alc888_3st_hp_verbs[] = {
8528 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8529 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8530 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8531 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8538 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8539 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8540 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8541 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8542 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8549 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8550 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8551 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8552 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8553 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8554 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8561 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8562 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8563 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8564 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8565 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8566 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8567 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8571 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8572 { 2, alc888_3st_hp_2ch_init },
8573 { 4, alc888_3st_hp_4ch_init },
8574 { 6, alc888_3st_hp_6ch_init },
8577 /* toggle front-jack and RCA according to the hp-jack state */
8578 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8580 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8582 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8583 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8584 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8585 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8588 /* toggle RCA according to the front-jack state */
8589 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8591 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8593 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8594 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8597 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8600 if ((res >> 26) == ALC880_HP_EVENT)
8601 alc888_lenovo_ms7195_front_automute(codec);
8602 if ((res >> 26) == ALC880_FRONT_EVENT)
8603 alc888_lenovo_ms7195_rca_automute(codec);
8606 static struct hda_verb alc883_medion_md2_verbs[] = {
8607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8608 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8610 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8612 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8616 /* toggle speaker-output according to the hp-jack state */
8617 static void alc883_medion_md2_setup(struct hda_codec *codec)
8619 struct alc_spec *spec = codec->spec;
8621 spec->autocfg.hp_pins[0] = 0x14;
8622 spec->autocfg.speaker_pins[0] = 0x15;
8625 /* toggle speaker-output according to the hp-jack state */
8626 #define alc883_targa_init_hook alc882_targa_init_hook
8627 #define alc883_targa_unsol_event alc882_targa_unsol_event
8629 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8631 unsigned int present;
8633 present = snd_hda_jack_detect(codec, 0x18);
8634 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8635 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8638 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8640 struct alc_spec *spec = codec->spec;
8642 spec->autocfg.hp_pins[0] = 0x15;
8643 spec->autocfg.speaker_pins[0] = 0x14;
8646 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8648 alc_automute_amp(codec);
8649 alc883_clevo_m720_mic_automute(codec);
8652 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8655 switch (res >> 26) {
8656 case ALC880_MIC_EVENT:
8657 alc883_clevo_m720_mic_automute(codec);
8660 alc_automute_amp_unsol_event(codec, res);
8665 /* toggle speaker-output according to the hp-jack state */
8666 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8668 struct alc_spec *spec = codec->spec;
8670 spec->autocfg.hp_pins[0] = 0x14;
8671 spec->autocfg.speaker_pins[0] = 0x15;
8674 static void alc883_haier_w66_setup(struct hda_codec *codec)
8676 struct alc_spec *spec = codec->spec;
8678 spec->autocfg.hp_pins[0] = 0x1b;
8679 spec->autocfg.speaker_pins[0] = 0x14;
8682 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8684 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8686 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8687 HDA_AMP_MUTE, bits);
8690 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8692 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8694 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8695 HDA_AMP_MUTE, bits);
8696 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8697 HDA_AMP_MUTE, bits);
8700 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8703 if ((res >> 26) == ALC880_HP_EVENT)
8704 alc883_lenovo_101e_all_automute(codec);
8705 if ((res >> 26) == ALC880_FRONT_EVENT)
8706 alc883_lenovo_101e_ispeaker_automute(codec);
8709 /* toggle speaker-output according to the hp-jack state */
8710 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8712 struct alc_spec *spec = codec->spec;
8714 spec->autocfg.hp_pins[0] = 0x14;
8715 spec->autocfg.speaker_pins[0] = 0x15;
8716 spec->autocfg.speaker_pins[1] = 0x16;
8719 static struct hda_verb alc883_acer_eapd_verbs[] = {
8720 /* HP Pin: output 0 (0x0c) */
8721 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8722 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8723 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8724 /* Front Pin: output 0 (0x0c) */
8725 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8726 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8727 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8728 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8729 /* eanable EAPD on medion laptop */
8730 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8731 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8732 /* enable unsolicited event */
8733 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8737 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8738 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8739 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8740 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8744 static void alc888_6st_dell_setup(struct hda_codec *codec)
8746 struct alc_spec *spec = codec->spec;
8748 spec->autocfg.hp_pins[0] = 0x1b;
8749 spec->autocfg.speaker_pins[0] = 0x14;
8750 spec->autocfg.speaker_pins[1] = 0x15;
8751 spec->autocfg.speaker_pins[2] = 0x16;
8752 spec->autocfg.speaker_pins[3] = 0x17;
8755 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8757 struct alc_spec *spec = codec->spec;
8759 spec->autocfg.hp_pins[0] = 0x1b;
8760 spec->autocfg.speaker_pins[0] = 0x14;
8761 spec->autocfg.speaker_pins[1] = 0x15;
8762 spec->autocfg.speaker_pins[2] = 0x16;
8763 spec->autocfg.speaker_pins[3] = 0x17;
8764 spec->autocfg.speaker_pins[4] = 0x1a;
8767 static void alc883_vaiott_setup(struct hda_codec *codec)
8769 struct alc_spec *spec = codec->spec;
8771 spec->autocfg.hp_pins[0] = 0x15;
8772 spec->autocfg.speaker_pins[0] = 0x14;
8773 spec->autocfg.speaker_pins[1] = 0x17;
8776 static struct hda_verb alc888_asus_m90v_verbs[] = {
8777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8778 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8779 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8780 /* enable unsolicited event */
8781 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8782 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8786 static void alc883_mode2_setup(struct hda_codec *codec)
8788 struct alc_spec *spec = codec->spec;
8790 spec->autocfg.hp_pins[0] = 0x1b;
8791 spec->autocfg.speaker_pins[0] = 0x14;
8792 spec->autocfg.speaker_pins[1] = 0x15;
8793 spec->autocfg.speaker_pins[2] = 0x16;
8794 spec->ext_mic.pin = 0x18;
8795 spec->int_mic.pin = 0x19;
8796 spec->ext_mic.mux_idx = 0;
8797 spec->int_mic.mux_idx = 1;
8801 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8803 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8804 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8805 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8806 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8807 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8808 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8809 /* enable unsolicited event */
8810 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8814 static void alc883_eee1601_inithook(struct hda_codec *codec)
8816 struct alc_spec *spec = codec->spec;
8818 spec->autocfg.hp_pins[0] = 0x14;
8819 spec->autocfg.speaker_pins[0] = 0x1b;
8820 alc_automute_pin(codec);
8823 static struct hda_verb alc889A_mb31_verbs[] = {
8824 /* Init rear pin (used as headphone output) */
8825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8826 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8827 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8828 /* Init line pin (used as output in 4ch and 6ch mode) */
8829 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8830 /* Init line 2 pin (used as headphone out by default) */
8831 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8832 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8836 /* Mute speakers according to the headphone jack state */
8837 static void alc889A_mb31_automute(struct hda_codec *codec)
8839 unsigned int present;
8841 /* Mute only in 2ch or 4ch mode */
8842 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8844 present = snd_hda_jack_detect(codec, 0x15);
8845 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8846 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8847 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8848 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8852 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8854 if ((res >> 26) == ALC880_HP_EVENT)
8855 alc889A_mb31_automute(codec);
8859 #ifdef CONFIG_SND_HDA_POWER_SAVE
8860 #define alc882_loopbacks alc880_loopbacks
8863 /* pcm configuration: identical with ALC880 */
8864 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8865 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8866 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8867 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8869 static hda_nid_t alc883_slave_dig_outs[] = {
8870 ALC1200_DIGOUT_NID, 0,
8873 static hda_nid_t alc1200_slave_dig_outs[] = {
8874 ALC883_DIGOUT_NID, 0,
8878 * configuration and preset
8880 static const char *alc882_models[ALC882_MODEL_LAST] = {
8881 [ALC882_3ST_DIG] = "3stack-dig",
8882 [ALC882_6ST_DIG] = "6stack-dig",
8883 [ALC882_ARIMA] = "arima",
8884 [ALC882_W2JC] = "w2jc",
8885 [ALC882_TARGA] = "targa",
8886 [ALC882_ASUS_A7J] = "asus-a7j",
8887 [ALC882_ASUS_A7M] = "asus-a7m",
8888 [ALC885_MACPRO] = "macpro",
8889 [ALC885_MB5] = "mb5",
8890 [ALC885_MBP3] = "mbp3",
8891 [ALC885_IMAC24] = "imac24",
8892 [ALC885_IMAC91] = "imac91",
8893 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8894 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8895 [ALC883_3ST_6ch] = "3stack-6ch",
8896 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8897 [ALC883_TARGA_DIG] = "targa-dig",
8898 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8899 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8900 [ALC883_ACER] = "acer",
8901 [ALC883_ACER_ASPIRE] = "acer-aspire",
8902 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8903 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8904 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8905 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8906 [ALC883_MEDION] = "medion",
8907 [ALC883_MEDION_MD2] = "medion-md2",
8908 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8909 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8910 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8911 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8912 [ALC888_LENOVO_SKY] = "lenovo-sky",
8913 [ALC883_HAIER_W66] = "haier-w66",
8914 [ALC888_3ST_HP] = "3stack-hp",
8915 [ALC888_6ST_DELL] = "6stack-dell",
8916 [ALC883_MITAC] = "mitac",
8917 [ALC883_CLEVO_M540R] = "clevo-m540r",
8918 [ALC883_CLEVO_M720] = "clevo-m720",
8919 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8920 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8921 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8922 [ALC889A_INTEL] = "intel-alc889a",
8923 [ALC889_INTEL] = "intel-x58",
8924 [ALC1200_ASUS_P5Q] = "asus-p5q",
8925 [ALC889A_MB31] = "mb31",
8926 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8927 [ALC882_AUTO] = "auto",
8930 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8931 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8933 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8934 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8935 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8936 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8937 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8938 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8939 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8940 ALC888_ACER_ASPIRE_4930G),
8941 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8942 ALC888_ACER_ASPIRE_4930G),
8943 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8944 ALC888_ACER_ASPIRE_8930G),
8945 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8946 ALC888_ACER_ASPIRE_8930G),
8947 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8948 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8949 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8950 ALC888_ACER_ASPIRE_6530G),
8951 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8952 ALC888_ACER_ASPIRE_6530G),
8953 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8954 ALC888_ACER_ASPIRE_7730G),
8955 /* default Acer -- disabled as it causes more problems.
8956 * model=auto should work fine now
8958 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8960 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8962 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8963 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8964 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8965 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8966 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8967 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8969 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8970 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8971 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8972 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8973 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8974 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8975 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8976 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8977 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8978 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8979 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8981 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8982 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8983 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8984 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8985 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8986 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8987 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8988 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8989 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8991 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8992 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8993 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8994 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8995 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8996 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8997 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8998 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8999 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9000 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9001 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9002 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9003 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9004 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9005 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9006 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9007 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9008 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9009 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9010 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9011 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9012 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9013 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9014 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9015 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9016 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9017 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9018 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9019 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9021 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9022 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9023 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9024 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9025 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9026 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9027 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9028 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9029 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9030 ALC883_FUJITSU_PI2515),
9031 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9032 ALC888_FUJITSU_XA3530),
9033 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9034 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9035 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9036 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9037 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9038 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9039 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9040 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9041 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9043 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9044 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9045 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9046 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9047 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9048 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9049 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9054 /* codec SSID table for Intel Mac */
9055 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9056 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9057 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9058 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9059 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9060 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9061 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9062 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9063 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9064 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9065 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9066 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9067 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9068 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9069 * so apparently no perfect solution yet
9071 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9072 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9076 static struct alc_config_preset alc882_presets[] = {
9077 [ALC882_3ST_DIG] = {
9078 .mixers = { alc882_base_mixer },
9079 .init_verbs = { alc882_base_init_verbs,
9080 alc882_adc1_init_verbs },
9081 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9082 .dac_nids = alc882_dac_nids,
9083 .dig_out_nid = ALC882_DIGOUT_NID,
9084 .dig_in_nid = ALC882_DIGIN_NID,
9085 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9086 .channel_mode = alc882_ch_modes,
9088 .input_mux = &alc882_capture_source,
9090 [ALC882_6ST_DIG] = {
9091 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9092 .init_verbs = { alc882_base_init_verbs,
9093 alc882_adc1_init_verbs },
9094 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9095 .dac_nids = alc882_dac_nids,
9096 .dig_out_nid = ALC882_DIGOUT_NID,
9097 .dig_in_nid = ALC882_DIGIN_NID,
9098 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9099 .channel_mode = alc882_sixstack_modes,
9100 .input_mux = &alc882_capture_source,
9103 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9104 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9105 alc882_eapd_verbs },
9106 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9107 .dac_nids = alc882_dac_nids,
9108 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9109 .channel_mode = alc882_sixstack_modes,
9110 .input_mux = &alc882_capture_source,
9113 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9114 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9115 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9116 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9117 .dac_nids = alc882_dac_nids,
9118 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9119 .channel_mode = alc880_threestack_modes,
9121 .input_mux = &alc882_capture_source,
9122 .dig_out_nid = ALC882_DIGOUT_NID,
9125 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9126 .init_verbs = { alc885_mbp3_init_verbs,
9127 alc880_gpio1_init_verbs },
9129 .dac_nids = alc882_dac_nids,
9131 .channel_mode = alc885_mbp_4ch_modes,
9132 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9133 .input_mux = &alc882_capture_source,
9134 .dig_out_nid = ALC882_DIGOUT_NID,
9135 .dig_in_nid = ALC882_DIGIN_NID,
9136 .unsol_event = alc_automute_amp_unsol_event,
9137 .setup = alc885_mbp3_setup,
9138 .init_hook = alc_automute_amp,
9141 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9142 .init_verbs = { alc885_mb5_init_verbs,
9143 alc880_gpio1_init_verbs },
9144 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9145 .dac_nids = alc882_dac_nids,
9146 .channel_mode = alc885_mb5_6ch_modes,
9147 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9148 .input_mux = &mb5_capture_source,
9149 .dig_out_nid = ALC882_DIGOUT_NID,
9150 .dig_in_nid = ALC882_DIGIN_NID,
9151 .unsol_event = alc885_mb5_unsol_event,
9152 .init_hook = alc885_mb5_automute,
9155 .mixers = { alc882_macpro_mixer },
9156 .init_verbs = { alc882_macpro_init_verbs },
9157 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9158 .dac_nids = alc882_dac_nids,
9159 .dig_out_nid = ALC882_DIGOUT_NID,
9160 .dig_in_nid = ALC882_DIGIN_NID,
9161 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9162 .channel_mode = alc882_ch_modes,
9163 .input_mux = &alc882_capture_source,
9164 .init_hook = alc885_macpro_init_hook,
9167 .mixers = { alc885_imac24_mixer },
9168 .init_verbs = { alc885_imac24_init_verbs },
9169 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9170 .dac_nids = alc882_dac_nids,
9171 .dig_out_nid = ALC882_DIGOUT_NID,
9172 .dig_in_nid = ALC882_DIGIN_NID,
9173 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9174 .channel_mode = alc882_ch_modes,
9175 .input_mux = &alc882_capture_source,
9176 .unsol_event = alc_automute_amp_unsol_event,
9177 .setup = alc885_imac24_setup,
9178 .init_hook = alc885_imac24_init_hook,
9181 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9182 .init_verbs = { alc885_imac91_init_verbs,
9183 alc880_gpio1_init_verbs },
9184 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9185 .dac_nids = alc882_dac_nids,
9186 .channel_mode = alc885_mbp_4ch_modes,
9187 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9188 .input_mux = &alc882_capture_source,
9189 .dig_out_nid = ALC882_DIGOUT_NID,
9190 .dig_in_nid = ALC882_DIGIN_NID,
9191 .unsol_event = alc885_imac91_unsol_event,
9192 .init_hook = alc885_imac91_automute,
9195 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9196 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9197 alc880_gpio3_init_verbs, alc882_targa_verbs},
9198 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9199 .dac_nids = alc882_dac_nids,
9200 .dig_out_nid = ALC882_DIGOUT_NID,
9201 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9202 .adc_nids = alc882_adc_nids,
9203 .capsrc_nids = alc882_capsrc_nids,
9204 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9205 .channel_mode = alc882_3ST_6ch_modes,
9207 .input_mux = &alc882_capture_source,
9208 .unsol_event = alc882_targa_unsol_event,
9209 .setup = alc882_targa_setup,
9210 .init_hook = alc882_targa_automute,
9212 [ALC882_ASUS_A7J] = {
9213 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9214 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9215 alc882_asus_a7j_verbs},
9216 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9217 .dac_nids = alc882_dac_nids,
9218 .dig_out_nid = ALC882_DIGOUT_NID,
9219 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9220 .adc_nids = alc882_adc_nids,
9221 .capsrc_nids = alc882_capsrc_nids,
9222 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9223 .channel_mode = alc882_3ST_6ch_modes,
9225 .input_mux = &alc882_capture_source,
9227 [ALC882_ASUS_A7M] = {
9228 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9229 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9230 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9231 alc882_asus_a7m_verbs },
9232 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9233 .dac_nids = alc882_dac_nids,
9234 .dig_out_nid = ALC882_DIGOUT_NID,
9235 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9236 .channel_mode = alc880_threestack_modes,
9238 .input_mux = &alc882_capture_source,
9240 [ALC883_3ST_2ch_DIG] = {
9241 .mixers = { alc883_3ST_2ch_mixer },
9242 .init_verbs = { alc883_init_verbs },
9243 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9244 .dac_nids = alc883_dac_nids,
9245 .dig_out_nid = ALC883_DIGOUT_NID,
9246 .dig_in_nid = ALC883_DIGIN_NID,
9247 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9248 .channel_mode = alc883_3ST_2ch_modes,
9249 .input_mux = &alc883_capture_source,
9251 [ALC883_3ST_6ch_DIG] = {
9252 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9253 .init_verbs = { alc883_init_verbs },
9254 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9255 .dac_nids = alc883_dac_nids,
9256 .dig_out_nid = ALC883_DIGOUT_NID,
9257 .dig_in_nid = ALC883_DIGIN_NID,
9258 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9259 .channel_mode = alc883_3ST_6ch_modes,
9261 .input_mux = &alc883_capture_source,
9263 [ALC883_3ST_6ch] = {
9264 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9265 .init_verbs = { alc883_init_verbs },
9266 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9267 .dac_nids = alc883_dac_nids,
9268 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9269 .channel_mode = alc883_3ST_6ch_modes,
9271 .input_mux = &alc883_capture_source,
9273 [ALC883_3ST_6ch_INTEL] = {
9274 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9275 .init_verbs = { alc883_init_verbs },
9276 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9277 .dac_nids = alc883_dac_nids,
9278 .dig_out_nid = ALC883_DIGOUT_NID,
9279 .dig_in_nid = ALC883_DIGIN_NID,
9280 .slave_dig_outs = alc883_slave_dig_outs,
9281 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9282 .channel_mode = alc883_3ST_6ch_intel_modes,
9284 .input_mux = &alc883_3stack_6ch_intel,
9287 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9288 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9289 alc_hp15_unsol_verbs },
9290 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9291 .dac_nids = alc883_dac_nids,
9292 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9293 .adc_nids = alc889_adc_nids,
9294 .dig_out_nid = ALC883_DIGOUT_NID,
9295 .dig_in_nid = ALC883_DIGIN_NID,
9296 .slave_dig_outs = alc883_slave_dig_outs,
9297 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9298 .channel_mode = alc889_8ch_intel_modes,
9299 .capsrc_nids = alc889_capsrc_nids,
9300 .input_mux = &alc889_capture_source,
9301 .setup = alc889_automute_setup,
9302 .init_hook = alc_automute_amp,
9303 .unsol_event = alc_automute_amp_unsol_event,
9307 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9308 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9309 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9310 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9311 .dac_nids = alc883_dac_nids,
9312 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9313 .adc_nids = alc889_adc_nids,
9314 .dig_out_nid = ALC883_DIGOUT_NID,
9315 .dig_in_nid = ALC883_DIGIN_NID,
9316 .slave_dig_outs = alc883_slave_dig_outs,
9317 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9318 .channel_mode = alc889_8ch_intel_modes,
9319 .capsrc_nids = alc889_capsrc_nids,
9320 .input_mux = &alc889_capture_source,
9321 .setup = alc889_automute_setup,
9322 .init_hook = alc889_intel_init_hook,
9323 .unsol_event = alc_automute_amp_unsol_event,
9326 [ALC883_6ST_DIG] = {
9327 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9328 .init_verbs = { alc883_init_verbs },
9329 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9330 .dac_nids = alc883_dac_nids,
9331 .dig_out_nid = ALC883_DIGOUT_NID,
9332 .dig_in_nid = ALC883_DIGIN_NID,
9333 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9334 .channel_mode = alc883_sixstack_modes,
9335 .input_mux = &alc883_capture_source,
9337 [ALC883_TARGA_DIG] = {
9338 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9339 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9340 alc883_targa_verbs},
9341 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9342 .dac_nids = alc883_dac_nids,
9343 .dig_out_nid = ALC883_DIGOUT_NID,
9344 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9345 .channel_mode = alc883_3ST_6ch_modes,
9347 .input_mux = &alc883_capture_source,
9348 .unsol_event = alc883_targa_unsol_event,
9349 .setup = alc882_targa_setup,
9350 .init_hook = alc882_targa_automute,
9352 [ALC883_TARGA_2ch_DIG] = {
9353 .mixers = { alc883_targa_2ch_mixer},
9354 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9355 alc883_targa_verbs},
9356 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9357 .dac_nids = alc883_dac_nids,
9358 .adc_nids = alc883_adc_nids_alt,
9359 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9360 .capsrc_nids = alc883_capsrc_nids,
9361 .dig_out_nid = ALC883_DIGOUT_NID,
9362 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9363 .channel_mode = alc883_3ST_2ch_modes,
9364 .input_mux = &alc883_capture_source,
9365 .unsol_event = alc883_targa_unsol_event,
9366 .setup = alc882_targa_setup,
9367 .init_hook = alc882_targa_automute,
9369 [ALC883_TARGA_8ch_DIG] = {
9370 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9371 alc883_chmode_mixer },
9372 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9373 alc883_targa_verbs },
9374 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9375 .dac_nids = alc883_dac_nids,
9376 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9377 .adc_nids = alc883_adc_nids_rev,
9378 .capsrc_nids = alc883_capsrc_nids_rev,
9379 .dig_out_nid = ALC883_DIGOUT_NID,
9380 .dig_in_nid = ALC883_DIGIN_NID,
9381 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9382 .channel_mode = alc883_4ST_8ch_modes,
9384 .input_mux = &alc883_capture_source,
9385 .unsol_event = alc883_targa_unsol_event,
9386 .setup = alc882_targa_setup,
9387 .init_hook = alc882_targa_automute,
9390 .mixers = { alc883_base_mixer },
9391 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9392 * and the headphone jack. Turn this on and rely on the
9393 * standard mute methods whenever the user wants to turn
9394 * these outputs off.
9396 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9397 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9398 .dac_nids = alc883_dac_nids,
9399 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9400 .channel_mode = alc883_3ST_2ch_modes,
9401 .input_mux = &alc883_capture_source,
9403 [ALC883_ACER_ASPIRE] = {
9404 .mixers = { alc883_acer_aspire_mixer },
9405 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9407 .dac_nids = alc883_dac_nids,
9408 .dig_out_nid = ALC883_DIGOUT_NID,
9409 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9410 .channel_mode = alc883_3ST_2ch_modes,
9411 .input_mux = &alc883_capture_source,
9412 .unsol_event = alc_automute_amp_unsol_event,
9413 .setup = alc883_acer_aspire_setup,
9414 .init_hook = alc_automute_amp,
9416 [ALC888_ACER_ASPIRE_4930G] = {
9417 .mixers = { alc888_base_mixer,
9418 alc883_chmode_mixer },
9419 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9420 alc888_acer_aspire_4930g_verbs },
9421 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9422 .dac_nids = alc883_dac_nids,
9423 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9424 .adc_nids = alc883_adc_nids_rev,
9425 .capsrc_nids = alc883_capsrc_nids_rev,
9426 .dig_out_nid = ALC883_DIGOUT_NID,
9427 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9428 .channel_mode = alc883_3ST_6ch_modes,
9431 ARRAY_SIZE(alc888_2_capture_sources),
9432 .input_mux = alc888_2_capture_sources,
9433 .unsol_event = alc_automute_amp_unsol_event,
9434 .setup = alc888_acer_aspire_4930g_setup,
9435 .init_hook = alc_automute_amp,
9437 [ALC888_ACER_ASPIRE_6530G] = {
9438 .mixers = { alc888_acer_aspire_6530_mixer },
9439 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9440 alc888_acer_aspire_6530g_verbs },
9441 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9442 .dac_nids = alc883_dac_nids,
9443 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9444 .adc_nids = alc883_adc_nids_rev,
9445 .capsrc_nids = alc883_capsrc_nids_rev,
9446 .dig_out_nid = ALC883_DIGOUT_NID,
9447 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9448 .channel_mode = alc883_3ST_2ch_modes,
9450 ARRAY_SIZE(alc888_2_capture_sources),
9451 .input_mux = alc888_acer_aspire_6530_sources,
9452 .unsol_event = alc_automute_amp_unsol_event,
9453 .setup = alc888_acer_aspire_6530g_setup,
9454 .init_hook = alc_automute_amp,
9456 [ALC888_ACER_ASPIRE_8930G] = {
9457 .mixers = { alc889_acer_aspire_8930g_mixer,
9458 alc883_chmode_mixer },
9459 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9460 alc889_acer_aspire_8930g_verbs,
9462 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9463 .dac_nids = alc883_dac_nids,
9464 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9465 .adc_nids = alc889_adc_nids,
9466 .capsrc_nids = alc889_capsrc_nids,
9467 .dig_out_nid = ALC883_DIGOUT_NID,
9468 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9469 .channel_mode = alc883_3ST_6ch_modes,
9471 .const_channel_count = 6,
9473 ARRAY_SIZE(alc889_capture_sources),
9474 .input_mux = alc889_capture_sources,
9475 .unsol_event = alc_automute_amp_unsol_event,
9476 .setup = alc889_acer_aspire_8930g_setup,
9477 .init_hook = alc_automute_amp,
9478 #ifdef CONFIG_SND_HDA_POWER_SAVE
9479 .power_hook = alc889_power_eapd,
9482 [ALC888_ACER_ASPIRE_7730G] = {
9483 .mixers = { alc883_3ST_6ch_mixer,
9484 alc883_chmode_mixer },
9485 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9486 alc888_acer_aspire_7730G_verbs },
9487 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9488 .dac_nids = alc883_dac_nids,
9489 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9490 .adc_nids = alc883_adc_nids_rev,
9491 .capsrc_nids = alc883_capsrc_nids_rev,
9492 .dig_out_nid = ALC883_DIGOUT_NID,
9493 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9494 .channel_mode = alc883_3ST_6ch_modes,
9496 .const_channel_count = 6,
9497 .input_mux = &alc883_capture_source,
9498 .unsol_event = alc_automute_amp_unsol_event,
9499 .setup = alc888_acer_aspire_6530g_setup,
9500 .init_hook = alc_automute_amp,
9503 .mixers = { alc883_fivestack_mixer,
9504 alc883_chmode_mixer },
9505 .init_verbs = { alc883_init_verbs,
9506 alc883_medion_eapd_verbs },
9507 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9508 .dac_nids = alc883_dac_nids,
9509 .adc_nids = alc883_adc_nids_alt,
9510 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9511 .capsrc_nids = alc883_capsrc_nids,
9512 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9513 .channel_mode = alc883_sixstack_modes,
9514 .input_mux = &alc883_capture_source,
9516 [ALC883_MEDION_MD2] = {
9517 .mixers = { alc883_medion_md2_mixer},
9518 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9519 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9520 .dac_nids = alc883_dac_nids,
9521 .dig_out_nid = ALC883_DIGOUT_NID,
9522 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9523 .channel_mode = alc883_3ST_2ch_modes,
9524 .input_mux = &alc883_capture_source,
9525 .unsol_event = alc_automute_amp_unsol_event,
9526 .setup = alc883_medion_md2_setup,
9527 .init_hook = alc_automute_amp,
9529 [ALC883_LAPTOP_EAPD] = {
9530 .mixers = { alc883_base_mixer },
9531 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9532 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9533 .dac_nids = alc883_dac_nids,
9534 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9535 .channel_mode = alc883_3ST_2ch_modes,
9536 .input_mux = &alc883_capture_source,
9538 [ALC883_CLEVO_M540R] = {
9539 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9540 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9541 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9542 .dac_nids = alc883_dac_nids,
9543 .dig_out_nid = ALC883_DIGOUT_NID,
9544 .dig_in_nid = ALC883_DIGIN_NID,
9545 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9546 .channel_mode = alc883_3ST_6ch_clevo_modes,
9548 .input_mux = &alc883_capture_source,
9549 /* This machine has the hardware HP auto-muting, thus
9550 * we need no software mute via unsol event
9553 [ALC883_CLEVO_M720] = {
9554 .mixers = { alc883_clevo_m720_mixer },
9555 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9556 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9557 .dac_nids = alc883_dac_nids,
9558 .dig_out_nid = ALC883_DIGOUT_NID,
9559 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9560 .channel_mode = alc883_3ST_2ch_modes,
9561 .input_mux = &alc883_capture_source,
9562 .unsol_event = alc883_clevo_m720_unsol_event,
9563 .setup = alc883_clevo_m720_setup,
9564 .init_hook = alc883_clevo_m720_init_hook,
9566 [ALC883_LENOVO_101E_2ch] = {
9567 .mixers = { alc883_lenovo_101e_2ch_mixer},
9568 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9569 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9570 .dac_nids = alc883_dac_nids,
9571 .adc_nids = alc883_adc_nids_alt,
9572 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9573 .capsrc_nids = alc883_capsrc_nids,
9574 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9575 .channel_mode = alc883_3ST_2ch_modes,
9576 .input_mux = &alc883_lenovo_101e_capture_source,
9577 .unsol_event = alc883_lenovo_101e_unsol_event,
9578 .init_hook = alc883_lenovo_101e_all_automute,
9580 [ALC883_LENOVO_NB0763] = {
9581 .mixers = { alc883_lenovo_nb0763_mixer },
9582 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9583 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9584 .dac_nids = alc883_dac_nids,
9585 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9586 .channel_mode = alc883_3ST_2ch_modes,
9588 .input_mux = &alc883_lenovo_nb0763_capture_source,
9589 .unsol_event = alc_automute_amp_unsol_event,
9590 .setup = alc883_medion_md2_setup,
9591 .init_hook = alc_automute_amp,
9593 [ALC888_LENOVO_MS7195_DIG] = {
9594 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9595 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9596 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9597 .dac_nids = alc883_dac_nids,
9598 .dig_out_nid = ALC883_DIGOUT_NID,
9599 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9600 .channel_mode = alc883_3ST_6ch_modes,
9602 .input_mux = &alc883_capture_source,
9603 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9604 .init_hook = alc888_lenovo_ms7195_front_automute,
9606 [ALC883_HAIER_W66] = {
9607 .mixers = { alc883_targa_2ch_mixer},
9608 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9609 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9610 .dac_nids = alc883_dac_nids,
9611 .dig_out_nid = ALC883_DIGOUT_NID,
9612 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9613 .channel_mode = alc883_3ST_2ch_modes,
9614 .input_mux = &alc883_capture_source,
9615 .unsol_event = alc_automute_amp_unsol_event,
9616 .setup = alc883_haier_w66_setup,
9617 .init_hook = alc_automute_amp,
9620 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9621 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9622 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9623 .dac_nids = alc883_dac_nids,
9624 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9625 .channel_mode = alc888_3st_hp_modes,
9627 .input_mux = &alc883_capture_source,
9628 .unsol_event = alc_automute_amp_unsol_event,
9629 .setup = alc888_3st_hp_setup,
9630 .init_hook = alc_automute_amp,
9632 [ALC888_6ST_DELL] = {
9633 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9634 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9635 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9636 .dac_nids = alc883_dac_nids,
9637 .dig_out_nid = ALC883_DIGOUT_NID,
9638 .dig_in_nid = ALC883_DIGIN_NID,
9639 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9640 .channel_mode = alc883_sixstack_modes,
9641 .input_mux = &alc883_capture_source,
9642 .unsol_event = alc_automute_amp_unsol_event,
9643 .setup = alc888_6st_dell_setup,
9644 .init_hook = alc_automute_amp,
9647 .mixers = { alc883_mitac_mixer },
9648 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9649 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9650 .dac_nids = alc883_dac_nids,
9651 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9652 .channel_mode = alc883_3ST_2ch_modes,
9653 .input_mux = &alc883_capture_source,
9654 .unsol_event = alc_automute_amp_unsol_event,
9655 .setup = alc883_mitac_setup,
9656 .init_hook = alc_automute_amp,
9658 [ALC883_FUJITSU_PI2515] = {
9659 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9660 .init_verbs = { alc883_init_verbs,
9661 alc883_2ch_fujitsu_pi2515_verbs},
9662 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9663 .dac_nids = alc883_dac_nids,
9664 .dig_out_nid = ALC883_DIGOUT_NID,
9665 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9666 .channel_mode = alc883_3ST_2ch_modes,
9667 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9668 .unsol_event = alc_automute_amp_unsol_event,
9669 .setup = alc883_2ch_fujitsu_pi2515_setup,
9670 .init_hook = alc_automute_amp,
9672 [ALC888_FUJITSU_XA3530] = {
9673 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9674 .init_verbs = { alc883_init_verbs,
9675 alc888_fujitsu_xa3530_verbs },
9676 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9677 .dac_nids = alc883_dac_nids,
9678 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9679 .adc_nids = alc883_adc_nids_rev,
9680 .capsrc_nids = alc883_capsrc_nids_rev,
9681 .dig_out_nid = ALC883_DIGOUT_NID,
9682 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9683 .channel_mode = alc888_4ST_8ch_intel_modes,
9685 ARRAY_SIZE(alc888_2_capture_sources),
9686 .input_mux = alc888_2_capture_sources,
9687 .unsol_event = alc_automute_amp_unsol_event,
9688 .setup = alc888_fujitsu_xa3530_setup,
9689 .init_hook = alc_automute_amp,
9691 [ALC888_LENOVO_SKY] = {
9692 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9693 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9694 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9695 .dac_nids = alc883_dac_nids,
9696 .dig_out_nid = ALC883_DIGOUT_NID,
9697 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9698 .channel_mode = alc883_sixstack_modes,
9700 .input_mux = &alc883_lenovo_sky_capture_source,
9701 .unsol_event = alc_automute_amp_unsol_event,
9702 .setup = alc888_lenovo_sky_setup,
9703 .init_hook = alc_automute_amp,
9705 [ALC888_ASUS_M90V] = {
9706 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9707 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9708 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9709 .dac_nids = alc883_dac_nids,
9710 .dig_out_nid = ALC883_DIGOUT_NID,
9711 .dig_in_nid = ALC883_DIGIN_NID,
9712 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9713 .channel_mode = alc883_3ST_6ch_modes,
9715 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9716 .unsol_event = alc_sku_unsol_event,
9717 .setup = alc883_mode2_setup,
9718 .init_hook = alc_inithook,
9720 [ALC888_ASUS_EEE1601] = {
9721 .mixers = { alc883_asus_eee1601_mixer },
9722 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9723 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9724 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9725 .dac_nids = alc883_dac_nids,
9726 .dig_out_nid = ALC883_DIGOUT_NID,
9727 .dig_in_nid = ALC883_DIGIN_NID,
9728 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9729 .channel_mode = alc883_3ST_2ch_modes,
9731 .input_mux = &alc883_asus_eee1601_capture_source,
9732 .unsol_event = alc_sku_unsol_event,
9733 .init_hook = alc883_eee1601_inithook,
9735 [ALC1200_ASUS_P5Q] = {
9736 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9737 .init_verbs = { alc883_init_verbs },
9738 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9739 .dac_nids = alc883_dac_nids,
9740 .dig_out_nid = ALC1200_DIGOUT_NID,
9741 .dig_in_nid = ALC883_DIGIN_NID,
9742 .slave_dig_outs = alc1200_slave_dig_outs,
9743 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9744 .channel_mode = alc883_sixstack_modes,
9745 .input_mux = &alc883_capture_source,
9748 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9749 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9750 alc880_gpio1_init_verbs },
9751 .adc_nids = alc883_adc_nids,
9752 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9753 .capsrc_nids = alc883_capsrc_nids,
9754 .dac_nids = alc883_dac_nids,
9755 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9756 .channel_mode = alc889A_mb31_6ch_modes,
9757 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9758 .input_mux = &alc889A_mb31_capture_source,
9759 .dig_out_nid = ALC883_DIGOUT_NID,
9760 .unsol_event = alc889A_mb31_unsol_event,
9761 .init_hook = alc889A_mb31_automute,
9763 [ALC883_SONY_VAIO_TT] = {
9764 .mixers = { alc883_vaiott_mixer },
9765 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9766 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9767 .dac_nids = alc883_dac_nids,
9768 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9769 .channel_mode = alc883_3ST_2ch_modes,
9770 .input_mux = &alc883_capture_source,
9771 .unsol_event = alc_automute_amp_unsol_event,
9772 .setup = alc883_vaiott_setup,
9773 .init_hook = alc_automute_amp,
9782 PINFIX_ABIT_AW9D_MAX
9785 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9786 { 0x15, 0x01080104 }, /* side */
9787 { 0x16, 0x01011012 }, /* rear */
9788 { 0x17, 0x01016011 }, /* clfe */
9792 static const struct alc_fixup alc882_fixups[] = {
9793 [PINFIX_ABIT_AW9D_MAX] = {
9794 .pins = alc882_abit_aw9d_pinfix
9798 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9799 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9804 * BIOS auto configuration
9806 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9807 const struct auto_pin_cfg *cfg)
9809 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9812 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9813 hda_nid_t nid, int pin_type,
9817 struct alc_spec *spec = codec->spec;
9820 alc_set_pin_output(codec, nid, pin_type);
9821 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9824 idx = spec->multiout.dac_nids[dac_idx] - 2;
9825 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9829 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9831 struct alc_spec *spec = codec->spec;
9834 for (i = 0; i <= HDA_SIDE; i++) {
9835 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9836 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9838 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9843 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9845 struct alc_spec *spec = codec->spec;
9848 pin = spec->autocfg.hp_pins[0];
9849 if (pin) /* connect to front */
9851 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9852 pin = spec->autocfg.speaker_pins[0];
9854 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9857 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9859 struct alc_spec *spec = codec->spec;
9862 for (i = 0; i < AUTO_PIN_LAST; i++) {
9863 hda_nid_t nid = spec->autocfg.input_pins[i];
9866 alc_set_input_pin(codec, nid, i);
9867 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9868 snd_hda_codec_write(codec, nid, 0,
9869 AC_VERB_SET_AMP_GAIN_MUTE,
9874 static void alc882_auto_init_input_src(struct hda_codec *codec)
9876 struct alc_spec *spec = codec->spec;
9879 for (c = 0; c < spec->num_adc_nids; c++) {
9880 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9881 hda_nid_t nid = spec->capsrc_nids[c];
9882 unsigned int mux_idx;
9883 const struct hda_input_mux *imux;
9884 int conns, mute, idx, item;
9886 conns = snd_hda_get_connections(codec, nid, conn_list,
9887 ARRAY_SIZE(conn_list));
9890 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9891 imux = &spec->input_mux[mux_idx];
9892 for (idx = 0; idx < conns; idx++) {
9893 /* if the current connection is the selected one,
9894 * unmute it as default - otherwise mute it
9896 mute = AMP_IN_MUTE(idx);
9897 for (item = 0; item < imux->num_items; item++) {
9898 if (imux->items[item].index == idx) {
9899 if (spec->cur_mux[c] == item)
9900 mute = AMP_IN_UNMUTE(idx);
9904 /* check if we have a selector or mixer
9905 * we could check for the widget type instead, but
9906 * just check for Amp-In presence (in case of mixer
9907 * without amp-in there is something wrong, this
9908 * function shouldn't be used or capsrc nid is wrong)
9910 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9911 snd_hda_codec_write(codec, nid, 0,
9912 AC_VERB_SET_AMP_GAIN_MUTE,
9914 else if (mute != AMP_IN_MUTE(idx))
9915 snd_hda_codec_write(codec, nid, 0,
9916 AC_VERB_SET_CONNECT_SEL,
9922 /* add mic boosts if needed */
9923 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9925 struct alc_spec *spec = codec->spec;
9929 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9930 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9931 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9933 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9937 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9938 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9939 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9941 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9948 /* almost identical with ALC880 parser... */
9949 static int alc882_parse_auto_config(struct hda_codec *codec)
9951 struct alc_spec *spec = codec->spec;
9952 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9955 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9959 if (!spec->autocfg.line_outs)
9960 return 0; /* can't find valid BIOS pin config */
9962 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9965 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9968 err = alc880_auto_create_extra_out(spec,
9969 spec->autocfg.speaker_pins[0],
9973 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9977 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9981 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9983 /* check multiple SPDIF-out (for recent codecs) */
9984 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9986 err = snd_hda_get_connections(codec,
9987 spec->autocfg.dig_out_pins[i],
9992 spec->multiout.dig_out_nid = dig_nid;
9994 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9995 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9997 spec->slave_dig_outs[i - 1] = dig_nid;
10000 if (spec->autocfg.dig_in_pin)
10001 spec->dig_in_nid = ALC880_DIGIN_NID;
10003 if (spec->kctls.list)
10004 add_mixer(spec, spec->kctls.list);
10006 add_verb(spec, alc883_auto_init_verbs);
10007 /* if ADC 0x07 is available, initialize it, too */
10008 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10009 add_verb(spec, alc882_adc1_init_verbs);
10011 spec->num_mux_defs = 1;
10012 spec->input_mux = &spec->private_imux[0];
10014 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10016 err = alc_auto_add_mic_boost(codec);
10020 return 1; /* config found */
10023 /* additional initialization for auto-configuration model */
10024 static void alc882_auto_init(struct hda_codec *codec)
10026 struct alc_spec *spec = codec->spec;
10027 alc882_auto_init_multi_out(codec);
10028 alc882_auto_init_hp_out(codec);
10029 alc882_auto_init_analog_input(codec);
10030 alc882_auto_init_input_src(codec);
10031 if (spec->unsol_event)
10032 alc_inithook(codec);
10035 static int patch_alc882(struct hda_codec *codec)
10037 struct alc_spec *spec;
10038 int err, board_config;
10040 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10044 codec->spec = spec;
10046 switch (codec->vendor_id) {
10051 /* ALC883 and variants */
10052 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10056 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10060 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10061 board_config = snd_hda_check_board_codec_sid_config(codec,
10062 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10064 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10065 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10067 board_config = ALC882_AUTO;
10070 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10072 if (board_config == ALC882_AUTO) {
10073 /* automatic parse from the BIOS config */
10074 err = alc882_parse_auto_config(codec);
10080 "hda_codec: Cannot set up configuration "
10081 "from BIOS. Using base mode...\n");
10082 board_config = ALC882_3ST_DIG;
10086 err = snd_hda_attach_beep_device(codec, 0x1);
10092 if (board_config != ALC882_AUTO)
10093 setup_preset(codec, &alc882_presets[board_config]);
10095 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10096 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10097 /* FIXME: setup DAC5 */
10098 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10099 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10101 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10102 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10104 if (codec->vendor_id == 0x10ec0888)
10105 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10107 if (!spec->adc_nids && spec->input_mux) {
10109 spec->num_adc_nids = 0;
10110 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10111 const struct hda_input_mux *imux = spec->input_mux;
10113 hda_nid_t items[16];
10114 hda_nid_t nid = alc882_adc_nids[i];
10115 unsigned int wcap = get_wcaps(codec, nid);
10117 wcap = get_wcaps_type(wcap);
10118 if (wcap != AC_WID_AUD_IN)
10120 spec->private_adc_nids[spec->num_adc_nids] = nid;
10121 err = snd_hda_get_connections(codec, nid, &cap, 1);
10124 err = snd_hda_get_connections(codec, cap, items,
10125 ARRAY_SIZE(items));
10128 for (j = 0; j < imux->num_items; j++)
10129 if (imux->items[j].index >= err)
10131 if (j < imux->num_items)
10133 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10134 spec->num_adc_nids++;
10136 spec->adc_nids = spec->private_adc_nids;
10137 spec->capsrc_nids = spec->private_capsrc_nids;
10140 set_capture_mixer(codec);
10141 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10143 spec->vmaster_nid = 0x0c;
10145 codec->patch_ops = alc_patch_ops;
10146 if (board_config == ALC882_AUTO)
10147 spec->init_hook = alc882_auto_init;
10148 #ifdef CONFIG_SND_HDA_POWER_SAVE
10149 if (!spec->loopback.amplist)
10150 spec->loopback.amplist = alc882_loopbacks;
10152 codec->proc_widget_hook = print_realtek_coef;
10162 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10163 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10165 #define alc262_dac_nids alc260_dac_nids
10166 #define alc262_adc_nids alc882_adc_nids
10167 #define alc262_adc_nids_alt alc882_adc_nids_alt
10168 #define alc262_capsrc_nids alc882_capsrc_nids
10169 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10171 #define alc262_modes alc260_modes
10172 #define alc262_capture_source alc882_capture_source
10174 static hda_nid_t alc262_dmic_adc_nids[1] = {
10179 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10181 static struct snd_kcontrol_new alc262_base_mixer[] = {
10182 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10183 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10184 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10185 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10186 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10187 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10190 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10191 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10192 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10193 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10194 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10195 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10196 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10197 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10201 /* update HP, line and mono-out pins according to the master switch */
10202 static void alc262_hp_master_update(struct hda_codec *codec)
10204 struct alc_spec *spec = codec->spec;
10205 int val = spec->master_sw;
10207 /* HP & line-out */
10208 snd_hda_codec_write_cache(codec, 0x1b, 0,
10209 AC_VERB_SET_PIN_WIDGET_CONTROL,
10211 snd_hda_codec_write_cache(codec, 0x15, 0,
10212 AC_VERB_SET_PIN_WIDGET_CONTROL,
10214 /* mono (speaker) depending on the HP jack sense */
10215 val = val && !spec->jack_present;
10216 snd_hda_codec_write_cache(codec, 0x16, 0,
10217 AC_VERB_SET_PIN_WIDGET_CONTROL,
10218 val ? PIN_OUT : 0);
10221 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10223 struct alc_spec *spec = codec->spec;
10225 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10226 alc262_hp_master_update(codec);
10229 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10231 if ((res >> 26) != ALC880_HP_EVENT)
10233 alc262_hp_bpc_automute(codec);
10236 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10238 struct alc_spec *spec = codec->spec;
10240 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10241 alc262_hp_master_update(codec);
10244 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10247 if ((res >> 26) != ALC880_HP_EVENT)
10249 alc262_hp_wildwest_automute(codec);
10252 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10254 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10255 struct snd_ctl_elem_value *ucontrol)
10257 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10258 struct alc_spec *spec = codec->spec;
10259 int val = !!*ucontrol->value.integer.value;
10261 if (val == spec->master_sw)
10263 spec->master_sw = val;
10264 alc262_hp_master_update(codec);
10268 #define ALC262_HP_MASTER_SWITCH \
10270 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10271 .name = "Master Playback Switch", \
10272 .info = snd_ctl_boolean_mono_info, \
10273 .get = alc262_hp_master_sw_get, \
10274 .put = alc262_hp_master_sw_put, \
10277 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10278 ALC262_HP_MASTER_SWITCH,
10279 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10280 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10281 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10282 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10284 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10286 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10287 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10288 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10289 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10290 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10291 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10292 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10293 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10294 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10295 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10296 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10297 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10301 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10302 ALC262_HP_MASTER_SWITCH,
10303 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10304 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10305 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10306 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10307 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10309 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10311 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10312 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10313 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10314 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10315 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10316 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10317 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10321 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10322 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10323 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10324 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10328 /* mute/unmute internal speaker according to the hp jack and mute state */
10329 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10331 struct alc_spec *spec = codec->spec;
10333 spec->autocfg.hp_pins[0] = 0x15;
10334 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10337 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10338 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10339 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10340 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10341 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10344 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10348 static struct hda_verb alc262_hp_t5735_verbs[] = {
10349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10352 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10356 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10357 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10358 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10359 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10360 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10361 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10362 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10366 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10367 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10368 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10369 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10370 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10371 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10372 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10376 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10380 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10387 /* bind hp and internal speaker mute (with plug check) as master switch */
10388 static void alc262_hippo_master_update(struct hda_codec *codec)
10390 struct alc_spec *spec = codec->spec;
10391 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10392 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10393 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10397 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10398 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10399 HDA_AMP_MUTE, mute);
10400 /* mute internal speaker per jack sense */
10401 if (spec->jack_present)
10402 mute = HDA_AMP_MUTE;
10404 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10405 HDA_AMP_MUTE, mute);
10406 if (speaker_nid && speaker_nid != line_nid)
10407 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10408 HDA_AMP_MUTE, mute);
10411 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10413 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10414 struct snd_ctl_elem_value *ucontrol)
10416 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10417 struct alc_spec *spec = codec->spec;
10418 int val = !!*ucontrol->value.integer.value;
10420 if (val == spec->master_sw)
10422 spec->master_sw = val;
10423 alc262_hippo_master_update(codec);
10427 #define ALC262_HIPPO_MASTER_SWITCH \
10429 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10430 .name = "Master Playback Switch", \
10431 .info = snd_ctl_boolean_mono_info, \
10432 .get = alc262_hippo_master_sw_get, \
10433 .put = alc262_hippo_master_sw_put, \
10436 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10437 ALC262_HIPPO_MASTER_SWITCH,
10438 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10439 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10440 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10441 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10442 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10444 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10445 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10446 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10447 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10448 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10449 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10453 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10454 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10455 ALC262_HIPPO_MASTER_SWITCH,
10456 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10457 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10458 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10459 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10460 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10462 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10463 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10464 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10465 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10469 /* mute/unmute internal speaker according to the hp jack and mute state */
10470 static void alc262_hippo_automute(struct hda_codec *codec)
10472 struct alc_spec *spec = codec->spec;
10473 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10475 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10476 alc262_hippo_master_update(codec);
10479 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10481 if ((res >> 26) != ALC880_HP_EVENT)
10483 alc262_hippo_automute(codec);
10486 static void alc262_hippo_setup(struct hda_codec *codec)
10488 struct alc_spec *spec = codec->spec;
10490 spec->autocfg.hp_pins[0] = 0x15;
10491 spec->autocfg.speaker_pins[0] = 0x14;
10494 static void alc262_hippo1_setup(struct hda_codec *codec)
10496 struct alc_spec *spec = codec->spec;
10498 spec->autocfg.hp_pins[0] = 0x1b;
10499 spec->autocfg.speaker_pins[0] = 0x14;
10503 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10504 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10505 ALC262_HIPPO_MASTER_SWITCH,
10506 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10507 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10508 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10509 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10513 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10514 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10515 ALC262_HIPPO_MASTER_SWITCH,
10516 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10517 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10518 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10519 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10520 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10524 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10525 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10526 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10527 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10528 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10529 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10530 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10533 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10534 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10535 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10536 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10540 static struct hda_verb alc262_tyan_verbs[] = {
10541 /* Headphone automute */
10542 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10543 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10544 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10546 /* P11 AUX_IN, white 4-pin connector */
10547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10548 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10549 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10550 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10555 /* unsolicited event for HP jack sensing */
10556 static void alc262_tyan_setup(struct hda_codec *codec)
10558 struct alc_spec *spec = codec->spec;
10560 spec->autocfg.hp_pins[0] = 0x1b;
10561 spec->autocfg.speaker_pins[0] = 0x15;
10565 #define alc262_capture_mixer alc882_capture_mixer
10566 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10569 * generic initialization of ADC, input mixers and output mixers
10571 static struct hda_verb alc262_init_verbs[] = {
10573 * Unmute ADC0-2 and set the default input to mic-in
10575 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10577 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10578 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10579 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10580 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10582 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10584 * Note: PASD motherboards uses the Line In 2 as the input for
10585 * front panel mic (mic 2)
10587 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10588 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10589 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10590 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10591 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10592 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10595 * Set up output mixers (0x0c - 0x0e)
10597 /* set vol=0 to output mixers */
10598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10599 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10600 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10601 /* set up input amps for analog loopback */
10602 /* Amp Indices: DAC = 0, mixer = 1 */
10603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10605 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10606 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10607 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10608 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10610 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10611 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10613 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10614 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10615 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10617 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10618 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10619 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10620 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10621 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10623 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10624 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10626 /* FIXME: use matrix-type input source selection */
10627 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10628 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10629 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10630 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10631 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10632 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10634 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10635 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10637 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10647 static struct hda_verb alc262_eapd_verbs[] = {
10648 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10649 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10653 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10654 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10655 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10656 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10658 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10659 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10663 static struct hda_verb alc262_sony_unsol_verbs[] = {
10664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10665 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10666 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10668 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10673 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10674 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10675 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10678 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10682 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10683 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10686 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10687 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10688 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10689 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10690 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10694 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10696 struct alc_spec *spec = codec->spec;
10698 spec->autocfg.hp_pins[0] = 0x15;
10699 spec->autocfg.speaker_pins[0] = 0x14;
10700 spec->ext_mic.pin = 0x18;
10701 spec->ext_mic.mux_idx = 0;
10702 spec->int_mic.pin = 0x12;
10703 spec->int_mic.mux_idx = 9;
10704 spec->auto_mic = 1;
10710 * 0x16 = internal speaker
10711 * 0x18 = external mic
10714 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10715 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10716 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10719 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10720 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10722 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10723 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10727 static struct hda_verb alc262_nec_verbs[] = {
10728 /* Unmute Speaker */
10729 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10732 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10733 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10735 /* External mic to headphone */
10736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10737 /* External mic to speaker */
10738 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10744 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10745 * 0x1b = port replicator headphone out
10748 #define ALC_HP_EVENT 0x37
10750 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10751 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10752 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10753 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10754 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10758 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10759 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10760 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10764 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10765 /* Front Mic pin: input vref at 50% */
10766 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10767 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10771 static struct hda_input_mux alc262_fujitsu_capture_source = {
10775 { "Int Mic", 0x1 },
10780 static struct hda_input_mux alc262_HP_capture_source = {
10784 { "Front Mic", 0x1 },
10791 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10795 { "Front Mic", 0x2 },
10801 /* mute/unmute internal speaker according to the hp jacks and mute state */
10802 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10804 struct alc_spec *spec = codec->spec;
10807 if (force || !spec->sense_updated) {
10808 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10809 snd_hda_jack_detect(codec, 0x1b);
10810 spec->sense_updated = 1;
10812 /* unmute internal speaker only if both HPs are unplugged and
10813 * master switch is on
10815 if (spec->jack_present)
10816 mute = HDA_AMP_MUTE;
10818 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10819 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10820 HDA_AMP_MUTE, mute);
10823 /* unsolicited event for HP jack sensing */
10824 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10827 if ((res >> 26) != ALC_HP_EVENT)
10829 alc262_fujitsu_automute(codec, 1);
10832 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10834 alc262_fujitsu_automute(codec, 1);
10837 /* bind volumes of both NID 0x0c and 0x0d */
10838 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10839 .ops = &snd_hda_bind_vol,
10841 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10842 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10847 /* mute/unmute internal speaker according to the hp jack and mute state */
10848 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10850 struct alc_spec *spec = codec->spec;
10853 if (force || !spec->sense_updated) {
10854 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10855 spec->sense_updated = 1;
10857 if (spec->jack_present) {
10858 /* mute internal speaker */
10859 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10860 HDA_AMP_MUTE, HDA_AMP_MUTE);
10861 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10862 HDA_AMP_MUTE, HDA_AMP_MUTE);
10864 /* unmute internal speaker if necessary */
10865 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10866 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10867 HDA_AMP_MUTE, mute);
10868 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10869 HDA_AMP_MUTE, mute);
10873 /* unsolicited event for HP jack sensing */
10874 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10877 if ((res >> 26) != ALC_HP_EVENT)
10879 alc262_lenovo_3000_automute(codec, 1);
10882 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10883 int dir, int idx, long *valp)
10887 for (i = 0; i < 2; i++, valp++)
10888 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10890 *valp ? 0 : HDA_AMP_MUTE);
10894 /* bind hp and internal speaker mute (with plug check) */
10895 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10896 struct snd_ctl_elem_value *ucontrol)
10898 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10899 long *valp = ucontrol->value.integer.value;
10902 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10903 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10905 alc262_fujitsu_automute(codec, 0);
10909 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10910 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10912 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10913 .name = "Master Playback Switch",
10914 .info = snd_hda_mixer_amp_switch_info,
10915 .get = snd_hda_mixer_amp_switch_get,
10916 .put = alc262_fujitsu_master_sw_put,
10917 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10919 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10920 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10922 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10923 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10924 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10925 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10926 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10930 /* bind hp and internal speaker mute (with plug check) */
10931 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10932 struct snd_ctl_elem_value *ucontrol)
10934 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10935 long *valp = ucontrol->value.integer.value;
10938 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10940 alc262_lenovo_3000_automute(codec, 0);
10944 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10945 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10947 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10948 .name = "Master Playback Switch",
10949 .info = snd_hda_mixer_amp_switch_info,
10950 .get = snd_hda_mixer_amp_switch_get,
10951 .put = alc262_lenovo_3000_master_sw_put,
10952 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10954 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10955 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10956 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10957 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10958 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10959 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10960 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10961 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10965 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10966 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10967 ALC262_HIPPO_MASTER_SWITCH,
10968 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10969 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10970 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10971 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10972 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10973 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10977 /* additional init verbs for Benq laptops */
10978 static struct hda_verb alc262_EAPD_verbs[] = {
10979 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10980 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10984 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10985 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10986 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10988 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10989 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10993 /* Samsung Q1 Ultra Vista model setup */
10994 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10995 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10996 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10999 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11000 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11004 static struct hda_verb alc262_ultra_verbs[] = {
11006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11008 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11010 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11011 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11012 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11013 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11015 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11016 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11018 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11019 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11021 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11023 /* ADC, choose mic */
11024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11025 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11033 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11037 /* mute/unmute internal speaker according to the hp jack and mute state */
11038 static void alc262_ultra_automute(struct hda_codec *codec)
11040 struct alc_spec *spec = codec->spec;
11044 /* auto-mute only when HP is used as HP */
11045 if (!spec->cur_mux[0]) {
11046 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11047 if (spec->jack_present)
11048 mute = HDA_AMP_MUTE;
11050 /* mute/unmute internal speaker */
11051 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11052 HDA_AMP_MUTE, mute);
11053 /* mute/unmute HP */
11054 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11055 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11058 /* unsolicited event for HP jack sensing */
11059 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11062 if ((res >> 26) != ALC880_HP_EVENT)
11064 alc262_ultra_automute(codec);
11067 static struct hda_input_mux alc262_ultra_capture_source = {
11071 { "Headphone", 0x7 },
11075 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11076 struct snd_ctl_elem_value *ucontrol)
11078 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11079 struct alc_spec *spec = codec->spec;
11082 ret = alc_mux_enum_put(kcontrol, ucontrol);
11085 /* reprogram the HP pin as mic or HP according to the input source */
11086 snd_hda_codec_write_cache(codec, 0x15, 0,
11087 AC_VERB_SET_PIN_WIDGET_CONTROL,
11088 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11089 alc262_ultra_automute(codec); /* mute/unmute HP */
11093 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11094 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11095 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11097 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11098 .name = "Capture Source",
11099 .info = alc_mux_enum_info,
11100 .get = alc_mux_enum_get,
11101 .put = alc262_ultra_mux_enum_put,
11106 /* We use two mixers depending on the output pin; 0x16 is a mono output
11107 * and thus it's bound with a different mixer.
11108 * This function returns which mixer amp should be used.
11110 static int alc262_check_volbit(hda_nid_t nid)
11114 else if (nid == 0x16)
11120 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11121 const char *pfx, int *vbits)
11126 vbit = alc262_check_volbit(nid);
11129 if (*vbits & vbit) /* a volume control for this mixer already there */
11133 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11135 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11136 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11139 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11147 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11149 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11150 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11153 /* add playback controls from the parsed DAC table */
11154 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11155 const struct auto_pin_cfg *cfg)
11161 spec->multiout.num_dacs = 1; /* only use one dac */
11162 spec->multiout.dac_nids = spec->private_dac_nids;
11163 spec->multiout.dac_nids[0] = 2;
11165 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11167 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11171 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11174 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11177 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11181 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11182 alc262_check_volbit(cfg->speaker_pins[0]) |
11183 alc262_check_volbit(cfg->hp_pins[0]);
11184 if (vbits == 1 || vbits == 2)
11185 pfx = "Master"; /* only one mixer is used */
11186 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11191 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11194 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11198 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11205 #define alc262_auto_create_input_ctls \
11206 alc880_auto_create_input_ctls
11209 * generic initialization of ADC, input mixers and output mixers
11211 static struct hda_verb alc262_volume_init_verbs[] = {
11213 * Unmute ADC0-2 and set the default input to mic-in
11215 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11216 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11217 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11218 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11219 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11220 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11222 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11224 * Note: PASD motherboards uses the Line In 2 as the input for
11225 * front panel mic (mic 2)
11227 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11235 * Set up output mixers (0x0c - 0x0f)
11237 /* set vol=0 to output mixers */
11238 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11239 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11240 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11242 /* set up input amps for analog loopback */
11243 /* Amp Indices: DAC = 0, mixer = 1 */
11244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11245 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11246 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11247 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11248 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11249 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11251 /* FIXME: use matrix-type input source selection */
11252 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11253 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11255 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11256 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11257 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11262 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11272 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11274 * Unmute ADC0-2 and set the default input to mic-in
11276 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11278 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11279 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11280 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11281 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11283 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11285 * Note: PASD motherboards uses the Line In 2 as the input for
11286 * front panel mic (mic 2)
11288 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11298 * Set up output mixers (0x0c - 0x0e)
11300 /* set vol=0 to output mixers */
11301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11303 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11305 /* set up input amps for analog loopback */
11306 /* Amp Indices: DAC = 0, mixer = 1 */
11307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11314 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11316 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11318 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11321 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11322 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11326 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11327 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11328 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11330 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11331 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11332 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11333 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11334 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11335 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11338 /* FIXME: use matrix-type input source selection */
11339 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11340 /* Input mixer1: only unmute Mic */
11341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11344 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11348 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11349 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11351 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11352 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11353 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11354 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11355 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11356 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11357 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11368 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11371 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11376 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11378 * Unmute ADC0-2 and set the default input to mic-in
11380 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11382 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11383 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11384 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11385 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11387 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11389 * Note: PASD motherboards uses the Line In 2 as the input for front
11390 * panel mic (mic 2)
11392 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11393 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11394 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11395 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11396 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11402 * Set up output mixers (0x0c - 0x0e)
11404 /* set vol=0 to output mixers */
11405 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11406 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11409 /* set up input amps for analog loopback */
11410 /* Amp Indices: DAC = 0, mixer = 1 */
11411 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11412 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11413 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11414 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11415 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11416 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11420 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11421 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11422 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11423 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11424 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11425 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11427 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11430 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11431 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11433 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11434 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11435 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11436 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11437 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11438 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11440 /* FIXME: use matrix-type input source selection */
11441 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11442 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11443 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11444 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11445 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11447 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11448 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11451 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11452 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11453 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11454 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11456 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11461 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11464 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11467 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11472 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11476 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11478 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11479 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11481 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11483 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11484 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11485 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11490 #ifdef CONFIG_SND_HDA_POWER_SAVE
11491 #define alc262_loopbacks alc880_loopbacks
11494 /* pcm configuration: identical with ALC880 */
11495 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11496 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11497 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11498 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11501 * BIOS auto configuration
11503 static int alc262_parse_auto_config(struct hda_codec *codec)
11505 struct alc_spec *spec = codec->spec;
11507 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11509 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11513 if (!spec->autocfg.line_outs) {
11514 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11515 spec->multiout.max_channels = 2;
11516 spec->no_analog = 1;
11519 return 0; /* can't find valid BIOS pin config */
11521 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11524 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11528 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11531 if (spec->autocfg.dig_outs) {
11532 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11533 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11535 if (spec->autocfg.dig_in_pin)
11536 spec->dig_in_nid = ALC262_DIGIN_NID;
11538 if (spec->kctls.list)
11539 add_mixer(spec, spec->kctls.list);
11541 add_verb(spec, alc262_volume_init_verbs);
11542 spec->num_mux_defs = 1;
11543 spec->input_mux = &spec->private_imux[0];
11545 err = alc_auto_add_mic_boost(codec);
11549 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11554 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11555 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11556 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11557 #define alc262_auto_init_input_src alc882_auto_init_input_src
11560 /* init callback for auto-configuration model -- overriding the default init */
11561 static void alc262_auto_init(struct hda_codec *codec)
11563 struct alc_spec *spec = codec->spec;
11564 alc262_auto_init_multi_out(codec);
11565 alc262_auto_init_hp_out(codec);
11566 alc262_auto_init_analog_input(codec);
11567 alc262_auto_init_input_src(codec);
11568 if (spec->unsol_event)
11569 alc_inithook(codec);
11573 * configuration and preset
11575 static const char *alc262_models[ALC262_MODEL_LAST] = {
11576 [ALC262_BASIC] = "basic",
11577 [ALC262_HIPPO] = "hippo",
11578 [ALC262_HIPPO_1] = "hippo_1",
11579 [ALC262_FUJITSU] = "fujitsu",
11580 [ALC262_HP_BPC] = "hp-bpc",
11581 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11582 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11583 [ALC262_HP_RP5700] = "hp-rp5700",
11584 [ALC262_BENQ_ED8] = "benq",
11585 [ALC262_BENQ_T31] = "benq-t31",
11586 [ALC262_SONY_ASSAMD] = "sony-assamd",
11587 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11588 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11589 [ALC262_ULTRA] = "ultra",
11590 [ALC262_LENOVO_3000] = "lenovo-3000",
11591 [ALC262_NEC] = "nec",
11592 [ALC262_TYAN] = "tyan",
11593 [ALC262_AUTO] = "auto",
11596 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11597 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11598 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11599 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11601 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11603 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11605 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11606 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11607 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11608 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11609 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11610 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11611 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11612 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11613 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11614 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11615 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11616 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11617 ALC262_HP_TC_T5735),
11618 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11619 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11620 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11621 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11622 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11623 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11624 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11625 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11626 #if 0 /* disable the quirk since model=auto works better in recent versions */
11627 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11628 ALC262_SONY_ASSAMD),
11630 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11631 ALC262_TOSHIBA_RX1),
11632 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11633 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11634 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11635 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11636 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11638 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11639 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11640 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11641 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11642 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11646 static struct alc_config_preset alc262_presets[] = {
11648 .mixers = { alc262_base_mixer },
11649 .init_verbs = { alc262_init_verbs },
11650 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11651 .dac_nids = alc262_dac_nids,
11653 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11654 .channel_mode = alc262_modes,
11655 .input_mux = &alc262_capture_source,
11658 .mixers = { alc262_hippo_mixer },
11659 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11660 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11661 .dac_nids = alc262_dac_nids,
11663 .dig_out_nid = ALC262_DIGOUT_NID,
11664 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11665 .channel_mode = alc262_modes,
11666 .input_mux = &alc262_capture_source,
11667 .unsol_event = alc262_hippo_unsol_event,
11668 .setup = alc262_hippo_setup,
11669 .init_hook = alc262_hippo_automute,
11671 [ALC262_HIPPO_1] = {
11672 .mixers = { alc262_hippo1_mixer },
11673 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11674 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11675 .dac_nids = alc262_dac_nids,
11677 .dig_out_nid = ALC262_DIGOUT_NID,
11678 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11679 .channel_mode = alc262_modes,
11680 .input_mux = &alc262_capture_source,
11681 .unsol_event = alc262_hippo_unsol_event,
11682 .setup = alc262_hippo1_setup,
11683 .init_hook = alc262_hippo_automute,
11685 [ALC262_FUJITSU] = {
11686 .mixers = { alc262_fujitsu_mixer },
11687 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11688 alc262_fujitsu_unsol_verbs },
11689 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11690 .dac_nids = alc262_dac_nids,
11692 .dig_out_nid = ALC262_DIGOUT_NID,
11693 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11694 .channel_mode = alc262_modes,
11695 .input_mux = &alc262_fujitsu_capture_source,
11696 .unsol_event = alc262_fujitsu_unsol_event,
11697 .init_hook = alc262_fujitsu_init_hook,
11699 [ALC262_HP_BPC] = {
11700 .mixers = { alc262_HP_BPC_mixer },
11701 .init_verbs = { alc262_HP_BPC_init_verbs },
11702 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11703 .dac_nids = alc262_dac_nids,
11705 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11706 .channel_mode = alc262_modes,
11707 .input_mux = &alc262_HP_capture_source,
11708 .unsol_event = alc262_hp_bpc_unsol_event,
11709 .init_hook = alc262_hp_bpc_automute,
11711 [ALC262_HP_BPC_D7000_WF] = {
11712 .mixers = { alc262_HP_BPC_WildWest_mixer },
11713 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11714 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11715 .dac_nids = alc262_dac_nids,
11717 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11718 .channel_mode = alc262_modes,
11719 .input_mux = &alc262_HP_D7000_capture_source,
11720 .unsol_event = alc262_hp_wildwest_unsol_event,
11721 .init_hook = alc262_hp_wildwest_automute,
11723 [ALC262_HP_BPC_D7000_WL] = {
11724 .mixers = { alc262_HP_BPC_WildWest_mixer,
11725 alc262_HP_BPC_WildWest_option_mixer },
11726 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11727 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11728 .dac_nids = alc262_dac_nids,
11730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11731 .channel_mode = alc262_modes,
11732 .input_mux = &alc262_HP_D7000_capture_source,
11733 .unsol_event = alc262_hp_wildwest_unsol_event,
11734 .init_hook = alc262_hp_wildwest_automute,
11736 [ALC262_HP_TC_T5735] = {
11737 .mixers = { alc262_hp_t5735_mixer },
11738 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11739 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11740 .dac_nids = alc262_dac_nids,
11742 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11743 .channel_mode = alc262_modes,
11744 .input_mux = &alc262_capture_source,
11745 .unsol_event = alc_automute_amp_unsol_event,
11746 .setup = alc262_hp_t5735_setup,
11747 .init_hook = alc_automute_amp,
11749 [ALC262_HP_RP5700] = {
11750 .mixers = { alc262_hp_rp5700_mixer },
11751 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11752 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11753 .dac_nids = alc262_dac_nids,
11754 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11755 .channel_mode = alc262_modes,
11756 .input_mux = &alc262_hp_rp5700_capture_source,
11758 [ALC262_BENQ_ED8] = {
11759 .mixers = { alc262_base_mixer },
11760 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11761 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11762 .dac_nids = alc262_dac_nids,
11764 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11765 .channel_mode = alc262_modes,
11766 .input_mux = &alc262_capture_source,
11768 [ALC262_SONY_ASSAMD] = {
11769 .mixers = { alc262_sony_mixer },
11770 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11771 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11772 .dac_nids = alc262_dac_nids,
11774 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11775 .channel_mode = alc262_modes,
11776 .input_mux = &alc262_capture_source,
11777 .unsol_event = alc262_hippo_unsol_event,
11778 .setup = alc262_hippo_setup,
11779 .init_hook = alc262_hippo_automute,
11781 [ALC262_BENQ_T31] = {
11782 .mixers = { alc262_benq_t31_mixer },
11783 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11784 alc_hp15_unsol_verbs },
11785 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11786 .dac_nids = alc262_dac_nids,
11788 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11789 .channel_mode = alc262_modes,
11790 .input_mux = &alc262_capture_source,
11791 .unsol_event = alc262_hippo_unsol_event,
11792 .setup = alc262_hippo_setup,
11793 .init_hook = alc262_hippo_automute,
11796 .mixers = { alc262_ultra_mixer },
11797 .cap_mixer = alc262_ultra_capture_mixer,
11798 .init_verbs = { alc262_ultra_verbs },
11799 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11800 .dac_nids = alc262_dac_nids,
11801 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11802 .channel_mode = alc262_modes,
11803 .input_mux = &alc262_ultra_capture_source,
11804 .adc_nids = alc262_adc_nids, /* ADC0 */
11805 .capsrc_nids = alc262_capsrc_nids,
11806 .num_adc_nids = 1, /* single ADC */
11807 .unsol_event = alc262_ultra_unsol_event,
11808 .init_hook = alc262_ultra_automute,
11810 [ALC262_LENOVO_3000] = {
11811 .mixers = { alc262_lenovo_3000_mixer },
11812 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11813 alc262_lenovo_3000_unsol_verbs,
11814 alc262_lenovo_3000_init_verbs },
11815 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11816 .dac_nids = alc262_dac_nids,
11818 .dig_out_nid = ALC262_DIGOUT_NID,
11819 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11820 .channel_mode = alc262_modes,
11821 .input_mux = &alc262_fujitsu_capture_source,
11822 .unsol_event = alc262_lenovo_3000_unsol_event,
11825 .mixers = { alc262_nec_mixer },
11826 .init_verbs = { alc262_nec_verbs },
11827 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11828 .dac_nids = alc262_dac_nids,
11830 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11831 .channel_mode = alc262_modes,
11832 .input_mux = &alc262_capture_source,
11834 [ALC262_TOSHIBA_S06] = {
11835 .mixers = { alc262_toshiba_s06_mixer },
11836 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11837 alc262_eapd_verbs },
11838 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11839 .capsrc_nids = alc262_dmic_capsrc_nids,
11840 .dac_nids = alc262_dac_nids,
11841 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11842 .num_adc_nids = 1, /* single ADC */
11843 .dig_out_nid = ALC262_DIGOUT_NID,
11844 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11845 .channel_mode = alc262_modes,
11846 .unsol_event = alc_sku_unsol_event,
11847 .setup = alc262_toshiba_s06_setup,
11848 .init_hook = alc_inithook,
11850 [ALC262_TOSHIBA_RX1] = {
11851 .mixers = { alc262_toshiba_rx1_mixer },
11852 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11853 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11854 .dac_nids = alc262_dac_nids,
11856 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11857 .channel_mode = alc262_modes,
11858 .input_mux = &alc262_capture_source,
11859 .unsol_event = alc262_hippo_unsol_event,
11860 .setup = alc262_hippo_setup,
11861 .init_hook = alc262_hippo_automute,
11864 .mixers = { alc262_tyan_mixer },
11865 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11866 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11867 .dac_nids = alc262_dac_nids,
11869 .dig_out_nid = ALC262_DIGOUT_NID,
11870 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11871 .channel_mode = alc262_modes,
11872 .input_mux = &alc262_capture_source,
11873 .unsol_event = alc_automute_amp_unsol_event,
11874 .setup = alc262_tyan_setup,
11875 .init_hook = alc_automute_amp,
11879 static int patch_alc262(struct hda_codec *codec)
11881 struct alc_spec *spec;
11885 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11889 codec->spec = spec;
11891 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11896 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11897 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11898 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11899 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11903 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11905 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11909 if (board_config < 0) {
11910 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11912 board_config = ALC262_AUTO;
11915 if (board_config == ALC262_AUTO) {
11916 /* automatic parse from the BIOS config */
11917 err = alc262_parse_auto_config(codec);
11923 "hda_codec: Cannot set up configuration "
11924 "from BIOS. Using base mode...\n");
11925 board_config = ALC262_BASIC;
11929 if (!spec->no_analog) {
11930 err = snd_hda_attach_beep_device(codec, 0x1);
11937 if (board_config != ALC262_AUTO)
11938 setup_preset(codec, &alc262_presets[board_config]);
11940 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11941 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11943 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11944 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11946 if (!spec->adc_nids && spec->input_mux) {
11948 /* check whether the digital-mic has to be supported */
11949 for (i = 0; i < spec->input_mux->num_items; i++) {
11950 if (spec->input_mux->items[i].index >= 9)
11953 if (i < spec->input_mux->num_items) {
11954 /* use only ADC0 */
11955 spec->adc_nids = alc262_dmic_adc_nids;
11956 spec->num_adc_nids = 1;
11957 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11959 /* all analog inputs */
11960 /* check whether NID 0x07 is valid */
11961 unsigned int wcap = get_wcaps(codec, 0x07);
11964 wcap = get_wcaps_type(wcap);
11965 if (wcap != AC_WID_AUD_IN) {
11966 spec->adc_nids = alc262_adc_nids_alt;
11967 spec->num_adc_nids =
11968 ARRAY_SIZE(alc262_adc_nids_alt);
11969 spec->capsrc_nids = alc262_capsrc_nids_alt;
11971 spec->adc_nids = alc262_adc_nids;
11972 spec->num_adc_nids =
11973 ARRAY_SIZE(alc262_adc_nids);
11974 spec->capsrc_nids = alc262_capsrc_nids;
11978 if (!spec->cap_mixer && !spec->no_analog)
11979 set_capture_mixer(codec);
11980 if (!spec->no_analog)
11981 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11983 spec->vmaster_nid = 0x0c;
11985 codec->patch_ops = alc_patch_ops;
11986 if (board_config == ALC262_AUTO)
11987 spec->init_hook = alc262_auto_init;
11988 #ifdef CONFIG_SND_HDA_POWER_SAVE
11989 if (!spec->loopback.amplist)
11990 spec->loopback.amplist = alc262_loopbacks;
11992 codec->proc_widget_hook = print_realtek_coef;
11998 * ALC268 channel source setting (2 channel)
12000 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12001 #define alc268_modes alc260_modes
12003 static hda_nid_t alc268_dac_nids[2] = {
12008 static hda_nid_t alc268_adc_nids[2] = {
12013 static hda_nid_t alc268_adc_nids_alt[1] = {
12018 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12020 static struct snd_kcontrol_new alc268_base_mixer[] = {
12021 /* output mixer control */
12022 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12023 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12024 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12025 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12026 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12027 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12028 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12032 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12033 /* output mixer control */
12034 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12035 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12036 ALC262_HIPPO_MASTER_SWITCH,
12037 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12038 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12039 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12043 /* bind Beep switches of both NID 0x0f and 0x10 */
12044 static struct hda_bind_ctls alc268_bind_beep_sw = {
12045 .ops = &snd_hda_bind_sw,
12047 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12048 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12053 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12054 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12055 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12059 static struct hda_verb alc268_eapd_verbs[] = {
12060 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12061 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12065 /* Toshiba specific */
12066 static struct hda_verb alc268_toshiba_verbs[] = {
12067 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12071 /* Acer specific */
12072 /* bind volumes of both NID 0x02 and 0x03 */
12073 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12074 .ops = &snd_hda_bind_vol,
12076 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12077 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12082 /* mute/unmute internal speaker according to the hp jack and mute state */
12083 static void alc268_acer_automute(struct hda_codec *codec, int force)
12085 struct alc_spec *spec = codec->spec;
12088 if (force || !spec->sense_updated) {
12089 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12090 spec->sense_updated = 1;
12092 if (spec->jack_present)
12093 mute = HDA_AMP_MUTE; /* mute internal speaker */
12094 else /* unmute internal speaker if necessary */
12095 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12096 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12097 HDA_AMP_MUTE, mute);
12101 /* bind hp and internal speaker mute (with plug check) */
12102 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12103 struct snd_ctl_elem_value *ucontrol)
12105 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12106 long *valp = ucontrol->value.integer.value;
12109 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12111 alc268_acer_automute(codec, 0);
12115 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12116 /* output mixer control */
12117 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12120 .name = "Master Playback Switch",
12121 .info = snd_hda_mixer_amp_switch_info,
12122 .get = snd_hda_mixer_amp_switch_get,
12123 .put = alc268_acer_master_sw_put,
12124 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12126 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12130 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12131 /* output mixer control */
12132 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12135 .name = "Master Playback Switch",
12136 .info = snd_hda_mixer_amp_switch_info,
12137 .get = snd_hda_mixer_amp_switch_get,
12138 .put = alc268_acer_master_sw_put,
12139 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12141 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12142 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12143 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12147 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12148 /* output mixer control */
12149 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12151 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12152 .name = "Master Playback Switch",
12153 .info = snd_hda_mixer_amp_switch_info,
12154 .get = snd_hda_mixer_amp_switch_get,
12155 .put = alc268_acer_master_sw_put,
12156 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12158 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12159 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12163 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12164 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12166 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12167 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12168 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12169 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12173 static struct hda_verb alc268_acer_verbs[] = {
12174 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12175 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12177 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12178 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12179 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12180 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12184 /* unsolicited event for HP jack sensing */
12185 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12186 #define alc268_toshiba_setup alc262_hippo_setup
12187 #define alc268_toshiba_automute alc262_hippo_automute
12189 static void alc268_acer_unsol_event(struct hda_codec *codec,
12192 if ((res >> 26) != ALC880_HP_EVENT)
12194 alc268_acer_automute(codec, 1);
12197 static void alc268_acer_init_hook(struct hda_codec *codec)
12199 alc268_acer_automute(codec, 1);
12202 /* toggle speaker-output according to the hp-jack state */
12203 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12205 unsigned int present;
12206 unsigned char bits;
12208 present = snd_hda_jack_detect(codec, 0x15);
12209 bits = present ? AMP_IN_MUTE(0) : 0;
12210 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12211 AMP_IN_MUTE(0), bits);
12212 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12213 AMP_IN_MUTE(0), bits);
12216 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12219 switch (res >> 26) {
12220 case ALC880_HP_EVENT:
12221 alc268_aspire_one_speaker_automute(codec);
12223 case ALC880_MIC_EVENT:
12224 alc_mic_automute(codec);
12229 static void alc268_acer_lc_setup(struct hda_codec *codec)
12231 struct alc_spec *spec = codec->spec;
12232 spec->ext_mic.pin = 0x18;
12233 spec->ext_mic.mux_idx = 0;
12234 spec->int_mic.pin = 0x12;
12235 spec->int_mic.mux_idx = 6;
12236 spec->auto_mic = 1;
12239 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12241 alc268_aspire_one_speaker_automute(codec);
12242 alc_mic_automute(codec);
12245 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12246 /* output mixer control */
12247 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12248 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12249 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12250 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12251 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12252 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12256 static struct hda_verb alc268_dell_verbs[] = {
12257 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12259 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12260 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12264 /* mute/unmute internal speaker according to the hp jack and mute state */
12265 static void alc268_dell_setup(struct hda_codec *codec)
12267 struct alc_spec *spec = codec->spec;
12269 spec->autocfg.hp_pins[0] = 0x15;
12270 spec->autocfg.speaker_pins[0] = 0x14;
12271 spec->ext_mic.pin = 0x18;
12272 spec->ext_mic.mux_idx = 0;
12273 spec->int_mic.pin = 0x19;
12274 spec->int_mic.mux_idx = 1;
12275 spec->auto_mic = 1;
12278 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12279 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12280 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12281 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12282 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12283 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12284 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12285 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12286 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12290 static struct hda_verb alc267_quanta_il1_verbs[] = {
12291 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12292 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12296 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12298 struct alc_spec *spec = codec->spec;
12299 spec->autocfg.hp_pins[0] = 0x15;
12300 spec->autocfg.speaker_pins[0] = 0x14;
12301 spec->ext_mic.pin = 0x18;
12302 spec->ext_mic.mux_idx = 0;
12303 spec->int_mic.pin = 0x19;
12304 spec->int_mic.mux_idx = 1;
12305 spec->auto_mic = 1;
12309 * generic initialization of ADC, input mixers and output mixers
12311 static struct hda_verb alc268_base_init_verbs[] = {
12312 /* Unmute DAC0-1 and set vol = 0 */
12313 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12314 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12317 * Set up output mixers (0x0c - 0x0e)
12319 /* set vol=0 to output mixers */
12320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12321 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12323 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12324 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12327 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12328 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12329 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12330 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12332 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12333 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12335 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12336 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12337 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12338 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12339 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12341 /* set PCBEEP vol = 0, mute connections */
12342 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12343 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12344 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12346 /* Unmute Selector 23h,24h and set the default input to mic-in */
12348 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12350 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12357 * generic initialization of ADC, input mixers and output mixers
12359 static struct hda_verb alc268_volume_init_verbs[] = {
12360 /* set output DAC */
12361 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12362 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12364 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12365 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12366 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12367 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12368 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12371 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12372 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12375 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12377 /* set PCBEEP vol = 0, mute connections */
12378 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12379 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12380 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12385 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12386 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12387 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12391 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12392 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12393 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12398 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12399 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12400 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12401 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12402 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12407 static struct hda_input_mux alc268_capture_source = {
12411 { "Front Mic", 0x1 },
12417 static struct hda_input_mux alc268_acer_capture_source = {
12421 { "Internal Mic", 0x1 },
12426 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12430 { "Internal Mic", 0x6 },
12435 #ifdef CONFIG_SND_DEBUG
12436 static struct snd_kcontrol_new alc268_test_mixer[] = {
12437 /* Volume widgets */
12438 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12439 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12440 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12441 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12442 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12443 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12444 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12445 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12446 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12447 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12448 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12449 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12450 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12451 /* The below appears problematic on some hardwares */
12452 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12453 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12454 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12455 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12456 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12458 /* Modes for retasking pin widgets */
12459 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12460 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12461 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12462 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12464 /* Controls for GPIO pins, assuming they are configured as outputs */
12465 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12466 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12467 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12468 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12470 /* Switches to allow the digital SPDIF output pin to be enabled.
12471 * The ALC268 does not have an SPDIF input.
12473 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12475 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12476 * this output to turn on an external amplifier.
12478 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12479 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12485 /* create input playback/capture controls for the given pin */
12486 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12487 const char *ctlname, int idx)
12503 if (spec->multiout.dac_nids[0] != dac &&
12504 spec->multiout.dac_nids[1] != dac) {
12505 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12506 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12510 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12514 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12515 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12517 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12518 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12524 /* add playback controls from the parsed DAC table */
12525 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12526 const struct auto_pin_cfg *cfg)
12531 spec->multiout.dac_nids = spec->private_dac_nids;
12533 nid = cfg->line_out_pins[0];
12536 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12540 err = alc268_new_analog_output(spec, nid, name, 0);
12545 nid = cfg->speaker_pins[0];
12547 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12548 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12552 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12556 nid = cfg->hp_pins[0];
12558 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12563 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12565 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12566 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12573 /* create playback/capture controls for input pins */
12574 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12575 const struct auto_pin_cfg *cfg)
12577 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12580 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12581 hda_nid_t nid, int pin_type)
12585 alc_set_pin_output(codec, nid, pin_type);
12586 if (nid == 0x14 || nid == 0x16)
12590 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12593 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12595 struct alc_spec *spec = codec->spec;
12596 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12598 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12599 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12603 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12605 struct alc_spec *spec = codec->spec;
12608 pin = spec->autocfg.hp_pins[0];
12610 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12611 pin = spec->autocfg.speaker_pins[0];
12613 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12616 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12618 struct alc_spec *spec = codec->spec;
12619 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12620 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12621 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12622 unsigned int dac_vol1, dac_vol2;
12624 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12625 snd_hda_codec_write(codec, speaker_nid, 0,
12626 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12627 /* mute mixer inputs from 0x1d */
12628 snd_hda_codec_write(codec, 0x0f, 0,
12629 AC_VERB_SET_AMP_GAIN_MUTE,
12631 snd_hda_codec_write(codec, 0x10, 0,
12632 AC_VERB_SET_AMP_GAIN_MUTE,
12635 /* unmute mixer inputs from 0x1d */
12636 snd_hda_codec_write(codec, 0x0f, 0,
12637 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12638 snd_hda_codec_write(codec, 0x10, 0,
12639 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12642 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12643 if (line_nid == 0x14)
12644 dac_vol2 = AMP_OUT_ZERO;
12645 else if (line_nid == 0x15)
12646 dac_vol1 = AMP_OUT_ZERO;
12647 if (hp_nid == 0x14)
12648 dac_vol2 = AMP_OUT_ZERO;
12649 else if (hp_nid == 0x15)
12650 dac_vol1 = AMP_OUT_ZERO;
12651 if (line_nid != 0x16 || hp_nid != 0x16 ||
12652 spec->autocfg.line_out_pins[1] != 0x16 ||
12653 spec->autocfg.line_out_pins[2] != 0x16)
12654 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12656 snd_hda_codec_write(codec, 0x02, 0,
12657 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12658 snd_hda_codec_write(codec, 0x03, 0,
12659 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12662 /* pcm configuration: identical with ALC880 */
12663 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12664 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12665 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12666 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12669 * BIOS auto configuration
12671 static int alc268_parse_auto_config(struct hda_codec *codec)
12673 struct alc_spec *spec = codec->spec;
12675 static hda_nid_t alc268_ignore[] = { 0 };
12677 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12681 if (!spec->autocfg.line_outs) {
12682 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12683 spec->multiout.max_channels = 2;
12684 spec->no_analog = 1;
12687 return 0; /* can't find valid BIOS pin config */
12689 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12692 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12696 spec->multiout.max_channels = 2;
12699 /* digital only support output */
12700 if (spec->autocfg.dig_outs) {
12701 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12702 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12704 if (spec->kctls.list)
12705 add_mixer(spec, spec->kctls.list);
12707 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12708 add_mixer(spec, alc268_beep_mixer);
12710 add_verb(spec, alc268_volume_init_verbs);
12711 spec->num_mux_defs = 2;
12712 spec->input_mux = &spec->private_imux[0];
12714 err = alc_auto_add_mic_boost(codec);
12718 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12723 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12725 /* init callback for auto-configuration model -- overriding the default init */
12726 static void alc268_auto_init(struct hda_codec *codec)
12728 struct alc_spec *spec = codec->spec;
12729 alc268_auto_init_multi_out(codec);
12730 alc268_auto_init_hp_out(codec);
12731 alc268_auto_init_mono_speaker_out(codec);
12732 alc268_auto_init_analog_input(codec);
12733 if (spec->unsol_event)
12734 alc_inithook(codec);
12738 * configuration and preset
12740 static const char *alc268_models[ALC268_MODEL_LAST] = {
12741 [ALC267_QUANTA_IL1] = "quanta-il1",
12742 [ALC268_3ST] = "3stack",
12743 [ALC268_TOSHIBA] = "toshiba",
12744 [ALC268_ACER] = "acer",
12745 [ALC268_ACER_DMIC] = "acer-dmic",
12746 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12747 [ALC268_DELL] = "dell",
12748 [ALC268_ZEPTO] = "zepto",
12749 #ifdef CONFIG_SND_DEBUG
12750 [ALC268_TEST] = "test",
12752 [ALC268_AUTO] = "auto",
12755 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12756 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12757 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12758 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12759 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12760 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12761 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12762 ALC268_ACER_ASPIRE_ONE),
12763 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12764 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12765 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12766 /* almost compatible with toshiba but with optional digital outs;
12767 * auto-probing seems working fine
12769 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12771 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12772 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12773 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12774 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12775 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12776 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12780 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12781 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12782 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12783 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12784 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12789 static struct alc_config_preset alc268_presets[] = {
12790 [ALC267_QUANTA_IL1] = {
12791 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12792 alc268_capture_nosrc_mixer },
12793 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12794 alc267_quanta_il1_verbs },
12795 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12796 .dac_nids = alc268_dac_nids,
12797 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12798 .adc_nids = alc268_adc_nids_alt,
12800 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12801 .channel_mode = alc268_modes,
12802 .unsol_event = alc_sku_unsol_event,
12803 .setup = alc267_quanta_il1_setup,
12804 .init_hook = alc_inithook,
12807 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12808 alc268_beep_mixer },
12809 .init_verbs = { alc268_base_init_verbs },
12810 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12811 .dac_nids = alc268_dac_nids,
12812 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12813 .adc_nids = alc268_adc_nids_alt,
12814 .capsrc_nids = alc268_capsrc_nids,
12816 .dig_out_nid = ALC268_DIGOUT_NID,
12817 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12818 .channel_mode = alc268_modes,
12819 .input_mux = &alc268_capture_source,
12821 [ALC268_TOSHIBA] = {
12822 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12823 alc268_beep_mixer },
12824 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12825 alc268_toshiba_verbs },
12826 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12827 .dac_nids = alc268_dac_nids,
12828 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12829 .adc_nids = alc268_adc_nids_alt,
12830 .capsrc_nids = alc268_capsrc_nids,
12832 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12833 .channel_mode = alc268_modes,
12834 .input_mux = &alc268_capture_source,
12835 .unsol_event = alc268_toshiba_unsol_event,
12836 .setup = alc268_toshiba_setup,
12837 .init_hook = alc268_toshiba_automute,
12840 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12841 alc268_beep_mixer },
12842 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12843 alc268_acer_verbs },
12844 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12845 .dac_nids = alc268_dac_nids,
12846 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12847 .adc_nids = alc268_adc_nids_alt,
12848 .capsrc_nids = alc268_capsrc_nids,
12850 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12851 .channel_mode = alc268_modes,
12852 .input_mux = &alc268_acer_capture_source,
12853 .unsol_event = alc268_acer_unsol_event,
12854 .init_hook = alc268_acer_init_hook,
12856 [ALC268_ACER_DMIC] = {
12857 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12858 alc268_beep_mixer },
12859 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12860 alc268_acer_verbs },
12861 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12862 .dac_nids = alc268_dac_nids,
12863 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12864 .adc_nids = alc268_adc_nids_alt,
12865 .capsrc_nids = alc268_capsrc_nids,
12867 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12868 .channel_mode = alc268_modes,
12869 .input_mux = &alc268_acer_dmic_capture_source,
12870 .unsol_event = alc268_acer_unsol_event,
12871 .init_hook = alc268_acer_init_hook,
12873 [ALC268_ACER_ASPIRE_ONE] = {
12874 .mixers = { alc268_acer_aspire_one_mixer,
12876 alc268_capture_nosrc_mixer },
12877 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12878 alc268_acer_aspire_one_verbs },
12879 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12880 .dac_nids = alc268_dac_nids,
12881 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12882 .adc_nids = alc268_adc_nids_alt,
12883 .capsrc_nids = alc268_capsrc_nids,
12885 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12886 .channel_mode = alc268_modes,
12887 .unsol_event = alc268_acer_lc_unsol_event,
12888 .setup = alc268_acer_lc_setup,
12889 .init_hook = alc268_acer_lc_init_hook,
12892 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12893 alc268_capture_nosrc_mixer },
12894 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12895 alc268_dell_verbs },
12896 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12897 .dac_nids = alc268_dac_nids,
12898 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12899 .adc_nids = alc268_adc_nids_alt,
12900 .capsrc_nids = alc268_capsrc_nids,
12902 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12903 .channel_mode = alc268_modes,
12904 .unsol_event = alc_sku_unsol_event,
12905 .setup = alc268_dell_setup,
12906 .init_hook = alc_inithook,
12909 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12910 alc268_beep_mixer },
12911 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12912 alc268_toshiba_verbs },
12913 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12914 .dac_nids = alc268_dac_nids,
12915 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12916 .adc_nids = alc268_adc_nids_alt,
12917 .capsrc_nids = alc268_capsrc_nids,
12919 .dig_out_nid = ALC268_DIGOUT_NID,
12920 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12921 .channel_mode = alc268_modes,
12922 .input_mux = &alc268_capture_source,
12923 .setup = alc268_toshiba_setup,
12924 .init_hook = alc268_toshiba_automute,
12926 #ifdef CONFIG_SND_DEBUG
12928 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12929 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12930 alc268_volume_init_verbs },
12931 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12932 .dac_nids = alc268_dac_nids,
12933 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12934 .adc_nids = alc268_adc_nids_alt,
12935 .capsrc_nids = alc268_capsrc_nids,
12937 .dig_out_nid = ALC268_DIGOUT_NID,
12938 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12939 .channel_mode = alc268_modes,
12940 .input_mux = &alc268_capture_source,
12945 static int patch_alc268(struct hda_codec *codec)
12947 struct alc_spec *spec;
12949 int i, has_beep, err;
12951 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12955 codec->spec = spec;
12957 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12961 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12962 board_config = snd_hda_check_board_codec_sid_config(codec,
12963 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12965 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12966 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12968 board_config = ALC268_AUTO;
12971 if (board_config == ALC268_AUTO) {
12972 /* automatic parse from the BIOS config */
12973 err = alc268_parse_auto_config(codec);
12979 "hda_codec: Cannot set up configuration "
12980 "from BIOS. Using base mode...\n");
12981 board_config = ALC268_3ST;
12985 if (board_config != ALC268_AUTO)
12986 setup_preset(codec, &alc268_presets[board_config]);
12988 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12989 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12990 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12992 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12995 for (i = 0; i < spec->num_mixers; i++) {
12996 if (spec->mixers[i] == alc268_beep_mixer) {
13003 err = snd_hda_attach_beep_device(codec, 0x1);
13008 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13009 /* override the amp caps for beep generator */
13010 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13011 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13012 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13013 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13014 (0 << AC_AMPCAP_MUTE_SHIFT));
13017 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13018 /* check whether NID 0x07 is valid */
13019 unsigned int wcap = get_wcaps(codec, 0x07);
13022 spec->capsrc_nids = alc268_capsrc_nids;
13024 wcap = get_wcaps_type(wcap);
13025 if (spec->auto_mic ||
13026 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13027 spec->adc_nids = alc268_adc_nids_alt;
13028 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13029 if (spec->auto_mic)
13030 fixup_automic_adc(codec);
13031 if (spec->auto_mic || spec->input_mux->num_items == 1)
13032 add_mixer(spec, alc268_capture_nosrc_mixer);
13034 add_mixer(spec, alc268_capture_alt_mixer);
13036 spec->adc_nids = alc268_adc_nids;
13037 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13038 add_mixer(spec, alc268_capture_mixer);
13040 /* set default input source */
13041 for (i = 0; i < spec->num_adc_nids; i++)
13042 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13043 0, AC_VERB_SET_CONNECT_SEL,
13044 i < spec->num_mux_defs ?
13045 spec->input_mux[i].items[0].index :
13046 spec->input_mux->items[0].index);
13049 spec->vmaster_nid = 0x02;
13051 codec->patch_ops = alc_patch_ops;
13052 if (board_config == ALC268_AUTO)
13053 spec->init_hook = alc268_auto_init;
13055 codec->proc_widget_hook = print_realtek_coef;
13061 * ALC269 channel source setting (2 channel)
13063 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13065 #define alc269_dac_nids alc260_dac_nids
13067 static hda_nid_t alc269_adc_nids[1] = {
13072 static hda_nid_t alc269_capsrc_nids[1] = {
13076 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13080 #define alc269_modes alc260_modes
13081 #define alc269_capture_source alc880_lg_lw_capture_source
13083 static struct snd_kcontrol_new alc269_base_mixer[] = {
13084 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13085 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13086 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13087 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13088 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13089 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13090 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13091 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13092 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13093 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13095 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13099 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13100 /* output mixer control */
13101 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13103 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13104 .name = "Master Playback Switch",
13105 .info = snd_hda_mixer_amp_switch_info,
13106 .get = snd_hda_mixer_amp_switch_get,
13107 .put = alc268_acer_master_sw_put,
13108 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13112 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13113 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13114 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13115 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13119 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13120 /* output mixer control */
13121 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13123 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13124 .name = "Master Playback Switch",
13125 .info = snd_hda_mixer_amp_switch_info,
13126 .get = snd_hda_mixer_amp_switch_get,
13127 .put = alc268_acer_master_sw_put,
13128 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13130 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13132 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13133 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13134 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13135 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13136 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13137 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13138 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13142 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13143 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13144 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13145 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13146 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13150 /* capture mixer elements */
13151 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13152 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13153 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13154 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13159 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13161 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13162 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13163 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13165 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13166 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13167 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13171 static struct hda_verb alc269_lifebook_verbs[] = {
13172 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13173 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13174 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13176 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13177 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13178 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13179 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13180 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13181 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13185 /* toggle speaker-output according to the hp-jack state */
13186 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13188 unsigned int present;
13189 unsigned char bits;
13191 present = snd_hda_jack_detect(codec, 0x15);
13192 bits = present ? AMP_IN_MUTE(0) : 0;
13193 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13194 AMP_IN_MUTE(0), bits);
13195 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13196 AMP_IN_MUTE(0), bits);
13198 snd_hda_codec_write(codec, 0x20, 0,
13199 AC_VERB_SET_COEF_INDEX, 0x0c);
13200 snd_hda_codec_write(codec, 0x20, 0,
13201 AC_VERB_SET_PROC_COEF, 0x680);
13203 snd_hda_codec_write(codec, 0x20, 0,
13204 AC_VERB_SET_COEF_INDEX, 0x0c);
13205 snd_hda_codec_write(codec, 0x20, 0,
13206 AC_VERB_SET_PROC_COEF, 0x480);
13209 /* toggle speaker-output according to the hp-jacks state */
13210 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13212 unsigned int present;
13213 unsigned char bits;
13215 /* Check laptop headphone socket */
13216 present = snd_hda_jack_detect(codec, 0x15);
13218 /* Check port replicator headphone socket */
13219 present |= snd_hda_jack_detect(codec, 0x1a);
13221 bits = present ? AMP_IN_MUTE(0) : 0;
13222 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13223 AMP_IN_MUTE(0), bits);
13224 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13225 AMP_IN_MUTE(0), bits);
13227 snd_hda_codec_write(codec, 0x20, 0,
13228 AC_VERB_SET_COEF_INDEX, 0x0c);
13229 snd_hda_codec_write(codec, 0x20, 0,
13230 AC_VERB_SET_PROC_COEF, 0x680);
13232 snd_hda_codec_write(codec, 0x20, 0,
13233 AC_VERB_SET_COEF_INDEX, 0x0c);
13234 snd_hda_codec_write(codec, 0x20, 0,
13235 AC_VERB_SET_PROC_COEF, 0x480);
13238 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13240 unsigned int present_laptop;
13241 unsigned int present_dock;
13243 present_laptop = snd_hda_jack_detect(codec, 0x18);
13244 present_dock = snd_hda_jack_detect(codec, 0x1b);
13246 /* Laptop mic port overrides dock mic port, design decision */
13248 snd_hda_codec_write(codec, 0x23, 0,
13249 AC_VERB_SET_CONNECT_SEL, 0x3);
13250 if (present_laptop)
13251 snd_hda_codec_write(codec, 0x23, 0,
13252 AC_VERB_SET_CONNECT_SEL, 0x0);
13253 if (!present_dock && !present_laptop)
13254 snd_hda_codec_write(codec, 0x23, 0,
13255 AC_VERB_SET_CONNECT_SEL, 0x1);
13258 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13261 switch (res >> 26) {
13262 case ALC880_HP_EVENT:
13263 alc269_quanta_fl1_speaker_automute(codec);
13265 case ALC880_MIC_EVENT:
13266 alc_mic_automute(codec);
13271 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13274 if ((res >> 26) == ALC880_HP_EVENT)
13275 alc269_lifebook_speaker_automute(codec);
13276 if ((res >> 26) == ALC880_MIC_EVENT)
13277 alc269_lifebook_mic_autoswitch(codec);
13280 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13282 struct alc_spec *spec = codec->spec;
13283 spec->ext_mic.pin = 0x18;
13284 spec->ext_mic.mux_idx = 0;
13285 spec->int_mic.pin = 0x19;
13286 spec->int_mic.mux_idx = 1;
13287 spec->auto_mic = 1;
13290 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13292 alc269_quanta_fl1_speaker_automute(codec);
13293 alc_mic_automute(codec);
13296 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13298 alc269_lifebook_speaker_automute(codec);
13299 alc269_lifebook_mic_autoswitch(codec);
13302 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13303 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13304 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13305 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13306 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13307 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13308 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13309 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13313 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13314 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13315 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13316 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13317 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13318 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13323 /* toggle speaker-output according to the hp-jack state */
13324 static void alc269_speaker_automute(struct hda_codec *codec)
13326 struct alc_spec *spec = codec->spec;
13327 unsigned int nid = spec->autocfg.hp_pins[0];
13328 unsigned int present;
13329 unsigned char bits;
13331 present = snd_hda_jack_detect(codec, nid);
13332 bits = present ? AMP_IN_MUTE(0) : 0;
13333 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13334 AMP_IN_MUTE(0), bits);
13335 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13336 AMP_IN_MUTE(0), bits);
13339 /* unsolicited event for HP jack sensing */
13340 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13343 switch (res >> 26) {
13344 case ALC880_HP_EVENT:
13345 alc269_speaker_automute(codec);
13347 case ALC880_MIC_EVENT:
13348 alc_mic_automute(codec);
13353 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13355 struct alc_spec *spec = codec->spec;
13356 spec->ext_mic.pin = 0x18;
13357 spec->ext_mic.mux_idx = 0;
13358 spec->int_mic.pin = 0x12;
13359 spec->int_mic.mux_idx = 5;
13360 spec->auto_mic = 1;
13363 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13365 struct alc_spec *spec = codec->spec;
13366 spec->ext_mic.pin = 0x18;
13367 spec->ext_mic.mux_idx = 0;
13368 spec->int_mic.pin = 0x19;
13369 spec->int_mic.mux_idx = 1;
13370 spec->auto_mic = 1;
13373 static void alc269_eeepc_inithook(struct hda_codec *codec)
13375 alc269_speaker_automute(codec);
13376 alc_mic_automute(codec);
13380 * generic initialization of ADC, input mixers and output mixers
13382 static struct hda_verb alc269_init_verbs[] = {
13384 * Unmute ADC0 and set the default input to mic-in
13386 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13388 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13389 * analog-loopback mixer widget
13390 * Note: PASD motherboards uses the Line In 2 as the input for
13391 * front panel mic (mic 2)
13393 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13394 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13395 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13396 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13401 * Set up output mixers (0x0c - 0x0e)
13403 /* set vol=0 to output mixers */
13404 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13405 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13407 /* set up input amps for analog loopback */
13408 /* Amp Indices: DAC = 0, mixer = 1 */
13409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13412 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13413 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13414 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13416 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13417 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13418 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13419 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13420 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13421 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13422 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13424 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13425 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13426 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13427 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13428 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13429 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13430 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13432 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13433 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13435 /* FIXME: use matrix-type input source selection */
13436 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13437 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13441 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13444 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13445 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13449 #define alc269_auto_create_multi_out_ctls \
13450 alc268_auto_create_multi_out_ctls
13451 #define alc269_auto_create_input_ctls \
13452 alc268_auto_create_input_ctls
13454 #ifdef CONFIG_SND_HDA_POWER_SAVE
13455 #define alc269_loopbacks alc880_loopbacks
13458 /* pcm configuration: identical with ALC880 */
13459 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13460 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13461 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13462 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13464 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13468 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13469 /* NID is set in alc_build_pcms */
13471 .open = alc880_playback_pcm_open,
13472 .prepare = alc880_playback_pcm_prepare,
13473 .cleanup = alc880_playback_pcm_cleanup
13477 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13481 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13482 /* NID is set in alc_build_pcms */
13486 * BIOS auto configuration
13488 static int alc269_parse_auto_config(struct hda_codec *codec)
13490 struct alc_spec *spec = codec->spec;
13492 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13494 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13499 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13502 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13506 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13508 if (spec->autocfg.dig_outs)
13509 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13511 if (spec->kctls.list)
13512 add_mixer(spec, spec->kctls.list);
13514 add_verb(spec, alc269_init_verbs);
13515 spec->num_mux_defs = 1;
13516 spec->input_mux = &spec->private_imux[0];
13517 /* set default input source */
13518 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13519 0, AC_VERB_SET_CONNECT_SEL,
13520 spec->input_mux->items[0].index);
13522 err = alc_auto_add_mic_boost(codec);
13526 if (!spec->cap_mixer && !spec->no_analog)
13527 set_capture_mixer(codec);
13529 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13534 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13535 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13536 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13539 /* init callback for auto-configuration model -- overriding the default init */
13540 static void alc269_auto_init(struct hda_codec *codec)
13542 struct alc_spec *spec = codec->spec;
13543 alc269_auto_init_multi_out(codec);
13544 alc269_auto_init_hp_out(codec);
13545 alc269_auto_init_analog_input(codec);
13546 if (spec->unsol_event)
13547 alc_inithook(codec);
13551 * configuration and preset
13553 static const char *alc269_models[ALC269_MODEL_LAST] = {
13554 [ALC269_BASIC] = "basic",
13555 [ALC269_QUANTA_FL1] = "quanta",
13556 [ALC269_ASUS_AMIC] = "asus-amic",
13557 [ALC269_ASUS_DMIC] = "asus-dmic",
13558 [ALC269_FUJITSU] = "fujitsu",
13559 [ALC269_LIFEBOOK] = "lifebook",
13560 [ALC269_AUTO] = "auto",
13563 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13564 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13565 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13567 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13568 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13569 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13570 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13571 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13572 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13573 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13574 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13575 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13576 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13577 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13578 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13579 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13580 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13581 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13582 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13583 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13584 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13585 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13586 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13587 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13588 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13589 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13590 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13591 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13592 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13593 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13594 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13595 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13597 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13599 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13600 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13601 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13602 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13606 static struct alc_config_preset alc269_presets[] = {
13608 .mixers = { alc269_base_mixer },
13609 .init_verbs = { alc269_init_verbs },
13610 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13611 .dac_nids = alc269_dac_nids,
13613 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13614 .channel_mode = alc269_modes,
13615 .input_mux = &alc269_capture_source,
13617 [ALC269_QUANTA_FL1] = {
13618 .mixers = { alc269_quanta_fl1_mixer },
13619 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13620 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13621 .dac_nids = alc269_dac_nids,
13623 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13624 .channel_mode = alc269_modes,
13625 .input_mux = &alc269_capture_source,
13626 .unsol_event = alc269_quanta_fl1_unsol_event,
13627 .setup = alc269_quanta_fl1_setup,
13628 .init_hook = alc269_quanta_fl1_init_hook,
13630 [ALC269_ASUS_AMIC] = {
13631 .mixers = { alc269_eeepc_mixer },
13632 .cap_mixer = alc269_epc_capture_mixer,
13633 .init_verbs = { alc269_init_verbs,
13634 alc269_eeepc_amic_init_verbs },
13635 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13636 .dac_nids = alc269_dac_nids,
13638 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13639 .channel_mode = alc269_modes,
13640 .unsol_event = alc269_eeepc_unsol_event,
13641 .setup = alc269_eeepc_amic_setup,
13642 .init_hook = alc269_eeepc_inithook,
13644 [ALC269_ASUS_DMIC] = {
13645 .mixers = { alc269_eeepc_mixer },
13646 .cap_mixer = alc269_epc_capture_mixer,
13647 .init_verbs = { alc269_init_verbs,
13648 alc269_eeepc_dmic_init_verbs },
13649 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13650 .dac_nids = alc269_dac_nids,
13652 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13653 .channel_mode = alc269_modes,
13654 .unsol_event = alc269_eeepc_unsol_event,
13655 .setup = alc269_eeepc_dmic_setup,
13656 .init_hook = alc269_eeepc_inithook,
13658 [ALC269_FUJITSU] = {
13659 .mixers = { alc269_fujitsu_mixer },
13660 .cap_mixer = alc269_epc_capture_mixer,
13661 .init_verbs = { alc269_init_verbs,
13662 alc269_eeepc_dmic_init_verbs },
13663 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13664 .dac_nids = alc269_dac_nids,
13666 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13667 .channel_mode = alc269_modes,
13668 .unsol_event = alc269_eeepc_unsol_event,
13669 .setup = alc269_eeepc_dmic_setup,
13670 .init_hook = alc269_eeepc_inithook,
13672 [ALC269_LIFEBOOK] = {
13673 .mixers = { alc269_lifebook_mixer },
13674 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13675 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13676 .dac_nids = alc269_dac_nids,
13678 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13679 .channel_mode = alc269_modes,
13680 .input_mux = &alc269_capture_source,
13681 .unsol_event = alc269_lifebook_unsol_event,
13682 .init_hook = alc269_lifebook_init_hook,
13686 static int patch_alc269(struct hda_codec *codec)
13688 struct alc_spec *spec;
13692 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13696 codec->spec = spec;
13698 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13700 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13701 kfree(codec->chip_name);
13702 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13703 if (!codec->chip_name) {
13709 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13713 if (board_config < 0) {
13714 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13716 board_config = ALC269_AUTO;
13719 if (board_config == ALC269_AUTO) {
13720 /* automatic parse from the BIOS config */
13721 err = alc269_parse_auto_config(codec);
13727 "hda_codec: Cannot set up configuration "
13728 "from BIOS. Using base mode...\n");
13729 board_config = ALC269_BASIC;
13733 err = snd_hda_attach_beep_device(codec, 0x1);
13739 if (board_config != ALC269_AUTO)
13740 setup_preset(codec, &alc269_presets[board_config]);
13742 if (codec->subsystem_id == 0x17aa3bf8) {
13743 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13744 * fix the sample rate of analog I/O to 44.1kHz
13746 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13747 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13749 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13750 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13752 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13753 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13755 spec->adc_nids = alc269_adc_nids;
13756 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13757 spec->capsrc_nids = alc269_capsrc_nids;
13758 if (!spec->cap_mixer)
13759 set_capture_mixer(codec);
13760 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13762 spec->vmaster_nid = 0x02;
13764 codec->patch_ops = alc_patch_ops;
13765 if (board_config == ALC269_AUTO)
13766 spec->init_hook = alc269_auto_init;
13767 #ifdef CONFIG_SND_HDA_POWER_SAVE
13768 if (!spec->loopback.amplist)
13769 spec->loopback.amplist = alc269_loopbacks;
13771 codec->proc_widget_hook = print_realtek_coef;
13777 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13781 * set the path ways for 2 channel output
13782 * need to set the codec line out and mic 1 pin widgets to inputs
13784 static struct hda_verb alc861_threestack_ch2_init[] = {
13785 /* set pin widget 1Ah (line in) for input */
13786 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13787 /* set pin widget 18h (mic1/2) for input, for mic also enable
13790 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13792 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13794 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13795 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13801 * need to set the codec line out and mic 1 pin widgets to outputs
13803 static struct hda_verb alc861_threestack_ch6_init[] = {
13804 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13805 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13806 /* set pin widget 18h (mic1) for output (CLFE)*/
13807 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13809 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13810 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13812 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13814 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13815 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13820 static struct hda_channel_mode alc861_threestack_modes[2] = {
13821 { 2, alc861_threestack_ch2_init },
13822 { 6, alc861_threestack_ch6_init },
13824 /* Set mic1 as input and unmute the mixer */
13825 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13826 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13827 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13830 /* Set mic1 as output and mute mixer */
13831 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13832 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13833 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13837 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13838 { 2, alc861_uniwill_m31_ch2_init },
13839 { 4, alc861_uniwill_m31_ch4_init },
13842 /* Set mic1 and line-in as input and unmute the mixer */
13843 static struct hda_verb alc861_asus_ch2_init[] = {
13844 /* set pin widget 1Ah (line in) for input */
13845 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13846 /* set pin widget 18h (mic1/2) for input, for mic also enable
13849 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13851 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13853 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13854 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13858 /* Set mic1 nad line-in as output and mute mixer */
13859 static struct hda_verb alc861_asus_ch6_init[] = {
13860 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13861 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13862 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13863 /* set pin widget 18h (mic1) for output (CLFE)*/
13864 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13865 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13866 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13867 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13869 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13871 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13872 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13877 static struct hda_channel_mode alc861_asus_modes[2] = {
13878 { 2, alc861_asus_ch2_init },
13879 { 6, alc861_asus_ch6_init },
13884 static struct snd_kcontrol_new alc861_base_mixer[] = {
13885 /* output mixer control */
13886 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13887 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13888 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13889 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13890 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13892 /*Input mixer control */
13893 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13894 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13895 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13896 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13897 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13898 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13900 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13901 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13902 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13907 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13908 /* output mixer control */
13909 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13910 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13911 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13912 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13913 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13915 /* Input mixer control */
13916 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13917 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13918 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13919 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13920 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13921 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13922 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13923 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13924 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13928 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13929 .name = "Channel Mode",
13930 .info = alc_ch_mode_info,
13931 .get = alc_ch_mode_get,
13932 .put = alc_ch_mode_put,
13933 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13938 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13939 /* output mixer control */
13940 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13942 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13947 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13948 /* output mixer control */
13949 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13950 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13951 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13952 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13953 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13955 /* Input mixer control */
13956 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13957 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13958 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13959 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13960 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13961 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13962 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13963 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13964 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13968 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13969 .name = "Channel Mode",
13970 .info = alc_ch_mode_info,
13971 .get = alc_ch_mode_get,
13972 .put = alc_ch_mode_put,
13973 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13978 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13979 /* output mixer control */
13980 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13981 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13982 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13983 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13984 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13986 /* Input mixer control */
13987 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13988 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13989 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13990 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13991 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13992 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13994 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13996 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14000 .name = "Channel Mode",
14001 .info = alc_ch_mode_info,
14002 .get = alc_ch_mode_get,
14003 .put = alc_ch_mode_put,
14004 .private_value = ARRAY_SIZE(alc861_asus_modes),
14009 /* additional mixer */
14010 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14011 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14012 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14017 * generic initialization of ADC, input mixers and output mixers
14019 static struct hda_verb alc861_base_init_verbs[] = {
14021 * Unmute ADC0 and set the default input to mic-in
14023 /* port-A for surround (rear panel) */
14024 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14025 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14026 /* port-B for mic-in (rear panel) with vref */
14027 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14028 /* port-C for line-in (rear panel) */
14029 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14030 /* port-D for Front */
14031 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14032 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14033 /* port-E for HP out (front panel) */
14034 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14035 /* route front PCM to HP */
14036 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14037 /* port-F for mic-in (front panel) with vref */
14038 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14039 /* port-G for CLFE (rear panel) */
14040 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14041 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14042 /* port-H for side (rear panel) */
14043 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14044 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14046 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14047 /* route front mic to ADC1*/
14048 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14049 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14051 /* Unmute DAC0~3 & spdif out*/
14052 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14053 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14054 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14055 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14058 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14059 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14060 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14061 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14062 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14064 /* Unmute Stereo Mixer 15 */
14065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14070 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14071 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14072 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14073 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14074 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14075 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14077 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14078 /* hp used DAC 3 (Front) */
14079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14080 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14085 static struct hda_verb alc861_threestack_init_verbs[] = {
14087 * Unmute ADC0 and set the default input to mic-in
14089 /* port-A for surround (rear panel) */
14090 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14091 /* port-B for mic-in (rear panel) with vref */
14092 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14093 /* port-C for line-in (rear panel) */
14094 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14095 /* port-D for Front */
14096 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14097 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14098 /* port-E for HP out (front panel) */
14099 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14100 /* route front PCM to HP */
14101 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14102 /* port-F for mic-in (front panel) with vref */
14103 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14104 /* port-G for CLFE (rear panel) */
14105 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14106 /* port-H for side (rear panel) */
14107 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14109 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14110 /* route front mic to ADC1*/
14111 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14112 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14113 /* Unmute DAC0~3 & spdif out*/
14114 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14115 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14116 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14117 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14120 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14121 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14122 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14123 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14124 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14126 /* Unmute Stereo Mixer 15 */
14127 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14128 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14130 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14132 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14133 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14134 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14135 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14136 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14137 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14138 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14139 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14140 /* hp used DAC 3 (Front) */
14141 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14142 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14146 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14148 * Unmute ADC0 and set the default input to mic-in
14150 /* port-A for surround (rear panel) */
14151 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14152 /* port-B for mic-in (rear panel) with vref */
14153 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14154 /* port-C for line-in (rear panel) */
14155 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14156 /* port-D for Front */
14157 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14158 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14159 /* port-E for HP out (front panel) */
14160 /* this has to be set to VREF80 */
14161 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14162 /* route front PCM to HP */
14163 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14164 /* port-F for mic-in (front panel) with vref */
14165 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14166 /* port-G for CLFE (rear panel) */
14167 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14168 /* port-H for side (rear panel) */
14169 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14171 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14172 /* route front mic to ADC1*/
14173 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14174 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14175 /* Unmute DAC0~3 & spdif out*/
14176 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14177 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14178 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14179 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14182 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14183 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14184 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14185 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14186 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14188 /* Unmute Stereo Mixer 15 */
14189 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14190 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14191 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14192 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14194 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14195 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14196 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14197 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14198 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14199 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14200 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14201 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14202 /* hp used DAC 3 (Front) */
14203 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14204 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14208 static struct hda_verb alc861_asus_init_verbs[] = {
14210 * Unmute ADC0 and set the default input to mic-in
14212 /* port-A for surround (rear panel)
14213 * according to codec#0 this is the HP jack
14215 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14216 /* route front PCM to HP */
14217 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14218 /* port-B for mic-in (rear panel) with vref */
14219 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14220 /* port-C for line-in (rear panel) */
14221 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14222 /* port-D for Front */
14223 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14224 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14225 /* port-E for HP out (front panel) */
14226 /* this has to be set to VREF80 */
14227 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14228 /* route front PCM to HP */
14229 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14230 /* port-F for mic-in (front panel) with vref */
14231 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14232 /* port-G for CLFE (rear panel) */
14233 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14234 /* port-H for side (rear panel) */
14235 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14237 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14238 /* route front mic to ADC1*/
14239 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14241 /* Unmute DAC0~3 & spdif out*/
14242 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14243 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14244 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14245 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14247 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14248 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14249 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14250 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14251 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14253 /* Unmute Stereo Mixer 15 */
14254 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14259 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14260 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14261 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14262 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14263 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14264 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14265 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14266 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14267 /* hp used DAC 3 (Front) */
14268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14269 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14273 /* additional init verbs for ASUS laptops */
14274 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14275 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14276 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14281 * generic initialization of ADC, input mixers and output mixers
14283 static struct hda_verb alc861_auto_init_verbs[] = {
14285 * Unmute ADC0 and set the default input to mic-in
14287 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14288 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14290 /* Unmute DAC0~3 & spdif out*/
14291 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14292 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14293 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14294 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14295 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14297 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14298 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14299 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14300 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14301 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14303 /* Unmute Stereo Mixer 15 */
14304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14309 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14310 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14311 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14312 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14313 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14314 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14315 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14316 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14318 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14321 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14322 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14323 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14324 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14325 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14327 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14332 static struct hda_verb alc861_toshiba_init_verbs[] = {
14333 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14338 /* toggle speaker-output according to the hp-jack state */
14339 static void alc861_toshiba_automute(struct hda_codec *codec)
14341 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14343 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14344 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14345 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14346 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14349 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14352 if ((res >> 26) == ALC880_HP_EVENT)
14353 alc861_toshiba_automute(codec);
14356 /* pcm configuration: identical with ALC880 */
14357 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14358 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14359 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14360 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14363 #define ALC861_DIGOUT_NID 0x07
14365 static struct hda_channel_mode alc861_8ch_modes[1] = {
14369 static hda_nid_t alc861_dac_nids[4] = {
14370 /* front, surround, clfe, side */
14371 0x03, 0x06, 0x05, 0x04
14374 static hda_nid_t alc660_dac_nids[3] = {
14375 /* front, clfe, surround */
14379 static hda_nid_t alc861_adc_nids[1] = {
14384 static struct hda_input_mux alc861_capture_source = {
14388 { "Front Mic", 0x3 },
14395 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14397 struct alc_spec *spec = codec->spec;
14398 hda_nid_t mix, srcs[5];
14401 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14403 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14406 for (i = 0; i < num; i++) {
14408 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14409 if (type != AC_WID_AUD_OUT)
14411 for (j = 0; j < spec->multiout.num_dacs; j++)
14412 if (spec->multiout.dac_nids[j] == srcs[i])
14414 if (j >= spec->multiout.num_dacs)
14420 /* fill in the dac_nids table from the parsed pin configuration */
14421 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14422 const struct auto_pin_cfg *cfg)
14424 struct alc_spec *spec = codec->spec;
14426 hda_nid_t nid, dac;
14428 spec->multiout.dac_nids = spec->private_dac_nids;
14429 for (i = 0; i < cfg->line_outs; i++) {
14430 nid = cfg->line_out_pins[i];
14431 dac = alc861_look_for_dac(codec, nid);
14434 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14439 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14440 hda_nid_t nid, unsigned int chs)
14442 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14443 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14446 /* add playback controls from the parsed DAC table */
14447 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14448 const struct auto_pin_cfg *cfg)
14450 struct alc_spec *spec = codec->spec;
14451 static const char *chname[4] = {
14452 "Front", "Surround", NULL /*CLFE*/, "Side"
14457 if (cfg->line_outs == 1) {
14458 const char *pfx = NULL;
14461 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14464 nid = spec->multiout.dac_nids[0];
14465 return alc861_create_out_sw(codec, pfx, nid, 3);
14469 for (i = 0; i < cfg->line_outs; i++) {
14470 nid = spec->multiout.dac_nids[i];
14475 err = alc861_create_out_sw(codec, "Center", nid, 1);
14478 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14482 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14490 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14492 struct alc_spec *spec = codec->spec;
14499 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14500 nid = alc861_look_for_dac(codec, pin);
14502 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14505 spec->multiout.hp_nid = nid;
14511 /* create playback/capture controls for input pins */
14512 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14513 const struct auto_pin_cfg *cfg)
14515 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14518 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14520 int pin_type, hda_nid_t dac)
14522 hda_nid_t mix, srcs[5];
14525 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14527 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14529 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14531 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14534 for (i = 0; i < num; i++) {
14536 if (srcs[i] == dac || srcs[i] == 0x15)
14537 mute = AMP_IN_UNMUTE(i);
14539 mute = AMP_IN_MUTE(i);
14540 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14545 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14547 struct alc_spec *spec = codec->spec;
14550 for (i = 0; i < spec->autocfg.line_outs; i++) {
14551 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14552 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14554 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14555 spec->multiout.dac_nids[i]);
14559 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14561 struct alc_spec *spec = codec->spec;
14563 if (spec->autocfg.hp_outs)
14564 alc861_auto_set_output_and_unmute(codec,
14565 spec->autocfg.hp_pins[0],
14567 spec->multiout.hp_nid);
14568 if (spec->autocfg.speaker_outs)
14569 alc861_auto_set_output_and_unmute(codec,
14570 spec->autocfg.speaker_pins[0],
14572 spec->multiout.dac_nids[0]);
14575 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14577 struct alc_spec *spec = codec->spec;
14580 for (i = 0; i < AUTO_PIN_LAST; i++) {
14581 hda_nid_t nid = spec->autocfg.input_pins[i];
14582 if (nid >= 0x0c && nid <= 0x11)
14583 alc_set_input_pin(codec, nid, i);
14587 /* parse the BIOS configuration and set up the alc_spec */
14588 /* return 1 if successful, 0 if the proper config is not found,
14589 * or a negative error code
14591 static int alc861_parse_auto_config(struct hda_codec *codec)
14593 struct alc_spec *spec = codec->spec;
14595 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14597 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14601 if (!spec->autocfg.line_outs)
14602 return 0; /* can't find valid BIOS pin config */
14604 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14607 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14610 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14613 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14617 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14619 if (spec->autocfg.dig_outs)
14620 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14622 if (spec->kctls.list)
14623 add_mixer(spec, spec->kctls.list);
14625 add_verb(spec, alc861_auto_init_verbs);
14627 spec->num_mux_defs = 1;
14628 spec->input_mux = &spec->private_imux[0];
14630 spec->adc_nids = alc861_adc_nids;
14631 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14632 set_capture_mixer(codec);
14634 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14639 /* additional initialization for auto-configuration model */
14640 static void alc861_auto_init(struct hda_codec *codec)
14642 struct alc_spec *spec = codec->spec;
14643 alc861_auto_init_multi_out(codec);
14644 alc861_auto_init_hp_out(codec);
14645 alc861_auto_init_analog_input(codec);
14646 if (spec->unsol_event)
14647 alc_inithook(codec);
14650 #ifdef CONFIG_SND_HDA_POWER_SAVE
14651 static struct hda_amp_list alc861_loopbacks[] = {
14652 { 0x15, HDA_INPUT, 0 },
14653 { 0x15, HDA_INPUT, 1 },
14654 { 0x15, HDA_INPUT, 2 },
14655 { 0x15, HDA_INPUT, 3 },
14662 * configuration and preset
14664 static const char *alc861_models[ALC861_MODEL_LAST] = {
14665 [ALC861_3ST] = "3stack",
14666 [ALC660_3ST] = "3stack-660",
14667 [ALC861_3ST_DIG] = "3stack-dig",
14668 [ALC861_6ST_DIG] = "6stack-dig",
14669 [ALC861_UNIWILL_M31] = "uniwill-m31",
14670 [ALC861_TOSHIBA] = "toshiba",
14671 [ALC861_ASUS] = "asus",
14672 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14673 [ALC861_AUTO] = "auto",
14676 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14677 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14678 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14679 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14680 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14681 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14682 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14683 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14684 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14685 * Any other models that need this preset?
14687 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14688 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14689 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14690 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14691 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14692 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14693 /* FIXME: the below seems conflict */
14694 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14695 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14696 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14700 static struct alc_config_preset alc861_presets[] = {
14702 .mixers = { alc861_3ST_mixer },
14703 .init_verbs = { alc861_threestack_init_verbs },
14704 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14705 .dac_nids = alc861_dac_nids,
14706 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14707 .channel_mode = alc861_threestack_modes,
14709 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14710 .adc_nids = alc861_adc_nids,
14711 .input_mux = &alc861_capture_source,
14713 [ALC861_3ST_DIG] = {
14714 .mixers = { alc861_base_mixer },
14715 .init_verbs = { alc861_threestack_init_verbs },
14716 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14717 .dac_nids = alc861_dac_nids,
14718 .dig_out_nid = ALC861_DIGOUT_NID,
14719 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14720 .channel_mode = alc861_threestack_modes,
14722 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14723 .adc_nids = alc861_adc_nids,
14724 .input_mux = &alc861_capture_source,
14726 [ALC861_6ST_DIG] = {
14727 .mixers = { alc861_base_mixer },
14728 .init_verbs = { alc861_base_init_verbs },
14729 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14730 .dac_nids = alc861_dac_nids,
14731 .dig_out_nid = ALC861_DIGOUT_NID,
14732 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14733 .channel_mode = alc861_8ch_modes,
14734 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14735 .adc_nids = alc861_adc_nids,
14736 .input_mux = &alc861_capture_source,
14739 .mixers = { alc861_3ST_mixer },
14740 .init_verbs = { alc861_threestack_init_verbs },
14741 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14742 .dac_nids = alc660_dac_nids,
14743 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14744 .channel_mode = alc861_threestack_modes,
14746 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14747 .adc_nids = alc861_adc_nids,
14748 .input_mux = &alc861_capture_source,
14750 [ALC861_UNIWILL_M31] = {
14751 .mixers = { alc861_uniwill_m31_mixer },
14752 .init_verbs = { alc861_uniwill_m31_init_verbs },
14753 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14754 .dac_nids = alc861_dac_nids,
14755 .dig_out_nid = ALC861_DIGOUT_NID,
14756 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14757 .channel_mode = alc861_uniwill_m31_modes,
14759 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14760 .adc_nids = alc861_adc_nids,
14761 .input_mux = &alc861_capture_source,
14763 [ALC861_TOSHIBA] = {
14764 .mixers = { alc861_toshiba_mixer },
14765 .init_verbs = { alc861_base_init_verbs,
14766 alc861_toshiba_init_verbs },
14767 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14768 .dac_nids = alc861_dac_nids,
14769 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14770 .channel_mode = alc883_3ST_2ch_modes,
14771 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14772 .adc_nids = alc861_adc_nids,
14773 .input_mux = &alc861_capture_source,
14774 .unsol_event = alc861_toshiba_unsol_event,
14775 .init_hook = alc861_toshiba_automute,
14778 .mixers = { alc861_asus_mixer },
14779 .init_verbs = { alc861_asus_init_verbs },
14780 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14781 .dac_nids = alc861_dac_nids,
14782 .dig_out_nid = ALC861_DIGOUT_NID,
14783 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14784 .channel_mode = alc861_asus_modes,
14787 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14788 .adc_nids = alc861_adc_nids,
14789 .input_mux = &alc861_capture_source,
14791 [ALC861_ASUS_LAPTOP] = {
14792 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14793 .init_verbs = { alc861_asus_init_verbs,
14794 alc861_asus_laptop_init_verbs },
14795 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14796 .dac_nids = alc861_dac_nids,
14797 .dig_out_nid = ALC861_DIGOUT_NID,
14798 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14799 .channel_mode = alc883_3ST_2ch_modes,
14801 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14802 .adc_nids = alc861_adc_nids,
14803 .input_mux = &alc861_capture_source,
14807 /* Pin config fixes */
14809 PINFIX_FSC_AMILO_PI1505,
14812 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14813 { 0x0b, 0x0221101f }, /* HP */
14814 { 0x0f, 0x90170310 }, /* speaker */
14818 static const struct alc_fixup alc861_fixups[] = {
14819 [PINFIX_FSC_AMILO_PI1505] = {
14820 .pins = alc861_fsc_amilo_pi1505_pinfix
14824 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14825 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14829 static int patch_alc861(struct hda_codec *codec)
14831 struct alc_spec *spec;
14835 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14839 codec->spec = spec;
14841 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14845 if (board_config < 0) {
14846 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14848 board_config = ALC861_AUTO;
14851 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14853 if (board_config == ALC861_AUTO) {
14854 /* automatic parse from the BIOS config */
14855 err = alc861_parse_auto_config(codec);
14861 "hda_codec: Cannot set up configuration "
14862 "from BIOS. Using base mode...\n");
14863 board_config = ALC861_3ST_DIG;
14867 err = snd_hda_attach_beep_device(codec, 0x23);
14873 if (board_config != ALC861_AUTO)
14874 setup_preset(codec, &alc861_presets[board_config]);
14876 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14877 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14879 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14880 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14882 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14884 spec->vmaster_nid = 0x03;
14886 codec->patch_ops = alc_patch_ops;
14887 if (board_config == ALC861_AUTO)
14888 spec->init_hook = alc861_auto_init;
14889 #ifdef CONFIG_SND_HDA_POWER_SAVE
14890 if (!spec->loopback.amplist)
14891 spec->loopback.amplist = alc861_loopbacks;
14893 codec->proc_widget_hook = print_realtek_coef;
14899 * ALC861-VD support
14903 * In addition, an independent DAC
14905 #define ALC861VD_DIGOUT_NID 0x06
14907 static hda_nid_t alc861vd_dac_nids[4] = {
14908 /* front, surr, clfe, side surr */
14909 0x02, 0x03, 0x04, 0x05
14912 /* dac_nids for ALC660vd are in a different order - according to
14913 * Realtek's driver.
14914 * This should probably result in a different mixer for 6stack models
14915 * of ALC660vd codecs, but for now there is only 3stack mixer
14916 * - and it is the same as in 861vd.
14917 * adc_nids in ALC660vd are (is) the same as in 861vd
14919 static hda_nid_t alc660vd_dac_nids[3] = {
14920 /* front, rear, clfe, rear_surr */
14924 static hda_nid_t alc861vd_adc_nids[1] = {
14929 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14932 /* FIXME: should be a matrix-type input source selection */
14933 static struct hda_input_mux alc861vd_capture_source = {
14937 { "Front Mic", 0x1 },
14943 static struct hda_input_mux alc861vd_dallas_capture_source = {
14946 { "Ext Mic", 0x0 },
14947 { "Int Mic", 0x1 },
14951 static struct hda_input_mux alc861vd_hp_capture_source = {
14954 { "Front Mic", 0x0 },
14955 { "ATAPI Mic", 0x1 },
14962 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14969 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14970 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14971 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14972 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14973 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14980 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14981 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14982 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14983 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14984 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14988 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14989 { 6, alc861vd_6stack_ch6_init },
14990 { 8, alc861vd_6stack_ch8_init },
14993 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14996 .name = "Channel Mode",
14997 .info = alc_ch_mode_info,
14998 .get = alc_ch_mode_get,
14999 .put = alc_ch_mode_put,
15004 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15005 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15007 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15008 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15009 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15011 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15012 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15014 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15016 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15018 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15019 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15021 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15022 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15024 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15026 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15030 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15031 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15032 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15034 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15035 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15037 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15038 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15043 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15044 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15045 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15047 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15050 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15051 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15053 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15054 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15055 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15057 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15058 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15060 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15061 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15066 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15067 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15068 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15069 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15071 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15073 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15074 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15075 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15077 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15078 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15079 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15081 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15082 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15087 /* Pin assignment: Speaker=0x14, HP = 0x15,
15088 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15090 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15091 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15092 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15093 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15094 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15095 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15096 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15097 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15098 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15099 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15100 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15104 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15105 * Front Mic=0x18, ATAPI Mic = 0x19,
15107 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15108 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15109 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15110 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15111 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15112 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15113 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15114 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15115 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15121 * generic initialization of ADC, input mixers and output mixers
15123 static struct hda_verb alc861vd_volume_init_verbs[] = {
15125 * Unmute ADC0 and set the default input to mic-in
15127 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15128 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15130 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15131 * the analog-loopback mixer widget
15133 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15140 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15141 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15142 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15143 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15144 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15147 * Set up output mixers (0x02 - 0x05)
15149 /* set vol=0 to output mixers */
15150 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15151 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15152 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15153 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15155 /* set up input amps for analog loopback */
15156 /* Amp Indices: DAC = 0, mixer = 1 */
15157 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15158 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15159 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15160 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15161 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15162 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15163 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15164 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15170 * 3-stack pin configuration:
15171 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15173 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15175 * Set pin mode and muting
15177 /* set front pin widgets 0x14 for output */
15178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15179 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15180 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15182 /* Mic (rear) pin: input vref at 80% */
15183 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15185 /* Front Mic pin: input vref at 80% */
15186 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15187 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15188 /* Line In pin: input */
15189 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15191 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15192 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15193 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15194 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15195 /* CD pin widget for input */
15196 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15202 * 6-stack pin configuration:
15204 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15206 * Set pin mode and muting
15208 /* set front pin widgets 0x14 for output */
15209 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15210 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15211 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15213 /* Rear Pin: output 1 (0x0d) */
15214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15215 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15216 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15217 /* CLFE Pin: output 2 (0x0e) */
15218 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15219 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15220 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15221 /* Side Pin: output 3 (0x0f) */
15222 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15223 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15224 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15226 /* Mic (rear) pin: input vref at 80% */
15227 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15228 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15229 /* Front Mic pin: input vref at 80% */
15230 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15231 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15232 /* Line In pin: input */
15233 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15234 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15235 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15236 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15237 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15238 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15239 /* CD pin widget for input */
15240 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15245 static struct hda_verb alc861vd_eapd_verbs[] = {
15246 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15250 static struct hda_verb alc660vd_eapd_verbs[] = {
15251 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15252 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15256 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15260 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15261 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15265 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15267 unsigned int present;
15268 unsigned char bits;
15270 present = snd_hda_jack_detect(codec, 0x18);
15271 bits = present ? HDA_AMP_MUTE : 0;
15273 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15274 HDA_AMP_MUTE, bits);
15277 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15279 struct alc_spec *spec = codec->spec;
15280 spec->autocfg.hp_pins[0] = 0x1b;
15281 spec->autocfg.speaker_pins[0] = 0x14;
15284 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15286 alc_automute_amp(codec);
15287 alc861vd_lenovo_mic_automute(codec);
15290 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15293 switch (res >> 26) {
15294 case ALC880_MIC_EVENT:
15295 alc861vd_lenovo_mic_automute(codec);
15298 alc_automute_amp_unsol_event(codec, res);
15303 static struct hda_verb alc861vd_dallas_verbs[] = {
15304 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15305 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15306 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15307 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15312 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15313 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15314 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15316 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15318 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15319 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15321 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15322 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15323 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15324 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15325 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15329 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15330 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15332 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15333 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15334 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15339 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15341 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15342 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15343 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15348 /* toggle speaker-output according to the hp-jack state */
15349 static void alc861vd_dallas_setup(struct hda_codec *codec)
15351 struct alc_spec *spec = codec->spec;
15353 spec->autocfg.hp_pins[0] = 0x15;
15354 spec->autocfg.speaker_pins[0] = 0x14;
15357 #ifdef CONFIG_SND_HDA_POWER_SAVE
15358 #define alc861vd_loopbacks alc880_loopbacks
15361 /* pcm configuration: identical with ALC880 */
15362 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15363 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15364 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15365 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15368 * configuration and preset
15370 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15371 [ALC660VD_3ST] = "3stack-660",
15372 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15373 [ALC660VD_ASUS_V1S] = "asus-v1s",
15374 [ALC861VD_3ST] = "3stack",
15375 [ALC861VD_3ST_DIG] = "3stack-digout",
15376 [ALC861VD_6ST_DIG] = "6stack-digout",
15377 [ALC861VD_LENOVO] = "lenovo",
15378 [ALC861VD_DALLAS] = "dallas",
15379 [ALC861VD_HP] = "hp",
15380 [ALC861VD_AUTO] = "auto",
15383 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15384 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15385 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15386 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15387 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15388 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15389 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15390 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15391 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15392 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15393 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15394 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15395 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15396 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15397 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15398 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15402 static struct alc_config_preset alc861vd_presets[] = {
15404 .mixers = { alc861vd_3st_mixer },
15405 .init_verbs = { alc861vd_volume_init_verbs,
15406 alc861vd_3stack_init_verbs },
15407 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15408 .dac_nids = alc660vd_dac_nids,
15409 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15410 .channel_mode = alc861vd_3stack_2ch_modes,
15411 .input_mux = &alc861vd_capture_source,
15413 [ALC660VD_3ST_DIG] = {
15414 .mixers = { alc861vd_3st_mixer },
15415 .init_verbs = { alc861vd_volume_init_verbs,
15416 alc861vd_3stack_init_verbs },
15417 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15418 .dac_nids = alc660vd_dac_nids,
15419 .dig_out_nid = ALC861VD_DIGOUT_NID,
15420 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15421 .channel_mode = alc861vd_3stack_2ch_modes,
15422 .input_mux = &alc861vd_capture_source,
15425 .mixers = { alc861vd_3st_mixer },
15426 .init_verbs = { alc861vd_volume_init_verbs,
15427 alc861vd_3stack_init_verbs },
15428 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15429 .dac_nids = alc861vd_dac_nids,
15430 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15431 .channel_mode = alc861vd_3stack_2ch_modes,
15432 .input_mux = &alc861vd_capture_source,
15434 [ALC861VD_3ST_DIG] = {
15435 .mixers = { alc861vd_3st_mixer },
15436 .init_verbs = { alc861vd_volume_init_verbs,
15437 alc861vd_3stack_init_verbs },
15438 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15439 .dac_nids = alc861vd_dac_nids,
15440 .dig_out_nid = ALC861VD_DIGOUT_NID,
15441 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15442 .channel_mode = alc861vd_3stack_2ch_modes,
15443 .input_mux = &alc861vd_capture_source,
15445 [ALC861VD_6ST_DIG] = {
15446 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15447 .init_verbs = { alc861vd_volume_init_verbs,
15448 alc861vd_6stack_init_verbs },
15449 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15450 .dac_nids = alc861vd_dac_nids,
15451 .dig_out_nid = ALC861VD_DIGOUT_NID,
15452 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15453 .channel_mode = alc861vd_6stack_modes,
15454 .input_mux = &alc861vd_capture_source,
15456 [ALC861VD_LENOVO] = {
15457 .mixers = { alc861vd_lenovo_mixer },
15458 .init_verbs = { alc861vd_volume_init_verbs,
15459 alc861vd_3stack_init_verbs,
15460 alc861vd_eapd_verbs,
15461 alc861vd_lenovo_unsol_verbs },
15462 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15463 .dac_nids = alc660vd_dac_nids,
15464 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15465 .channel_mode = alc861vd_3stack_2ch_modes,
15466 .input_mux = &alc861vd_capture_source,
15467 .unsol_event = alc861vd_lenovo_unsol_event,
15468 .setup = alc861vd_lenovo_setup,
15469 .init_hook = alc861vd_lenovo_init_hook,
15471 [ALC861VD_DALLAS] = {
15472 .mixers = { alc861vd_dallas_mixer },
15473 .init_verbs = { alc861vd_dallas_verbs },
15474 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15475 .dac_nids = alc861vd_dac_nids,
15476 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15477 .channel_mode = alc861vd_3stack_2ch_modes,
15478 .input_mux = &alc861vd_dallas_capture_source,
15479 .unsol_event = alc_automute_amp_unsol_event,
15480 .setup = alc861vd_dallas_setup,
15481 .init_hook = alc_automute_amp,
15484 .mixers = { alc861vd_hp_mixer },
15485 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15486 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15487 .dac_nids = alc861vd_dac_nids,
15488 .dig_out_nid = ALC861VD_DIGOUT_NID,
15489 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15490 .channel_mode = alc861vd_3stack_2ch_modes,
15491 .input_mux = &alc861vd_hp_capture_source,
15492 .unsol_event = alc_automute_amp_unsol_event,
15493 .setup = alc861vd_dallas_setup,
15494 .init_hook = alc_automute_amp,
15496 [ALC660VD_ASUS_V1S] = {
15497 .mixers = { alc861vd_lenovo_mixer },
15498 .init_verbs = { alc861vd_volume_init_verbs,
15499 alc861vd_3stack_init_verbs,
15500 alc861vd_eapd_verbs,
15501 alc861vd_lenovo_unsol_verbs },
15502 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15503 .dac_nids = alc660vd_dac_nids,
15504 .dig_out_nid = ALC861VD_DIGOUT_NID,
15505 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15506 .channel_mode = alc861vd_3stack_2ch_modes,
15507 .input_mux = &alc861vd_capture_source,
15508 .unsol_event = alc861vd_lenovo_unsol_event,
15509 .setup = alc861vd_lenovo_setup,
15510 .init_hook = alc861vd_lenovo_init_hook,
15515 * BIOS auto configuration
15517 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15518 const struct auto_pin_cfg *cfg)
15520 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15524 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15525 hda_nid_t nid, int pin_type, int dac_idx)
15527 alc_set_pin_output(codec, nid, pin_type);
15530 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15532 struct alc_spec *spec = codec->spec;
15535 for (i = 0; i <= HDA_SIDE; i++) {
15536 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15537 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15539 alc861vd_auto_set_output_and_unmute(codec, nid,
15545 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15547 struct alc_spec *spec = codec->spec;
15550 pin = spec->autocfg.hp_pins[0];
15551 if (pin) /* connect to front and use dac 0 */
15552 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15553 pin = spec->autocfg.speaker_pins[0];
15555 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15558 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15560 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15562 struct alc_spec *spec = codec->spec;
15565 for (i = 0; i < AUTO_PIN_LAST; i++) {
15566 hda_nid_t nid = spec->autocfg.input_pins[i];
15567 if (alc_is_input_pin(codec, nid)) {
15568 alc_set_input_pin(codec, nid, i);
15569 if (nid != ALC861VD_PIN_CD_NID &&
15570 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15571 snd_hda_codec_write(codec, nid, 0,
15572 AC_VERB_SET_AMP_GAIN_MUTE,
15578 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15580 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15581 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15583 /* add playback controls from the parsed DAC table */
15584 /* Based on ALC880 version. But ALC861VD has separate,
15585 * different NIDs for mute/unmute switch and volume control */
15586 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15587 const struct auto_pin_cfg *cfg)
15589 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15590 hda_nid_t nid_v, nid_s;
15593 for (i = 0; i < cfg->line_outs; i++) {
15594 if (!spec->multiout.dac_nids[i])
15596 nid_v = alc861vd_idx_to_mixer_vol(
15598 spec->multiout.dac_nids[i]));
15599 nid_s = alc861vd_idx_to_mixer_switch(
15601 spec->multiout.dac_nids[i]));
15605 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15607 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15611 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15613 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15617 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15619 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15623 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15625 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15631 if (cfg->line_outs == 1 &&
15632 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15639 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15640 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15644 if (cfg->line_outs == 1 &&
15645 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15647 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15648 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15657 /* add playback controls for speaker and HP outputs */
15658 /* Based on ALC880 version. But ALC861VD has separate,
15659 * different NIDs for mute/unmute switch and volume control */
15660 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15661 hda_nid_t pin, const char *pfx)
15663 hda_nid_t nid_v, nid_s;
15669 if (alc880_is_fixed_pin(pin)) {
15670 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15671 /* specify the DAC as the extra output */
15672 if (!spec->multiout.hp_nid)
15673 spec->multiout.hp_nid = nid_v;
15675 spec->multiout.extra_out_nid[0] = nid_v;
15676 /* control HP volume/switch on the output mixer amp */
15677 nid_v = alc861vd_idx_to_mixer_vol(
15678 alc880_fixed_pin_idx(pin));
15679 nid_s = alc861vd_idx_to_mixer_switch(
15680 alc880_fixed_pin_idx(pin));
15682 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15683 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15686 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15687 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15690 } else if (alc880_is_multi_pin(pin)) {
15691 /* set manual connection */
15692 /* we have only a switch on HP-out PIN */
15693 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15694 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15701 /* parse the BIOS configuration and set up the alc_spec
15702 * return 1 if successful, 0 if the proper config is not found,
15703 * or a negative error code
15704 * Based on ALC880 version - had to change it to override
15705 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15706 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15708 struct alc_spec *spec = codec->spec;
15710 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15712 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15716 if (!spec->autocfg.line_outs)
15717 return 0; /* can't find valid BIOS pin config */
15719 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15722 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15725 err = alc861vd_auto_create_extra_out(spec,
15726 spec->autocfg.speaker_pins[0],
15730 err = alc861vd_auto_create_extra_out(spec,
15731 spec->autocfg.hp_pins[0],
15735 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15739 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15741 if (spec->autocfg.dig_outs)
15742 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15744 if (spec->kctls.list)
15745 add_mixer(spec, spec->kctls.list);
15747 add_verb(spec, alc861vd_volume_init_verbs);
15749 spec->num_mux_defs = 1;
15750 spec->input_mux = &spec->private_imux[0];
15752 err = alc_auto_add_mic_boost(codec);
15756 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15761 /* additional initialization for auto-configuration model */
15762 static void alc861vd_auto_init(struct hda_codec *codec)
15764 struct alc_spec *spec = codec->spec;
15765 alc861vd_auto_init_multi_out(codec);
15766 alc861vd_auto_init_hp_out(codec);
15767 alc861vd_auto_init_analog_input(codec);
15768 alc861vd_auto_init_input_src(codec);
15769 if (spec->unsol_event)
15770 alc_inithook(codec);
15774 ALC660VD_FIX_ASUS_GPIO1
15778 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15779 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15780 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15781 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15785 static const struct alc_fixup alc861vd_fixups[] = {
15786 [ALC660VD_FIX_ASUS_GPIO1] = {
15787 .verbs = alc660vd_fix_asus_gpio1_verbs,
15791 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15792 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15796 static int patch_alc861vd(struct hda_codec *codec)
15798 struct alc_spec *spec;
15799 int err, board_config;
15801 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15805 codec->spec = spec;
15807 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15811 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15812 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15814 board_config = ALC861VD_AUTO;
15817 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15819 if (board_config == ALC861VD_AUTO) {
15820 /* automatic parse from the BIOS config */
15821 err = alc861vd_parse_auto_config(codec);
15827 "hda_codec: Cannot set up configuration "
15828 "from BIOS. Using base mode...\n");
15829 board_config = ALC861VD_3ST;
15833 err = snd_hda_attach_beep_device(codec, 0x23);
15839 if (board_config != ALC861VD_AUTO)
15840 setup_preset(codec, &alc861vd_presets[board_config]);
15842 if (codec->vendor_id == 0x10ec0660) {
15843 /* always turn on EAPD */
15844 add_verb(spec, alc660vd_eapd_verbs);
15847 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15848 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15850 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15851 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15853 if (!spec->adc_nids) {
15854 spec->adc_nids = alc861vd_adc_nids;
15855 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15857 if (!spec->capsrc_nids)
15858 spec->capsrc_nids = alc861vd_capsrc_nids;
15860 set_capture_mixer(codec);
15861 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15863 spec->vmaster_nid = 0x02;
15865 codec->patch_ops = alc_patch_ops;
15867 if (board_config == ALC861VD_AUTO)
15868 spec->init_hook = alc861vd_auto_init;
15869 #ifdef CONFIG_SND_HDA_POWER_SAVE
15870 if (!spec->loopback.amplist)
15871 spec->loopback.amplist = alc861vd_loopbacks;
15873 codec->proc_widget_hook = print_realtek_coef;
15881 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15882 * configuration. Each pin widget can choose any input DACs and a mixer.
15883 * Each ADC is connected from a mixer of all inputs. This makes possible
15884 * 6-channel independent captures.
15886 * In addition, an independent DAC for the multi-playback (not used in this
15889 #define ALC662_DIGOUT_NID 0x06
15890 #define ALC662_DIGIN_NID 0x0a
15892 static hda_nid_t alc662_dac_nids[4] = {
15893 /* front, rear, clfe, rear_surr */
15897 static hda_nid_t alc272_dac_nids[2] = {
15901 static hda_nid_t alc662_adc_nids[2] = {
15906 static hda_nid_t alc272_adc_nids[1] = {
15911 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15912 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15916 /* FIXME: should be a matrix-type input source selection */
15917 static struct hda_input_mux alc662_capture_source = {
15921 { "Front Mic", 0x1 },
15927 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15935 static struct hda_input_mux alc663_capture_source = {
15939 { "Front Mic", 0x1 },
15944 #if 0 /* set to 1 for testing other input sources below */
15945 static struct hda_input_mux alc272_nc10_capture_source = {
15948 { "Autoselect Mic", 0x0 },
15949 { "Internal Mic", 0x1 },
15950 { "In-0x02", 0x2 },
15951 { "In-0x03", 0x3 },
15952 { "In-0x04", 0x4 },
15953 { "In-0x05", 0x5 },
15954 { "In-0x06", 0x6 },
15955 { "In-0x07", 0x7 },
15956 { "In-0x08", 0x8 },
15957 { "In-0x09", 0x9 },
15958 { "In-0x0a", 0x0a },
15959 { "In-0x0b", 0x0b },
15960 { "In-0x0c", 0x0c },
15961 { "In-0x0d", 0x0d },
15962 { "In-0x0e", 0x0e },
15963 { "In-0x0f", 0x0f },
15971 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15978 static struct hda_verb alc662_3ST_ch2_init[] = {
15979 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15980 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15981 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15982 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15989 static struct hda_verb alc662_3ST_ch6_init[] = {
15990 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15991 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15992 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15993 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15994 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15995 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15999 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16000 { 2, alc662_3ST_ch2_init },
16001 { 6, alc662_3ST_ch6_init },
16007 static struct hda_verb alc662_sixstack_ch6_init[] = {
16008 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16009 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16010 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16017 static struct hda_verb alc662_sixstack_ch8_init[] = {
16018 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16019 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16020 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16024 static struct hda_channel_mode alc662_5stack_modes[2] = {
16025 { 2, alc662_sixstack_ch6_init },
16026 { 6, alc662_sixstack_ch8_init },
16029 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16030 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16033 static struct snd_kcontrol_new alc662_base_mixer[] = {
16034 /* output mixer control */
16035 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16036 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16037 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16038 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16039 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16040 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16041 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16042 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16043 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16045 /*Input mixer control */
16046 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16047 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16048 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16049 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16050 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16051 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16052 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16053 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16057 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16058 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16059 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16060 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16061 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16062 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16065 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16066 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16067 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16068 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16072 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16073 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16074 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16075 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16076 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16077 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16078 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16079 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16080 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16081 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16082 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16083 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16084 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16085 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16086 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16087 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16088 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16089 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16093 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16094 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16095 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16096 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16097 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16106 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16107 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16108 ALC262_HIPPO_MASTER_SWITCH,
16110 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16111 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16112 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16114 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16115 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16116 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16120 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16121 ALC262_HIPPO_MASTER_SWITCH,
16122 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16123 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16124 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16125 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16126 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16134 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16135 .ops = &snd_hda_bind_vol,
16137 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16138 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16143 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16144 .ops = &snd_hda_bind_sw,
16146 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16147 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16152 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16153 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16154 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16160 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16161 .ops = &snd_hda_bind_sw,
16163 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16164 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16165 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16170 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16171 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16172 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16173 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16174 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16175 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16176 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16181 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16182 .ops = &snd_hda_bind_sw,
16184 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16185 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16186 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16191 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16192 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16193 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16196 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16197 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16201 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16202 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16203 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16207 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16208 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16212 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16213 .ops = &snd_hda_bind_vol,
16215 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16216 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16221 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16222 .ops = &snd_hda_bind_sw,
16224 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16225 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16230 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16231 HDA_BIND_VOL("Master Playback Volume",
16232 &alc663_asus_two_bind_master_vol),
16233 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16234 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16235 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16241 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16242 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16243 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16244 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16245 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16251 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16252 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16253 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16254 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16255 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16256 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16259 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16260 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16261 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16265 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16266 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16267 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16272 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16273 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16274 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16275 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16279 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16280 .ops = &snd_hda_bind_sw,
16282 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16283 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16284 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16285 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16286 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16291 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16292 .ops = &snd_hda_bind_sw,
16294 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16295 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16300 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16301 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16302 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16303 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16304 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16305 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16306 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16307 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16308 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16309 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16313 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16314 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16315 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16316 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16317 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16318 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16319 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16325 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16327 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16328 .name = "Channel Mode",
16329 .info = alc_ch_mode_info,
16330 .get = alc_ch_mode_get,
16331 .put = alc_ch_mode_put,
16336 static struct hda_verb alc662_init_verbs[] = {
16337 /* ADC: mute amp left and right */
16338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16339 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16340 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16342 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16343 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16346 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16350 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16351 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16352 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16353 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16355 /* Front Pin: output 0 (0x0c) */
16356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16357 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16359 /* Rear Pin: output 1 (0x0d) */
16360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16361 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16363 /* CLFE Pin: output 2 (0x0e) */
16364 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16365 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16367 /* Mic (rear) pin: input vref at 80% */
16368 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16369 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16370 /* Front Mic pin: input vref at 80% */
16371 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16372 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16373 /* Line In pin: input */
16374 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16375 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16376 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16377 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16378 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16379 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16380 /* CD pin widget for input */
16381 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16383 /* FIXME: use matrix-type input source selection */
16384 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16387 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16389 /* always trun on EAPD */
16390 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16391 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16396 static struct hda_verb alc662_sue_init_verbs[] = {
16397 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16398 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16402 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16403 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16404 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16408 /* Set Unsolicited Event*/
16409 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16410 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16411 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16416 * generic initialization of ADC, input mixers and output mixers
16418 static struct hda_verb alc662_auto_init_verbs[] = {
16420 * Unmute ADC and set the default input to mic-in
16422 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16423 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16425 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16427 * Note: PASD motherboards uses the Line In 2 as the input for front
16428 * panel mic (mic 2)
16430 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16431 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16432 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16433 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16434 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16435 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16438 * Set up output mixers (0x0c - 0x0f)
16440 /* set vol=0 to output mixers */
16441 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16442 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16443 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16445 /* set up input amps for analog loopback */
16446 /* Amp Indices: DAC = 0, mixer = 1 */
16447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16449 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16451 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16452 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16455 /* FIXME: use matrix-type input source selection */
16456 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16463 /* additional verbs for ALC663 */
16464 static struct hda_verb alc663_auto_init_verbs[] = {
16465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16466 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16470 static struct hda_verb alc663_m51va_init_verbs[] = {
16471 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16472 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16473 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16474 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16475 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16478 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16479 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16483 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16484 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16485 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16486 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16487 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16489 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16490 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16494 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16495 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16496 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16497 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16498 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16499 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16500 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16501 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16502 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16506 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16507 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16508 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16509 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16510 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16512 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16513 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16517 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16518 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16519 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16520 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16521 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16524 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16527 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16528 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16529 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16533 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16534 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16535 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16536 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16537 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16540 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16541 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16542 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16543 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16544 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16545 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16549 static struct hda_verb alc663_g71v_init_verbs[] = {
16550 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16551 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16552 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16554 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16555 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16556 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16558 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16559 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16560 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16564 static struct hda_verb alc663_g50v_init_verbs[] = {
16565 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16566 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16567 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16569 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16570 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16574 static struct hda_verb alc662_ecs_init_verbs[] = {
16575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16577 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16578 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16582 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16583 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16584 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16586 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16587 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16588 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16589 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16592 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16593 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16597 static struct hda_verb alc272_dell_init_verbs[] = {
16598 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16599 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16601 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16602 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16603 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16604 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16605 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16606 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16607 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16608 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16612 static struct hda_verb alc663_mode7_init_verbs[] = {
16613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16614 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16615 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16616 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16617 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16618 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16619 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16620 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16621 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16622 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16625 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16626 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16627 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16631 static struct hda_verb alc663_mode8_init_verbs[] = {
16632 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16633 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16634 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16635 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16636 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16637 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16638 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16639 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16640 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16641 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16642 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16643 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16645 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16646 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16647 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16651 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16652 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16653 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16657 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16658 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16659 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16663 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16665 unsigned int present;
16666 unsigned char bits;
16668 present = snd_hda_jack_detect(codec, 0x14);
16669 bits = present ? HDA_AMP_MUTE : 0;
16671 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16672 HDA_AMP_MUTE, bits);
16675 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16677 unsigned int present;
16678 unsigned char bits;
16680 present = snd_hda_jack_detect(codec, 0x1b);
16681 bits = present ? HDA_AMP_MUTE : 0;
16683 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16684 HDA_AMP_MUTE, bits);
16685 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16686 HDA_AMP_MUTE, bits);
16689 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16692 if ((res >> 26) == ALC880_HP_EVENT)
16693 alc662_lenovo_101e_all_automute(codec);
16694 if ((res >> 26) == ALC880_FRONT_EVENT)
16695 alc662_lenovo_101e_ispeaker_automute(codec);
16698 /* unsolicited event for HP jack sensing */
16699 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16702 if ((res >> 26) == ALC880_MIC_EVENT)
16703 alc_mic_automute(codec);
16705 alc262_hippo_unsol_event(codec, res);
16708 static void alc662_eeepc_setup(struct hda_codec *codec)
16710 struct alc_spec *spec = codec->spec;
16712 alc262_hippo1_setup(codec);
16713 spec->ext_mic.pin = 0x18;
16714 spec->ext_mic.mux_idx = 0;
16715 spec->int_mic.pin = 0x19;
16716 spec->int_mic.mux_idx = 1;
16717 spec->auto_mic = 1;
16720 static void alc662_eeepc_inithook(struct hda_codec *codec)
16722 alc262_hippo_automute(codec);
16723 alc_mic_automute(codec);
16726 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16728 struct alc_spec *spec = codec->spec;
16730 spec->autocfg.hp_pins[0] = 0x14;
16731 spec->autocfg.speaker_pins[0] = 0x1b;
16734 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16736 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16738 unsigned int present;
16739 unsigned char bits;
16741 present = snd_hda_jack_detect(codec, 0x21);
16742 bits = present ? HDA_AMP_MUTE : 0;
16743 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16744 AMP_IN_MUTE(0), bits);
16745 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16746 AMP_IN_MUTE(0), bits);
16749 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16751 unsigned int present;
16752 unsigned char bits;
16754 present = snd_hda_jack_detect(codec, 0x21);
16755 bits = present ? HDA_AMP_MUTE : 0;
16756 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16757 AMP_IN_MUTE(0), bits);
16758 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16759 AMP_IN_MUTE(0), bits);
16760 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16761 AMP_IN_MUTE(0), bits);
16762 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16763 AMP_IN_MUTE(0), bits);
16766 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16768 unsigned int present;
16769 unsigned char bits;
16771 present = snd_hda_jack_detect(codec, 0x15);
16772 bits = present ? HDA_AMP_MUTE : 0;
16773 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16774 AMP_IN_MUTE(0), bits);
16775 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16776 AMP_IN_MUTE(0), bits);
16777 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16778 AMP_IN_MUTE(0), bits);
16779 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16780 AMP_IN_MUTE(0), bits);
16783 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16785 unsigned int present;
16786 unsigned char bits;
16788 present = snd_hda_jack_detect(codec, 0x1b);
16789 bits = present ? 0 : PIN_OUT;
16790 snd_hda_codec_write(codec, 0x14, 0,
16791 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16794 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16796 unsigned int present1, present2;
16798 present1 = snd_hda_jack_detect(codec, 0x21);
16799 present2 = snd_hda_jack_detect(codec, 0x15);
16801 if (present1 || present2) {
16802 snd_hda_codec_write_cache(codec, 0x14, 0,
16803 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16805 snd_hda_codec_write_cache(codec, 0x14, 0,
16806 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16810 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16812 unsigned int present1, present2;
16814 present1 = snd_hda_jack_detect(codec, 0x1b);
16815 present2 = snd_hda_jack_detect(codec, 0x15);
16817 if (present1 || present2) {
16818 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16819 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16820 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16821 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16823 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16824 AMP_IN_MUTE(0), 0);
16825 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16826 AMP_IN_MUTE(0), 0);
16830 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16832 unsigned int present1, present2;
16834 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16835 AC_VERB_GET_PIN_SENSE, 0)
16836 & AC_PINSENSE_PRESENCE;
16837 present2 = snd_hda_codec_read(codec, 0x21, 0,
16838 AC_VERB_GET_PIN_SENSE, 0)
16839 & AC_PINSENSE_PRESENCE;
16841 if (present1 || present2) {
16842 snd_hda_codec_write_cache(codec, 0x14, 0,
16843 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16844 snd_hda_codec_write_cache(codec, 0x17, 0,
16845 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16847 snd_hda_codec_write_cache(codec, 0x14, 0,
16848 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16849 snd_hda_codec_write_cache(codec, 0x17, 0,
16850 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16854 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16856 unsigned int present1, present2;
16858 present1 = snd_hda_codec_read(codec, 0x21, 0,
16859 AC_VERB_GET_PIN_SENSE, 0)
16860 & AC_PINSENSE_PRESENCE;
16861 present2 = snd_hda_codec_read(codec, 0x15, 0,
16862 AC_VERB_GET_PIN_SENSE, 0)
16863 & AC_PINSENSE_PRESENCE;
16865 if (present1 || present2) {
16866 snd_hda_codec_write_cache(codec, 0x14, 0,
16867 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16868 snd_hda_codec_write_cache(codec, 0x17, 0,
16869 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16871 snd_hda_codec_write_cache(codec, 0x14, 0,
16872 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16873 snd_hda_codec_write_cache(codec, 0x17, 0,
16874 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16878 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16881 switch (res >> 26) {
16882 case ALC880_HP_EVENT:
16883 alc663_m51va_speaker_automute(codec);
16885 case ALC880_MIC_EVENT:
16886 alc_mic_automute(codec);
16891 static void alc663_m51va_setup(struct hda_codec *codec)
16893 struct alc_spec *spec = codec->spec;
16894 spec->ext_mic.pin = 0x18;
16895 spec->ext_mic.mux_idx = 0;
16896 spec->int_mic.pin = 0x12;
16897 spec->int_mic.mux_idx = 9;
16898 spec->auto_mic = 1;
16901 static void alc663_m51va_inithook(struct hda_codec *codec)
16903 alc663_m51va_speaker_automute(codec);
16904 alc_mic_automute(codec);
16907 /* ***************** Mode1 ******************************/
16908 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16910 static void alc663_mode1_setup(struct hda_codec *codec)
16912 struct alc_spec *spec = codec->spec;
16913 spec->ext_mic.pin = 0x18;
16914 spec->ext_mic.mux_idx = 0;
16915 spec->int_mic.pin = 0x19;
16916 spec->int_mic.mux_idx = 1;
16917 spec->auto_mic = 1;
16920 #define alc663_mode1_inithook alc663_m51va_inithook
16922 /* ***************** Mode2 ******************************/
16923 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16926 switch (res >> 26) {
16927 case ALC880_HP_EVENT:
16928 alc662_f5z_speaker_automute(codec);
16930 case ALC880_MIC_EVENT:
16931 alc_mic_automute(codec);
16936 #define alc662_mode2_setup alc663_mode1_setup
16938 static void alc662_mode2_inithook(struct hda_codec *codec)
16940 alc662_f5z_speaker_automute(codec);
16941 alc_mic_automute(codec);
16943 /* ***************** Mode3 ******************************/
16944 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16947 switch (res >> 26) {
16948 case ALC880_HP_EVENT:
16949 alc663_two_hp_m1_speaker_automute(codec);
16951 case ALC880_MIC_EVENT:
16952 alc_mic_automute(codec);
16957 #define alc663_mode3_setup alc663_mode1_setup
16959 static void alc663_mode3_inithook(struct hda_codec *codec)
16961 alc663_two_hp_m1_speaker_automute(codec);
16962 alc_mic_automute(codec);
16964 /* ***************** Mode4 ******************************/
16965 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16968 switch (res >> 26) {
16969 case ALC880_HP_EVENT:
16970 alc663_21jd_two_speaker_automute(codec);
16972 case ALC880_MIC_EVENT:
16973 alc_mic_automute(codec);
16978 #define alc663_mode4_setup alc663_mode1_setup
16980 static void alc663_mode4_inithook(struct hda_codec *codec)
16982 alc663_21jd_two_speaker_automute(codec);
16983 alc_mic_automute(codec);
16985 /* ***************** Mode5 ******************************/
16986 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16989 switch (res >> 26) {
16990 case ALC880_HP_EVENT:
16991 alc663_15jd_two_speaker_automute(codec);
16993 case ALC880_MIC_EVENT:
16994 alc_mic_automute(codec);
16999 #define alc663_mode5_setup alc663_mode1_setup
17001 static void alc663_mode5_inithook(struct hda_codec *codec)
17003 alc663_15jd_two_speaker_automute(codec);
17004 alc_mic_automute(codec);
17006 /* ***************** Mode6 ******************************/
17007 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17010 switch (res >> 26) {
17011 case ALC880_HP_EVENT:
17012 alc663_two_hp_m2_speaker_automute(codec);
17014 case ALC880_MIC_EVENT:
17015 alc_mic_automute(codec);
17020 #define alc663_mode6_setup alc663_mode1_setup
17022 static void alc663_mode6_inithook(struct hda_codec *codec)
17024 alc663_two_hp_m2_speaker_automute(codec);
17025 alc_mic_automute(codec);
17028 /* ***************** Mode7 ******************************/
17029 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17032 switch (res >> 26) {
17033 case ALC880_HP_EVENT:
17034 alc663_two_hp_m7_speaker_automute(codec);
17036 case ALC880_MIC_EVENT:
17037 alc_mic_automute(codec);
17042 #define alc663_mode7_setup alc663_mode1_setup
17044 static void alc663_mode7_inithook(struct hda_codec *codec)
17046 alc663_two_hp_m7_speaker_automute(codec);
17047 alc_mic_automute(codec);
17050 /* ***************** Mode8 ******************************/
17051 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17054 switch (res >> 26) {
17055 case ALC880_HP_EVENT:
17056 alc663_two_hp_m8_speaker_automute(codec);
17058 case ALC880_MIC_EVENT:
17059 alc_mic_automute(codec);
17064 #define alc663_mode8_setup alc663_m51va_setup
17066 static void alc663_mode8_inithook(struct hda_codec *codec)
17068 alc663_two_hp_m8_speaker_automute(codec);
17069 alc_mic_automute(codec);
17072 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17074 unsigned int present;
17075 unsigned char bits;
17077 present = snd_hda_jack_detect(codec, 0x21);
17078 bits = present ? HDA_AMP_MUTE : 0;
17079 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17080 HDA_AMP_MUTE, bits);
17081 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17082 HDA_AMP_MUTE, bits);
17085 static void alc663_g71v_front_automute(struct hda_codec *codec)
17087 unsigned int present;
17088 unsigned char bits;
17090 present = snd_hda_jack_detect(codec, 0x15);
17091 bits = present ? HDA_AMP_MUTE : 0;
17092 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17093 HDA_AMP_MUTE, bits);
17096 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17099 switch (res >> 26) {
17100 case ALC880_HP_EVENT:
17101 alc663_g71v_hp_automute(codec);
17103 case ALC880_FRONT_EVENT:
17104 alc663_g71v_front_automute(codec);
17106 case ALC880_MIC_EVENT:
17107 alc_mic_automute(codec);
17112 #define alc663_g71v_setup alc663_m51va_setup
17114 static void alc663_g71v_inithook(struct hda_codec *codec)
17116 alc663_g71v_front_automute(codec);
17117 alc663_g71v_hp_automute(codec);
17118 alc_mic_automute(codec);
17121 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17124 switch (res >> 26) {
17125 case ALC880_HP_EVENT:
17126 alc663_m51va_speaker_automute(codec);
17128 case ALC880_MIC_EVENT:
17129 alc_mic_automute(codec);
17134 #define alc663_g50v_setup alc663_m51va_setup
17136 static void alc663_g50v_inithook(struct hda_codec *codec)
17138 alc663_m51va_speaker_automute(codec);
17139 alc_mic_automute(codec);
17142 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17143 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17144 ALC262_HIPPO_MASTER_SWITCH,
17146 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17147 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17148 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17150 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17151 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17152 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17156 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17157 /* Master Playback automatically created from Speaker and Headphone */
17158 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17159 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17160 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17161 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17163 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17164 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17165 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17167 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17168 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17169 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17173 #ifdef CONFIG_SND_HDA_POWER_SAVE
17174 #define alc662_loopbacks alc880_loopbacks
17178 /* pcm configuration: identical with ALC880 */
17179 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17180 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17181 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17182 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17185 * configuration and preset
17187 static const char *alc662_models[ALC662_MODEL_LAST] = {
17188 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17189 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17190 [ALC662_3ST_6ch] = "3stack-6ch",
17191 [ALC662_5ST_DIG] = "6stack-dig",
17192 [ALC662_LENOVO_101E] = "lenovo-101e",
17193 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17194 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17195 [ALC662_ECS] = "ecs",
17196 [ALC663_ASUS_M51VA] = "m51va",
17197 [ALC663_ASUS_G71V] = "g71v",
17198 [ALC663_ASUS_H13] = "h13",
17199 [ALC663_ASUS_G50V] = "g50v",
17200 [ALC663_ASUS_MODE1] = "asus-mode1",
17201 [ALC662_ASUS_MODE2] = "asus-mode2",
17202 [ALC663_ASUS_MODE3] = "asus-mode3",
17203 [ALC663_ASUS_MODE4] = "asus-mode4",
17204 [ALC663_ASUS_MODE5] = "asus-mode5",
17205 [ALC663_ASUS_MODE6] = "asus-mode6",
17206 [ALC663_ASUS_MODE7] = "asus-mode7",
17207 [ALC663_ASUS_MODE8] = "asus-mode8",
17208 [ALC272_DELL] = "dell",
17209 [ALC272_DELL_ZM1] = "dell-zm1",
17210 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17211 [ALC662_AUTO] = "auto",
17214 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17215 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17216 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17217 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17218 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17219 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17220 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17221 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17222 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17223 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17224 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17225 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17226 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17227 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17228 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17229 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17230 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17231 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17232 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17233 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17234 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17235 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17236 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17237 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17238 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17239 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17240 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17241 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17242 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17243 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17244 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17245 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17246 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17247 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17248 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17249 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17250 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17251 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17252 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17253 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17254 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17255 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17256 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17257 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17258 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17259 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17260 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17261 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17262 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17263 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17264 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17265 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17266 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17267 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17268 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17269 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17270 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17271 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17272 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17273 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17274 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17275 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17276 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17277 ALC662_3ST_6ch_DIG),
17278 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17279 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17280 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17281 ALC662_3ST_6ch_DIG),
17282 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17283 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17284 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17285 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17286 ALC662_3ST_6ch_DIG),
17287 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17289 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17293 static struct alc_config_preset alc662_presets[] = {
17294 [ALC662_3ST_2ch_DIG] = {
17295 .mixers = { alc662_3ST_2ch_mixer },
17296 .init_verbs = { alc662_init_verbs },
17297 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17298 .dac_nids = alc662_dac_nids,
17299 .dig_out_nid = ALC662_DIGOUT_NID,
17300 .dig_in_nid = ALC662_DIGIN_NID,
17301 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17302 .channel_mode = alc662_3ST_2ch_modes,
17303 .input_mux = &alc662_capture_source,
17305 [ALC662_3ST_6ch_DIG] = {
17306 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17307 .init_verbs = { alc662_init_verbs },
17308 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17309 .dac_nids = alc662_dac_nids,
17310 .dig_out_nid = ALC662_DIGOUT_NID,
17311 .dig_in_nid = ALC662_DIGIN_NID,
17312 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17313 .channel_mode = alc662_3ST_6ch_modes,
17315 .input_mux = &alc662_capture_source,
17317 [ALC662_3ST_6ch] = {
17318 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17319 .init_verbs = { alc662_init_verbs },
17320 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17321 .dac_nids = alc662_dac_nids,
17322 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17323 .channel_mode = alc662_3ST_6ch_modes,
17325 .input_mux = &alc662_capture_source,
17327 [ALC662_5ST_DIG] = {
17328 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17329 .init_verbs = { alc662_init_verbs },
17330 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17331 .dac_nids = alc662_dac_nids,
17332 .dig_out_nid = ALC662_DIGOUT_NID,
17333 .dig_in_nid = ALC662_DIGIN_NID,
17334 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17335 .channel_mode = alc662_5stack_modes,
17336 .input_mux = &alc662_capture_source,
17338 [ALC662_LENOVO_101E] = {
17339 .mixers = { alc662_lenovo_101e_mixer },
17340 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17341 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17342 .dac_nids = alc662_dac_nids,
17343 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17344 .channel_mode = alc662_3ST_2ch_modes,
17345 .input_mux = &alc662_lenovo_101e_capture_source,
17346 .unsol_event = alc662_lenovo_101e_unsol_event,
17347 .init_hook = alc662_lenovo_101e_all_automute,
17349 [ALC662_ASUS_EEEPC_P701] = {
17350 .mixers = { alc662_eeepc_p701_mixer },
17351 .init_verbs = { alc662_init_verbs,
17352 alc662_eeepc_sue_init_verbs },
17353 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17354 .dac_nids = alc662_dac_nids,
17355 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17356 .channel_mode = alc662_3ST_2ch_modes,
17357 .unsol_event = alc662_eeepc_unsol_event,
17358 .setup = alc662_eeepc_setup,
17359 .init_hook = alc662_eeepc_inithook,
17361 [ALC662_ASUS_EEEPC_EP20] = {
17362 .mixers = { alc662_eeepc_ep20_mixer,
17363 alc662_chmode_mixer },
17364 .init_verbs = { alc662_init_verbs,
17365 alc662_eeepc_ep20_sue_init_verbs },
17366 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17367 .dac_nids = alc662_dac_nids,
17368 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17369 .channel_mode = alc662_3ST_6ch_modes,
17370 .input_mux = &alc662_lenovo_101e_capture_source,
17371 .unsol_event = alc662_eeepc_unsol_event,
17372 .setup = alc662_eeepc_ep20_setup,
17373 .init_hook = alc662_eeepc_ep20_inithook,
17376 .mixers = { alc662_ecs_mixer },
17377 .init_verbs = { alc662_init_verbs,
17378 alc662_ecs_init_verbs },
17379 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17380 .dac_nids = alc662_dac_nids,
17381 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17382 .channel_mode = alc662_3ST_2ch_modes,
17383 .unsol_event = alc662_eeepc_unsol_event,
17384 .setup = alc662_eeepc_setup,
17385 .init_hook = alc662_eeepc_inithook,
17387 [ALC663_ASUS_M51VA] = {
17388 .mixers = { alc663_m51va_mixer },
17389 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17390 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17391 .dac_nids = alc662_dac_nids,
17392 .dig_out_nid = ALC662_DIGOUT_NID,
17393 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17394 .channel_mode = alc662_3ST_2ch_modes,
17395 .unsol_event = alc663_m51va_unsol_event,
17396 .setup = alc663_m51va_setup,
17397 .init_hook = alc663_m51va_inithook,
17399 [ALC663_ASUS_G71V] = {
17400 .mixers = { alc663_g71v_mixer },
17401 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17402 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17403 .dac_nids = alc662_dac_nids,
17404 .dig_out_nid = ALC662_DIGOUT_NID,
17405 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17406 .channel_mode = alc662_3ST_2ch_modes,
17407 .unsol_event = alc663_g71v_unsol_event,
17408 .setup = alc663_g71v_setup,
17409 .init_hook = alc663_g71v_inithook,
17411 [ALC663_ASUS_H13] = {
17412 .mixers = { alc663_m51va_mixer },
17413 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17414 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17415 .dac_nids = alc662_dac_nids,
17416 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17417 .channel_mode = alc662_3ST_2ch_modes,
17418 .unsol_event = alc663_m51va_unsol_event,
17419 .init_hook = alc663_m51va_inithook,
17421 [ALC663_ASUS_G50V] = {
17422 .mixers = { alc663_g50v_mixer },
17423 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17424 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17425 .dac_nids = alc662_dac_nids,
17426 .dig_out_nid = ALC662_DIGOUT_NID,
17427 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17428 .channel_mode = alc662_3ST_6ch_modes,
17429 .input_mux = &alc663_capture_source,
17430 .unsol_event = alc663_g50v_unsol_event,
17431 .setup = alc663_g50v_setup,
17432 .init_hook = alc663_g50v_inithook,
17434 [ALC663_ASUS_MODE1] = {
17435 .mixers = { alc663_m51va_mixer },
17436 .cap_mixer = alc662_auto_capture_mixer,
17437 .init_verbs = { alc662_init_verbs,
17438 alc663_21jd_amic_init_verbs },
17439 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17441 .dac_nids = alc662_dac_nids,
17442 .dig_out_nid = ALC662_DIGOUT_NID,
17443 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17444 .channel_mode = alc662_3ST_2ch_modes,
17445 .unsol_event = alc663_mode1_unsol_event,
17446 .setup = alc663_mode1_setup,
17447 .init_hook = alc663_mode1_inithook,
17449 [ALC662_ASUS_MODE2] = {
17450 .mixers = { alc662_1bjd_mixer },
17451 .cap_mixer = alc662_auto_capture_mixer,
17452 .init_verbs = { alc662_init_verbs,
17453 alc662_1bjd_amic_init_verbs },
17454 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17455 .dac_nids = alc662_dac_nids,
17456 .dig_out_nid = ALC662_DIGOUT_NID,
17457 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17458 .channel_mode = alc662_3ST_2ch_modes,
17459 .unsol_event = alc662_mode2_unsol_event,
17460 .setup = alc662_mode2_setup,
17461 .init_hook = alc662_mode2_inithook,
17463 [ALC663_ASUS_MODE3] = {
17464 .mixers = { alc663_two_hp_m1_mixer },
17465 .cap_mixer = alc662_auto_capture_mixer,
17466 .init_verbs = { alc662_init_verbs,
17467 alc663_two_hp_amic_m1_init_verbs },
17468 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17470 .dac_nids = alc662_dac_nids,
17471 .dig_out_nid = ALC662_DIGOUT_NID,
17472 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17473 .channel_mode = alc662_3ST_2ch_modes,
17474 .unsol_event = alc663_mode3_unsol_event,
17475 .setup = alc663_mode3_setup,
17476 .init_hook = alc663_mode3_inithook,
17478 [ALC663_ASUS_MODE4] = {
17479 .mixers = { alc663_asus_21jd_clfe_mixer },
17480 .cap_mixer = alc662_auto_capture_mixer,
17481 .init_verbs = { alc662_init_verbs,
17482 alc663_21jd_amic_init_verbs},
17483 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17485 .dac_nids = alc662_dac_nids,
17486 .dig_out_nid = ALC662_DIGOUT_NID,
17487 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17488 .channel_mode = alc662_3ST_2ch_modes,
17489 .unsol_event = alc663_mode4_unsol_event,
17490 .setup = alc663_mode4_setup,
17491 .init_hook = alc663_mode4_inithook,
17493 [ALC663_ASUS_MODE5] = {
17494 .mixers = { alc663_asus_15jd_clfe_mixer },
17495 .cap_mixer = alc662_auto_capture_mixer,
17496 .init_verbs = { alc662_init_verbs,
17497 alc663_15jd_amic_init_verbs },
17498 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17500 .dac_nids = alc662_dac_nids,
17501 .dig_out_nid = ALC662_DIGOUT_NID,
17502 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17503 .channel_mode = alc662_3ST_2ch_modes,
17504 .unsol_event = alc663_mode5_unsol_event,
17505 .setup = alc663_mode5_setup,
17506 .init_hook = alc663_mode5_inithook,
17508 [ALC663_ASUS_MODE6] = {
17509 .mixers = { alc663_two_hp_m2_mixer },
17510 .cap_mixer = alc662_auto_capture_mixer,
17511 .init_verbs = { alc662_init_verbs,
17512 alc663_two_hp_amic_m2_init_verbs },
17513 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17515 .dac_nids = alc662_dac_nids,
17516 .dig_out_nid = ALC662_DIGOUT_NID,
17517 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17518 .channel_mode = alc662_3ST_2ch_modes,
17519 .unsol_event = alc663_mode6_unsol_event,
17520 .setup = alc663_mode6_setup,
17521 .init_hook = alc663_mode6_inithook,
17523 [ALC663_ASUS_MODE7] = {
17524 .mixers = { alc663_mode7_mixer },
17525 .cap_mixer = alc662_auto_capture_mixer,
17526 .init_verbs = { alc662_init_verbs,
17527 alc663_mode7_init_verbs },
17528 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17530 .dac_nids = alc662_dac_nids,
17531 .dig_out_nid = ALC662_DIGOUT_NID,
17532 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17533 .channel_mode = alc662_3ST_2ch_modes,
17534 .unsol_event = alc663_mode7_unsol_event,
17535 .setup = alc663_mode7_setup,
17536 .init_hook = alc663_mode7_inithook,
17538 [ALC663_ASUS_MODE8] = {
17539 .mixers = { alc663_mode8_mixer },
17540 .cap_mixer = alc662_auto_capture_mixer,
17541 .init_verbs = { alc662_init_verbs,
17542 alc663_mode8_init_verbs },
17543 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17545 .dac_nids = alc662_dac_nids,
17546 .dig_out_nid = ALC662_DIGOUT_NID,
17547 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17548 .channel_mode = alc662_3ST_2ch_modes,
17549 .unsol_event = alc663_mode8_unsol_event,
17550 .setup = alc663_mode8_setup,
17551 .init_hook = alc663_mode8_inithook,
17554 .mixers = { alc663_m51va_mixer },
17555 .cap_mixer = alc272_auto_capture_mixer,
17556 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17557 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17558 .dac_nids = alc662_dac_nids,
17559 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17560 .adc_nids = alc272_adc_nids,
17561 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17562 .capsrc_nids = alc272_capsrc_nids,
17563 .channel_mode = alc662_3ST_2ch_modes,
17564 .unsol_event = alc663_m51va_unsol_event,
17565 .setup = alc663_m51va_setup,
17566 .init_hook = alc663_m51va_inithook,
17568 [ALC272_DELL_ZM1] = {
17569 .mixers = { alc663_m51va_mixer },
17570 .cap_mixer = alc662_auto_capture_mixer,
17571 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17572 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17573 .dac_nids = alc662_dac_nids,
17574 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17575 .adc_nids = alc662_adc_nids,
17577 .capsrc_nids = alc662_capsrc_nids,
17578 .channel_mode = alc662_3ST_2ch_modes,
17579 .unsol_event = alc663_m51va_unsol_event,
17580 .setup = alc663_m51va_setup,
17581 .init_hook = alc663_m51va_inithook,
17583 [ALC272_SAMSUNG_NC10] = {
17584 .mixers = { alc272_nc10_mixer },
17585 .init_verbs = { alc662_init_verbs,
17586 alc663_21jd_amic_init_verbs },
17587 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17588 .dac_nids = alc272_dac_nids,
17589 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17590 .channel_mode = alc662_3ST_2ch_modes,
17591 /*.input_mux = &alc272_nc10_capture_source,*/
17592 .unsol_event = alc663_mode4_unsol_event,
17593 .setup = alc663_mode4_setup,
17594 .init_hook = alc663_mode4_inithook,
17600 * BIOS auto configuration
17603 /* convert from MIX nid to DAC */
17604 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17608 else if (nid >= 0x0c && nid <= 0x0e)
17609 return nid - 0x0c + 0x02;
17614 /* get MIX nid connected to the given pin targeted to DAC */
17615 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17621 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17622 for (i = 0; i < num; i++) {
17623 if (alc662_mix_to_dac(mix[i]) == dac)
17629 /* look for an empty DAC slot */
17630 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17632 struct alc_spec *spec = codec->spec;
17636 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17639 for (i = 0; i < num; i++) {
17640 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17643 for (j = 0; j < spec->multiout.num_dacs; j++)
17644 if (spec->multiout.dac_nids[j] == nid)
17646 if (j >= spec->multiout.num_dacs)
17652 /* fill in the dac_nids table from the parsed pin configuration */
17653 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17654 const struct auto_pin_cfg *cfg)
17656 struct alc_spec *spec = codec->spec;
17660 spec->multiout.dac_nids = spec->private_dac_nids;
17661 for (i = 0; i < cfg->line_outs; i++) {
17662 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17665 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17670 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17671 hda_nid_t nid, unsigned int chs)
17673 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17674 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17677 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17678 hda_nid_t nid, unsigned int chs)
17680 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17681 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17684 #define alc662_add_stereo_vol(spec, pfx, nid) \
17685 alc662_add_vol_ctl(spec, pfx, nid, 3)
17686 #define alc662_add_stereo_sw(spec, pfx, nid) \
17687 alc662_add_sw_ctl(spec, pfx, nid, 3)
17689 /* add playback controls from the parsed DAC table */
17690 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17691 const struct auto_pin_cfg *cfg)
17693 struct alc_spec *spec = codec->spec;
17694 static const char *chname[4] = {
17695 "Front", "Surround", NULL /*CLFE*/, "Side"
17697 hda_nid_t nid, mix;
17700 for (i = 0; i < cfg->line_outs; i++) {
17701 nid = spec->multiout.dac_nids[i];
17704 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17709 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17712 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17715 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17718 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17723 if (cfg->line_outs == 1 &&
17724 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17731 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17734 if (cfg->line_outs == 1 &&
17735 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17737 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17745 /* add playback controls for speaker and HP outputs */
17746 /* return DAC nid if any new DAC is assigned */
17747 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17750 struct alc_spec *spec = codec->spec;
17751 hda_nid_t nid, mix;
17756 nid = alc662_look_for_dac(codec, pin);
17758 /* the corresponding DAC is already occupied */
17759 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17760 return 0; /* no way */
17761 /* create a switch only */
17762 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17763 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17766 mix = alc662_dac_to_mix(codec, pin, nid);
17769 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17772 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17778 /* create playback/capture controls for input pins */
17779 #define alc662_auto_create_input_ctls \
17780 alc882_auto_create_input_ctls
17782 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17783 hda_nid_t nid, int pin_type,
17789 alc_set_pin_output(codec, nid, pin_type);
17790 /* need the manual connection? */
17791 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17794 for (i = 0; i < num; i++) {
17795 if (alc662_mix_to_dac(srcs[i]) != dac)
17797 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17802 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17804 struct alc_spec *spec = codec->spec;
17805 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17808 for (i = 0; i <= HDA_SIDE; i++) {
17809 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17811 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17812 spec->multiout.dac_nids[i]);
17816 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17818 struct alc_spec *spec = codec->spec;
17821 pin = spec->autocfg.hp_pins[0];
17823 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17824 spec->multiout.hp_nid);
17825 pin = spec->autocfg.speaker_pins[0];
17827 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17828 spec->multiout.extra_out_nid[0]);
17831 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17833 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17835 struct alc_spec *spec = codec->spec;
17838 for (i = 0; i < AUTO_PIN_LAST; i++) {
17839 hda_nid_t nid = spec->autocfg.input_pins[i];
17840 if (alc_is_input_pin(codec, nid)) {
17841 alc_set_input_pin(codec, nid, i);
17842 if (nid != ALC662_PIN_CD_NID &&
17843 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17844 snd_hda_codec_write(codec, nid, 0,
17845 AC_VERB_SET_AMP_GAIN_MUTE,
17851 #define alc662_auto_init_input_src alc882_auto_init_input_src
17853 static int alc662_parse_auto_config(struct hda_codec *codec)
17855 struct alc_spec *spec = codec->spec;
17857 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17859 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17863 if (!spec->autocfg.line_outs)
17864 return 0; /* can't find valid BIOS pin config */
17866 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17869 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17872 err = alc662_auto_create_extra_out(codec,
17873 spec->autocfg.speaker_pins[0],
17878 spec->multiout.extra_out_nid[0] = err;
17879 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17884 spec->multiout.hp_nid = err;
17885 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17889 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17891 if (spec->autocfg.dig_outs)
17892 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17894 if (spec->kctls.list)
17895 add_mixer(spec, spec->kctls.list);
17897 spec->num_mux_defs = 1;
17898 spec->input_mux = &spec->private_imux[0];
17900 add_verb(spec, alc662_auto_init_verbs);
17901 if (codec->vendor_id == 0x10ec0663)
17902 add_verb(spec, alc663_auto_init_verbs);
17904 err = alc_auto_add_mic_boost(codec);
17908 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17913 /* additional initialization for auto-configuration model */
17914 static void alc662_auto_init(struct hda_codec *codec)
17916 struct alc_spec *spec = codec->spec;
17917 alc662_auto_init_multi_out(codec);
17918 alc662_auto_init_hp_out(codec);
17919 alc662_auto_init_analog_input(codec);
17920 alc662_auto_init_input_src(codec);
17921 if (spec->unsol_event)
17922 alc_inithook(codec);
17925 static int patch_alc662(struct hda_codec *codec)
17927 struct alc_spec *spec;
17928 int err, board_config;
17930 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17934 codec->spec = spec;
17936 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17938 if (alc_read_coef_idx(codec, 0)==0x8020){
17939 kfree(codec->chip_name);
17940 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17941 if (!codec->chip_name) {
17947 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17950 if (board_config < 0) {
17951 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17953 board_config = ALC662_AUTO;
17956 if (board_config == ALC662_AUTO) {
17957 /* automatic parse from the BIOS config */
17958 err = alc662_parse_auto_config(codec);
17964 "hda_codec: Cannot set up configuration "
17965 "from BIOS. Using base mode...\n");
17966 board_config = ALC662_3ST_2ch_DIG;
17970 err = snd_hda_attach_beep_device(codec, 0x1);
17976 if (board_config != ALC662_AUTO)
17977 setup_preset(codec, &alc662_presets[board_config]);
17979 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17980 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17982 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17983 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17985 if (!spec->adc_nids) {
17986 spec->adc_nids = alc662_adc_nids;
17987 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17989 if (!spec->capsrc_nids)
17990 spec->capsrc_nids = alc662_capsrc_nids;
17992 if (!spec->cap_mixer)
17993 set_capture_mixer(codec);
17994 if (codec->vendor_id == 0x10ec0662)
17995 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17997 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17999 spec->vmaster_nid = 0x02;
18001 codec->patch_ops = alc_patch_ops;
18002 if (board_config == ALC662_AUTO)
18003 spec->init_hook = alc662_auto_init;
18004 #ifdef CONFIG_SND_HDA_POWER_SAVE
18005 if (!spec->loopback.amplist)
18006 spec->loopback.amplist = alc662_loopbacks;
18008 codec->proc_widget_hook = print_realtek_coef;
18013 static int patch_alc888(struct hda_codec *codec)
18015 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18016 kfree(codec->chip_name);
18017 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18018 if (!codec->chip_name) {
18022 return patch_alc662(codec);
18024 return patch_alc882(codec);
18030 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18031 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18032 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18033 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18034 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18035 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18036 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18037 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18038 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18039 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18040 .patch = patch_alc861 },
18041 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18042 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18043 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18044 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18045 .patch = patch_alc882 },
18046 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18047 .patch = patch_alc662 },
18048 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18049 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18050 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18051 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18052 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18053 .patch = patch_alc882 },
18054 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18055 .patch = patch_alc882 },
18056 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18057 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18058 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18059 .patch = patch_alc882 },
18060 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18061 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18062 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18063 {} /* terminator */
18066 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18068 MODULE_LICENSE("GPL");
18069 MODULE_DESCRIPTION("Realtek HD-audio codec");
18071 static struct hda_codec_preset_list realtek_list = {
18072 .preset = snd_hda_preset_realtek,
18073 .owner = THIS_MODULE,
18076 static int __init patch_realtek_init(void)
18078 return snd_hda_add_codec_preset(&realtek_list);
18081 static void __exit patch_realtek_exit(void)
18083 snd_hda_delete_codec_preset(&realtek_list);
18086 module_init(patch_realtek_init)
18087 module_exit(patch_realtek_exit)